Skip to content
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/#168 儲存草稿 - usecase #192

Conversation

nickyanggg
Copy link
Collaborator

👏 解決掉的 issue / Resolved Issues

⛏ 變更內容 / Details of Changes

  • 在 usecase/user.go 中新增 GetUserDrafts 、UpdateUserDraft、DeleteUserDraft、isValidDraftID(目前合法的 draftID 為 0~9)
  • 在 usecase/user_test.go 中新增 TestGetUserDrafts、TestUpdateUserDrafts

@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2021

Codecov Report

Merging #192 (f5beeff) into development (c85f848) will increase coverage by 3.60%.
The diff coverage is 58.33%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #192      +/-   ##
===============================================
+ Coverage        41.95%   45.55%   +3.60%     
===============================================
  Files               24       25       +1     
  Lines             1237     1306      +69     
===============================================
+ Hits               519      595      +76     
+ Misses             637      624      -13     
- Partials            81       87       +6     
Impacted Files Coverage Δ
internal/repository/repository.go 0.00% <ø> (ø)
internal/repository/user.go 1.85% <0.00%> (-0.11%) ⬇️
internal/usecase/user.go 38.79% <77.77%> (+30.38%) ⬆️
internal/usecase/article.go 45.00% <0.00%> (-2.37%) ⬇️
internal/usecase/token.go 0.00% <0.00%> (ø)
internal/usecase/usecase.go 100.00% <0.00%> (ø)
internal/repository/article.go 0.00% <0.00%> (ø)
internal/delivery/http/route_create_article.go 68.18% <0.00%> (ø)
internal/delivery/http/route.go 66.39% <0.00%> (+2.22%) ⬆️
internal/usecase/board.go 23.71% <0.00%> (+4.61%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c85f848...f5beeff. Read the comment docs.

t.Errorf("returned unexpected value: got %v want value %v",
actualValue, expectedValue)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeleteUserDraft 應該還是可以寫個test
測 return nil and error 兩個case

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

了解,之後放假會另外補上

// TODO: https://github.com/Ptt-official-app/Ptt-backend/issues/168
return []byte{}, nil
if !isValidDraftID([]byte(draftID)) {
return []byte{}, fmt.Errorf("invalid draft ID: %s", draftID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要確認一下,有error的時候慣例上會回傳 nil 還是 []byte{} ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那就先統一改成回傳nil?

@nickyanggg
Copy link
Collaborator Author

再麻煩幫忙 review,感謝

@y2468101216
Copy link
Collaborator

LGTM

Copy link
Member

@PichuChen PichuChen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PichuChen PichuChen merged commit f1d627c into Ptt-official-app:development May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[主線] [PTT] 實作儲存草稿 - usecase
5 participants