@@ -4,12 +4,14 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
44 """
55 import Ecto.Query , warn: false
66 import Helper.ErrorCode
7- import Helper.CommonTypes
87 # import ShortMaps
98
9+ alias GroupherServer.CMS
10+
1011 alias Helper.ORM
12+ alias Helper.SpecType , as: T
1113
12- alias GroupherServer. CMS. {
14+ alias CMS . {
1315 Community ,
1416 CommunityWiki ,
1517 CommunityCheatsheet
@@ -46,7 +48,7 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
4648 @ doc """
4749 sync wiki
4850 """
49- @ spec sync_github_content ( Community . t ( ) , atom ) :: { :ok , CommunityWiki . t ( ) }
51+ @ spec sync_github_content ( Community . t ( ) , atom ( ) , any ( ) ) :: { :ok , CommunityWiki . t ( ) }
5052 def sync_github_content ( % Community { id: id } , :wiki , attrs ) do
5153 with { :ok , community } <- ORM . find ( Community , id ) do
5254 attrs = Map . merge ( attrs , % { community_id: community . id } )
@@ -58,7 +60,7 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
5860 @ doc """
5961 sync cheatsheet
6062 """
61- @ spec sync_github_content ( Community . t ( ) , atom ( ) ) :: { :ok , CommunityCheatsheet . t ( ) }
63+ @ spec sync_github_content ( Community . t ( ) , atom ( ) , any ( ) ) :: { :ok , CommunityCheatsheet . t ( ) }
6264 def sync_github_content ( % Community { id: id } , :cheatsheet , attrs ) do
6365 with { :ok , community } <- ORM . find ( Community , id ) do
6466 attrs = Map . merge ( attrs , % { community_id: community . id } )
@@ -70,17 +72,17 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
7072 @ doc """
7173 add contributor to exsit wiki contributors list
7274 """
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 ( )
7577 def add_contributor ( % CommunityWiki { id: id } , contributor_attrs ) do
7678 do_add_contributor ( CommunityWiki , id , contributor_attrs )
7779 end
7880
7981 @ doc """
8082 add contributor to exsit cheatsheet contributors list
8183 """
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 ( )
8486 def add_contributor ( % CommunityCheatsheet { id: id } , contributor_attrs ) do
8587 do_add_contributor ( CommunityCheatsheet , id , contributor_attrs )
8688 end
0 commit comments