@@ -4,12 +4,14 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
4
4
"""
5
5
import Ecto.Query , warn: false
6
6
import Helper.ErrorCode
7
- import Helper.CommonTypes
8
7
# import ShortMaps
9
8
9
+ alias GroupherServer.CMS
10
+
10
11
alias Helper.ORM
12
+ alias Helper.SpecType , as: T
11
13
12
- alias GroupherServer. CMS. {
14
+ alias CMS . {
13
15
Community ,
14
16
CommunityWiki ,
15
17
CommunityCheatsheet
@@ -46,7 +48,7 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
46
48
@ doc """
47
49
sync wiki
48
50
"""
49
- @ spec sync_github_content ( Community . t ( ) , atom ) :: { :ok , CommunityWiki . t ( ) }
51
+ @ spec sync_github_content ( Community . t ( ) , atom ( ) , any ( ) ) :: { :ok , CommunityWiki . t ( ) }
50
52
def sync_github_content ( % Community { id: id } , :wiki , attrs ) do
51
53
with { :ok , community } <- ORM . find ( Community , id ) do
52
54
attrs = Map . merge ( attrs , % { community_id: community . id } )
@@ -58,7 +60,7 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
58
60
@ doc """
59
61
sync cheatsheet
60
62
"""
61
- @ spec sync_github_content ( Community . t ( ) , atom ( ) ) :: { :ok , CommunityCheatsheet . t ( ) }
63
+ @ spec sync_github_content ( Community . t ( ) , atom ( ) , any ( ) ) :: { :ok , CommunityCheatsheet . t ( ) }
62
64
def sync_github_content ( % Community { id: id } , :cheatsheet , attrs ) do
63
65
with { :ok , community } <- ORM . find ( Community , id ) do
64
66
attrs = Map . merge ( attrs , % { community_id: community . id } )
@@ -70,17 +72,17 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
70
72
@ doc """
71
73
add contributor to exsit wiki contributors list
72
74
"""
73
- @ spec add_contributor ( Community . t ( ) , github_contributor ( ) ) ::
74
- { :ok , CommunityWiki } | custom_error ( )
75
+ @ spec add_contributor ( Community . t ( ) , T . github_contributor ( ) ) ::
76
+ { :ok , CommunityWiki } | T . gq_error ( )
75
77
def add_contributor ( % CommunityWiki { id: id } , contributor_attrs ) do
76
78
do_add_contributor ( CommunityWiki , id , contributor_attrs )
77
79
end
78
80
79
81
@ doc """
80
82
add contributor to exsit cheatsheet contributors list
81
83
"""
82
- @ spec add_contributor ( Community . t ( ) , github_contributor ( ) ) ::
83
- { :ok , CommunityCheatsheet } | custom_error ( )
84
+ @ spec add_contributor ( Community . t ( ) , T . github_contributor ( ) ) ::
85
+ { :ok , CommunityCheatsheet } | T . gq_error ( )
84
86
def add_contributor ( % CommunityCheatsheet { id: id } , contributor_attrs ) do
85
87
do_add_contributor ( CommunityCheatsheet , id , contributor_attrs )
86
88
end
0 commit comments