-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/#152 forward article #169
Feature/#152 forward article #169
Conversation
Codecov Report
@@ Coverage Diff @@
## development #169 +/- ##
===============================================
+ Coverage 40.20% 41.40% +1.20%
===============================================
Files 22 23 +1
Lines 1000 1041 +41
===============================================
+ Hits 402 431 +29
- Misses 539 547 +8
- Partials 59 63 +4
Continue to review full report at Codecov.
|
internal/usecase/usecase.go
Outdated
@@ -54,6 +54,8 @@ type Usecase interface { | |||
// GetPopularArticles returns all popular articles | |||
GetPopularArticles(ctx context.Context) ([]repository.PopularArticleRecord, error) | |||
AppendComment(ctx context.Context, userID, boardID, filename, appendType, text string) (map[string]interface{}, error) | |||
// ForwardArticle returns forwarding results | |||
ForwardArticle(ctx context.Context, userID, boardID, filename, toEmail, toBoard string) (map[string]interface{}, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Email 和 Board 應該可以拆成兩個 method 比較好,一來是不太會同時兩個都填參數,而來是如果未來要新增新的 Forward 目標時,可以單純新增新的 method 這樣。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
沒問題,我改看看
related to #155 |
@PichuChen 已修改,目前改成用interface, @AmberFu 在實作 #155 可以參考一下,雖然好像順便做掉了QQ。 |
3d6fe99
to
f01eacc
Compare
internal/usecase/token.go
Outdated
@@ -15,6 +15,8 @@ const ( | |||
PermissionReadTreasureInformation Permission = "READ_TREASURE_INFORMATION" | |||
PermissionReadFavorite Permission = "READ_FAVORITE" | |||
PermissionAppendComment Permission = "APPEND_COMMENT" | |||
PermissionForwardArticleOut Permission = "FORWARD_ARTICLE" | |||
PermissionForwardArticleTo Permission = "FORWARD_ARTICLE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這邊兩個Key值一樣但是用了不一樣的變數名稱應該不太好?應該不用分Out和TO, 直接在註解下去說明這個權限主要是判斷可不可以轉出這樣?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry,這邊有點寫錯,應該key要不一樣的,會照你意思新增PermissionAddArticle
,我再試著修改。
internal/usecase/usecase.go
Outdated
@@ -54,6 +54,8 @@ type Usecase interface { | |||
// GetPopularArticles returns all popular articles | |||
GetPopularArticles(ctx context.Context) ([]repository.PopularArticleRecord, error) | |||
AppendComment(ctx context.Context, userID, boardID, filename, appendType, text string) (map[string]interface{}, error) | |||
// ForwardArticle returns forwarding results | |||
ForwardArticle(ctx context.Context, userID, boardID, filename string, to Forward) (map[string]interface{}, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這邊應該暫時還不需要這麼複雜...
Forward 另外拉成物件來實作的這件事應該要另外開ISSUE討論
internal/usecase/usecase.go
Outdated
@@ -54,6 +54,8 @@ type Usecase interface { | |||
// GetPopularArticles returns all popular articles | |||
GetPopularArticles(ctx context.Context) ([]repository.PopularArticleRecord, error) | |||
AppendComment(ctx context.Context, userID, boardID, filename, appendType, text string) (map[string]interface{}, error) | |||
// ForwardArticle returns forwarding results | |||
ForwardArticle(ctx context.Context, userID, boardID, filename string, to Forward) (map[string]interface{}, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ForwardArticle(ctx context.Context, userID, boardID, filename string, to Forward) (map[string]interface{}, error) | |
ForwardArticleToBoard(ctx context.Context, userID, boardID, filename string, boardName string) (map[string]interface{}, error) | |
ForwardArticleToEmail(ctx context.Context, userID, boardID, filename string, email string) (map[string]interface{}, error) |
@PichuChen 已更新 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM 應該要討論一下轉板跟轉信是否要拆開成兩個API實作 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
在Usecase中確實是分兩個,其實本來就是分兩個,只是不小心在delivery做起來了 |
👏 解決掉的 issue / Resolved Issues
⛏ 變更內容 / Details of Changes
Route
postBoards
method,針對action = "forward_article" 呼叫delivery.ForwardArticleroute_forward_article.go
實作ForwardArticle
method,呼叫usecase.ForwardArticlePermissionForwardArticle
權限ForwardArticle
method至Usecase interfaceForwardArticle
methodTest
forwardArticle
mock test methodroute_forward_article_test.go