Bookishy is supposed to be a platform for readers, where they can add thier books, track thier progress, and add some notes in each book they add.
Also, users can view public books, which are added for the admin user page to moderate them, when ever 2 or more users have the same book. After approval, they become public books, which authenticated users can comment on, and comment on other peoples comments.
A user is able to apply full CRUD operations on anything related to them, whether it is a book, a comment or thier accout itself.
The app will use a SQLAlchemy (sqlite as a starter db) database, with six tables.
Edit: I'll use google book api, so things are easier.
Containing these columns:
id
: Automatically generated.name
: Unique string field.email
: Unique valid email address (not necessairly working, but with a valid format).password
: Hashed then stored.
google_id
: to retrive book's data from google, and acting as an id since its unique.
id
.name
: Unique string field.
id
.content
.timestamp
.is_deleted
: to indicate the comment has been deleted..is_edited
: to indicate the comment has been edited by the user.
id
.- FK:
user.id
. - FK:
book.google_id
. status
: 0,1,2 indicating to-read, reading and read.notes
: user notes on this book.
id
.- FK:
user.id
. - FK:
category.id
.
id
.- FK:
book.google_id
. - FK:
category.id
.
id
.- FK:
comment.id
. - FK:
book.google_id
but the book in question should haveis_public
with a value of1
. - FK:
user.id
. - FK:
book_user_comment.id
, for creating nested comments, if it's null, then will be a top-tree comment.
id
.rating
: a string from 1-5.- FK:
book.google_id
but the book in question should haveis_public
with a value of1
. - FK:
user.id
.
Here are the views for the app:
/
:- Shows buttons for:
/user/login
/user/register
if the user.is_authenticated (with a session manager), else/user
/user/logout
. - Shows input fields for searching/filtering for books, or users. Results from either public books (where book.is_public).
- Shows a list of public books. Where it redirects to
/book/<string:book.google_id>
, Then a user can add a rating, or comment.- Adding a comment through the route
POST /book/<string:book.google_id>/comment
.
- Adding a comment through the route
- Shows buttons for:
/user
:- Shows profile data if the user is authenticated. Else it redirects to
/user/register
with a 401 status code. PUT /user
: edit the user profile with the same condition as 1.DELETE /user
: delete the user profile with the same condition as 1./user/login
: login for old users./user/register
: register a new user./user/book
: GET shows a list of user books, and POST adds a new book./user/book/<string:book.google_id>
: shows a book's data.DELETE /user/book/<string:book.google_id>
: delete a book.PUT /user/book/<string:book.google_id>
: edit a book.
- Shows profile data if the user is authenticated. Else it redirects to
Done using google book api
Install the packages found in requirements.txt, using pip (preferably in a virtual environment), and run theses commands:
pip install -r requirements.txt
- First time only to initialize the db:
python manage.py db init
- Then to migrate from objects to a datbase:
python manage.py db migrate
- Then to apply the migrations:
python manage.py db upgrade
- Lastly to run the app use:
python manage.py run