Click on "start reading" now removes "want to read"
This commit is contained in:
@@ -137,19 +137,20 @@ func TestPutStartReadUserBooks_WrongDateFormat(t *testing.T) {
|
||||
`{
|
||||
"startDate": "19/11/2025"
|
||||
}`
|
||||
bookId := "6"
|
||||
bookId := "7"
|
||||
testPutUserBooks(t, payload, bookId, http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
func TestPutStartReadUserBooks_NewReadOk(t *testing.T) {
|
||||
func TestPutStartReadUserBooks_UnsetWantReadOk(t *testing.T) {
|
||||
payload :=
|
||||
`{
|
||||
"startDate": "2025-11-19"
|
||||
}`
|
||||
bookId := "6"
|
||||
bookId := "7"
|
||||
testPutUserBooks(t, payload, bookId, http.StatusOK)
|
||||
book := testGetBook(t, bookId, http.StatusOK)
|
||||
assert.Equal(t, "2025-11-19", book.StartReadDate)
|
||||
assert.Equal(t, false, book.WantRead)
|
||||
}
|
||||
|
||||
func TestPutStartReadUserBooks_Unset(t *testing.T) {
|
||||
@@ -157,7 +158,7 @@ func TestPutStartReadUserBooks_Unset(t *testing.T) {
|
||||
`{
|
||||
"startDate": "null"
|
||||
}`
|
||||
bookId := "6"
|
||||
bookId := "7"
|
||||
testPutUserBooks(t, payload, bookId, http.StatusOK)
|
||||
book := testGetBook(t, bookId, http.StatusOK)
|
||||
assert.Equal(t, "", book.StartReadDate)
|
||||
|
||||
@@ -62,6 +62,9 @@ func PutUserBookHandler(ac appcontext.AppContext) {
|
||||
myvalidator.ReturnErrorsAsJsonResponse(&ac, err)
|
||||
return
|
||||
}
|
||||
if d != nil {
|
||||
userbook.WantRead = false
|
||||
}
|
||||
userbook.StartReadDate = d
|
||||
}
|
||||
if userBookPut.Rating != nil {
|
||||
|
||||
Reference in New Issue
Block a user