-
Notifications
You must be signed in to change notification settings - Fork 65
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
fix article-forward router #292
fix article-forward router #292
Conversation
* change parameter `board` to `board_id` * add permission type `PermissionForwardArticleToBoard` and `PermissionForwardArticleToEmail` * remove permission type `PermissionForwardArticle` and `PermissionForwardAddArticle` * fix test file `C6-1-7.sh` and `C6-1-8.sh` in testing-script * remove redundant test in function `usecase.ForwardArticleToBoard` * add error `NoPermissionForForwardArticleError` and `NoPermissionForForwardArticleToEmailError`
Codecov Report
@@ Coverage Diff @@
## development #292 +/- ##
===============================================
+ Coverage 44.04% 44.74% +0.70%
===============================================
Files 29 29
Lines 1712 1770 +58
===============================================
+ Hits 754 792 +38
- Misses 848 868 +20
Partials 110 110
Continue to review full report at Codecov.
|
"board_id": toBoard, | ||
err := delivery.usecase.CheckPermission(token, []usecase.Permission{usecase.PermissionForwardArticleToBoard}, map[string]string{ | ||
"board_id": boardID, | ||
"to_board": toBoard, |
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.
這邊的參數名稱感覺需要文件化
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.
這邊的話我看大家都是這麼放的
Ptt-backend/internal/delivery/http/route_append_comment.go
Lines 38 to 43 in 5067b7e
// Check permission for append comment | |
err = delivery.usecase.CheckPermission(token, []usecase.Permission{usecase.PermissionAppendComment}, map[string]string{ | |
"board_id": boardID, | |
"article_id": filename, | |
"user_id": userID, | |
}) |
Ptt-backend/internal/usecase/token.go
Lines 125 to 134 in 5067b7e
func (usecase *usecase) checkAppendCommentPermission(token string, userInfo map[string]string) error { | |
// boardID := userInfo["board_id"] | |
// userID := userInfo["user_id"] | |
// TODO: 判斷在該版是否被水桶 | |
// TODO: 判斷該版是否允許推文 | |
// TODO: 判斷該文章是否鎖文 | |
return nil | |
} |
如果需要文件化的話請問要放在哪裡呢?
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.
在 checkAppendCommentPermission
的前面
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.
有些函式的註解需要補充
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
👏 解決掉的 issue / Resolved Issues
⛏ 變更內容 / Details of Changes
board
toboard_id
(文件裡面是寫board_id
而非board
)PermissionForwardArticleToBoard
andPermissionForwardArticleToEmail
PermissionForwardArticle
andPermissionForwardAddArticle
C6-1-7.sh
andC6-1-8.sh
in testing-scriptusecase.ForwardArticleToBoard
(我看其他的函數都沒有檢查,只有這個有,所以我就統一都刪掉了)NoPermissionForForwardArticleError
andNoPermissionForForwardArticleToEmailError