Start reading cancel read: move logic to backend
This commit is contained in:
@@ -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 :=
|
||||
`{
|
||||
|
||||
@@ -63,6 +63,7 @@ func PutUserBookHandler(ac appcontext.AppContext) {
|
||||
return
|
||||
}
|
||||
if d != nil {
|
||||
userbook.Read = false
|
||||
userbook.WantRead = false
|
||||
}
|
||||
userbook.StartReadDate = d
|
||||
|
||||
Reference in New Issue
Block a user