OlegKlimenko / Plamber-Android

The Android application for Plamber project.
https://plamber.com.ua/
Apache License 2.0
1 stars 0 forks source link

Add behaviour for blocked books #104

Closed OlegKlimenko closed 4 years ago

OlegKlimenko commented 5 years ago

We are going to add a possibility to block the book from the admin side.

Model changes So, for now, the Book object will additionally have new field blocked_book.

New Book object example:

{
      "id": 123,
      "book_name": "gdfgdfg",
      "id_author": "dfgdfg",
      "id_category": "IT",
      "description": "dfgdfgd",
      "language": "RU",
      "photo": "/media/book_cover/book_18_OuJbZjX.png",
      "book_file": "/media/book_file/berezina_n_a_vyshaya_matematika_kl_aORmYFV.pdf",
      "who_added": "admin",
      "upload_date": "2017-08-10T11:06:55.383732",
      "private_book": false,
      "blocked_book": false,
}

Behaviour changes For now on page selected book: 1) We need to add some text or symbol with tooltip that this book is blocked. 2) The button for starting reading book must be disabled (red color) if it is blocked. 3) If somehow request for starting reading the book will be sent it will be rejected on the server side with bad request response type and status 400. Error body example: {'detail': 'This book is blocked'} 4) Please pay attention, there must two additional cases:

So to summarize, we must validate these things only at "adding book to reading list" and on "removing book from list of reading" in all other cases it must not change the behaviour.

OlegKlimenko commented 5 years ago

Add behaviour for blocked books