Start reading cancel read: move logic to backend

This commit is contained in:
2026-03-26 20:17:21 +01:00
parent 9c18206483
commit bc077f176e
4 changed files with 15 additions and 8 deletions

View File

@@ -153,6 +153,18 @@ func TestPutStartReadUserBooks_UnsetWantReadOk(t *testing.T) {
assert.Equal(t, false, book.WantRead)
}
func TestPutStartReadUserBooks_UnsetReadOk(t *testing.T) {
payload :=
`{
"startDate": "2025-12-20"
}`
bookId := "13"
testPutUserBooks(t, payload, bookId, http.StatusOK)
book := testGetBook(t, bookId, http.StatusOK)
assert.Equal(t, "2025-12-20", book.StartReadDate)
assert.Equal(t, false, book.Read)
}
func TestPutStartReadUserBooks_Unset(t *testing.T) {
payload :=
`{

View File

@@ -63,6 +63,7 @@ func PutUserBookHandler(ac appcontext.AppContext) {
return
}
if d != nil {
userbook.Read = false
userbook.WantRead = false
}
userbook.StartReadDate = d