Closed y2468101216 closed 3 years ago
@nickyanggg CreateArticle 我看起來回傳資訊有誤,不知你是否能確認一下 主要是時間跟發文者不對
測試時會回傳空指標也不太對
Merging #251 (f9621f0) into development (bb21259) will decrease coverage by
1.00%
. The diff coverage is14.54%
.
@@ Coverage Diff @@
## development #251 +/- ##
===============================================
- Coverage 45.49% 44.49% -1.01%
===============================================
Files 29 29
Lines 1622 1661 +39
===============================================
+ Hits 738 739 +1
- Misses 782 819 +37
- Partials 102 103 +1
Impacted Files | Coverage Δ | |
---|---|---|
internal/delivery/http/errors.go | 23.40% <0.00%> (-6.33%) |
:arrow_down: |
internal/repository/article.go | 0.00% <0.00%> (ø) |
|
internal/repository/repository.go | 0.00% <ø> (ø) |
|
internal/usecase/article.go | 26.82% <0.00%> (-0.68%) |
:arrow_down: |
internal/usecase/usecase.go | 100.00% <ø> (ø) |
|
internal/delivery/http/route_create_article.go | 48.38% <40.00%> (-7.39%) |
:arrow_down: |
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 bb21259...f9621f0. Read the comment docs.
@nickyanggg CreateArticle 我看起來回傳資訊有誤,不知你是否能確認一下 主要是時間跟發文者不對
測試時會回傳空指標也不太對
我還沒實際下去測試,但我看了一下我猜可能是因為 usecase/article.go 中的 CreateArticle
目前是先呼叫usecase.repo.GetBoardArticleRecords
,並直接回傳第 0 筆,那這可能是回傳結果錯誤的原因 (包括時間、發文者不對 or 空指標)。因為 GetBoardArticleRecords
目前應該並沒有保證說後面建立的 ArticleRecord 會出現在最前面?可能要稍微比對一下再抓出來結果才會是對的。
我大概有個想法知道怎改了,不過要等我有空
raw 裡面的內容好像還是不太對? 應該要是 123123
才對?
raw 目前沒有定義是啥,目前是做成 reqeust body encode
他有定義,他應該要是這篇文章寫入後讀取回來的東西 基本上目前的 response 就是這篇文章讀回來的東西
那要改成怎樣的?
他目前有實際寫入硬碟嗎?
因為 go-bbs 發文相關的 function 有更動,所以 go-bbs 升級後這個 pr 可能需要更動一下,抱歉造成困擾
@y2468101216 發文相關的 function 我這邊又改了一堆,目前的寫法可以參照 bbstool
裡面的寫法,這部分是我驗證過確定可以正常動的
https://github.com/Ptt-official-app/go-bbs/blob/development/cmd/bbstool/articles.go#L36
然後讀取文章的作法在裡面也有,現在比較頭痛的部分是我希望轉回和讀取 big5 的時機點可以再更底層,但是當初設計不良,轉換成 UTF-8 時就會被轉成 string 而不是 []byte ,所以這點可能要再稍加注意.
我需要一點時間修正,我看了一下應該是要把 repository 裡的 CreateArticle 重寫對吧
可以順便講一下目前的狀況以及你預計重寫的方式和範圍嗎?
repository CreateArticle 要改 這部分被 mark 然後應該不需要藉由時間跟作者還有標題判斷是不是最新文章(go-bbs 會回傳了),預計這段也會拔掉
大概就這樣,剩下的我覺得不需要動
至於詳細要等我開寫後才知道,因為這次改的有點多
目前我卡在
2021/08/03 17:22:33 path: ./home/bbs/boards/t/test/M.1627982553.A.221 2021/08/03 17:22:33 bbs: write board article file error: invalid argument WriteBoardArticleFile error: %w invalid argument
不知道是哪邊有問題
目前我卡在
2021/08/03 17:22:33 path: ./home/bbs/boards/t/test/M.1627982553.A.221 2021/08/03 17:22:33 bbs: write board article file error: invalid argument WriteBoardArticleFile error: %w invalid argument
不知道是哪邊有問題
感覺是某一行出現了 fmt.Println("err: %w", err)
這樣的錯誤?
那具體而言可能要找一下是觸發了什麼錯誤
目前我卡在 2021/08/03 17:22:33 path: ./home/bbs/boards/t/test/M.1627982553.A.221 2021/08/03 17:22:33 bbs: write board article file error: invalid argument WriteBoardArticleFile error: %w invalid argument 不知道是哪邊有問題
看了一下,猜測可能是因為 bbs 忘了寫 close file(參考這篇),可能要另外開 issue 改一下 沒有實際下去測試所以不太確定這樣是否能夠解決
我看了一下也覺得應該是這個原因
發文的時候需要把PTT發文時的預設template 加上去嗎,像是標題等等的?
發文的時候需要把PTT發文時的預設template 加上去嗎,像是標題等等的?
讓 app 去加吧,我們這邊純粹接啥寫啥
這個可能要PTT-backend這邊做,因為原本的手機APP也不能在發文時自訂擋頭和發信IP等等的
那可能要詳細定義需要增加哪些 template,api 參數也要增加,我覺得還是 app 自己做掉比較好就是了。 因為像選標題類型這種也是在 app 選好後送出,app 可以先組好再送給後端就好。
ip 就 直接附在內文最後這樣?
增加 template 的問題我覺得可以放在之後再來做,先將現有的 issue 修完這樣會比較好
LGTM
👏 解決掉的 issue / Resolved Issues
⛏ 變更內容 / Details of Changes
增加錯誤訊息回傳 增加已有的資料回傳