Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit6f0ee76

Browse files
committed
refactor: add more spec
1 parent9e05206 commit6f0ee76

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

‎lib/groupher_server/cms/delegates/community_sync.ex‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
44
"""
55
importEcto.Query,warn:false
66
importHelper.ErrorCode
7-
importHelper.CommonTypes
87
# import ShortMaps
98

9+
aliasGroupherServer.CMS
10+
1011
aliasHelper.ORM
12+
aliasHelper.SpecType,as:T
1113

12-
aliasGroupherServer.CMS.{
14+
aliasCMS.{
1315
Community,
1416
CommunityWiki,
1517
CommunityCheatsheet
@@ -46,7 +48,7 @@ defmodule GroupherServer.CMS.Delegate.CommunitySync do
4648
@doc"""
4749
sync wiki
4850
"""
49-
@specsync_github_content(Community.t(),atom)::{:ok,CommunityWiki.t()}
51+
@specsync_github_content(Community.t(),atom(),any())::{:ok,CommunityWiki.t()}
5052
defsync_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-
@specsync_github_content(Community.t(),atom())::{:ok,CommunityCheatsheet.t()}
63+
@specsync_github_content(Community.t(),atom(),any())::{:ok,CommunityCheatsheet.t()}
6264
defsync_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-
@specadd_contributor(Community.t(),github_contributor())::
74-
{:ok,CommunityWiki}|custom_error()
75+
@specadd_contributor(Community.t(),T.github_contributor())::
76+
{:ok,CommunityWiki}|T.gq_error()
7577
defadd_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-
@specadd_contributor(Community.t(),github_contributor())::
83-
{:ok,CommunityCheatsheet}|custom_error()
84+
@specadd_contributor(Community.t(),T.github_contributor())::
85+
{:ok,CommunityCheatsheet}|T.gq_error()
8486
defadd_contributor(%CommunityCheatsheet{id:id},contributor_attrs)do
8587
do_add_contributor(CommunityCheatsheet,id,contributor_attrs)
8688
end

‎lib/helper/common_types.ex‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎lib/helper/spec_type.ex‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,17 @@ defmodule Helper.SpecType do
1414
@typedone::{:ok,map}|{:error,map}
1515

1616
@typeid::non_neg_integer()|String.t()
17+
18+
@typedoc"""
19+
general contribute type for wiki and cheatshet
20+
"""
21+
@typegithub_contributor2::%{
22+
github_id:String.t(),
23+
avatar:String.t(),
24+
html_url:String.t(),
25+
nickname:String.t(),
26+
bio:nil|String.t(),
27+
location:nil|String.t(),
28+
company:nil|String.t()
29+
}
1730
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp