2024-01-08 18:15:49 +00:00
|
|
|
### Flask-API managing Users And Events
|
|
|
|
|
|
|
|
A RESTful API that manages events, offering users the ability to schedule, retrieve,
|
|
|
|
update, delete, and be reminded of events with additional advanced features.
|
|
|
|
|
|
|
|
# Flask-API - Interface
|
|
|
|
- The User Will be able to retrieve upcomming event/s
|
|
|
|
- sort by
|
|
|
|
- popularity
|
|
|
|
- date
|
|
|
|
- filter by:
|
|
|
|
- location
|
|
|
|
- The User will be abale to create/update a new event
|
|
|
|
- The User will be able to login/out
|
|
|
|
- The Anonymous User will be able to create a new user
|
|
|
|
|
|
|
|
- Event:
|
|
|
|
- (Auth Users) An event is an upcomming Party/Concert/Sport event/etc. It is tied to a user that created this event.
|
|
|
|
|
|
|
|
- Authentication:
|
|
|
|
- The User will be able to login:
|
|
|
|
- The API will generate a JWT token and set the userId inside the Flask session.
|
|
|
|
- The API will return the JWT token in the response cookie header.
|
|
|
|
|
|
|
|
# Backend-reminder
|
|
|
|
- The Users will be able to be reminded of upcoming events.
|
2024-01-09 09:17:01 +00:00
|
|
|
- The backend will Send reminders 30 minutes before the event's scheduled time based on there location and the event location.
|
2024-01-08 18:15:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
- Sqlite(for simplicity use)
|
|
|
|
# Schema
|
|
|
|
- User -
|
|
|
|
- Id (UUID, primary key)
|
|
|
|
- Name (string, required)
|
|
|
|
- Email (string, required, unique)
|
|
|
|
- Password_hash (string, required)
|
|
|
|
- location (string, required)
|
|
|
|
- Event
|
|
|
|
- Id (int, primary key)
|
|
|
|
- Title (string, required)
|
|
|
|
- Description (string, required)
|
|
|
|
- Location (string, required)
|
|
|
|
- Deleted (bool, required)
|
|
|
|
- DueDate (string, required)
|
|
|
|
- User_id (string, required, foreign key)
|
|
|
|
|
2024-01-09 09:17:01 +00:00
|
|
|
- User Event Association (Many to Many) - this table will hold the notifyed users to the event
|
|
|
|
- User_id (string, required, foreign key, primary key)
|
|
|
|
- Event_id (Integer, required, foreign key, primary key)
|
2024-01-08 18:15:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
# API EndPoints
|
|
|
|
- GET /events (Optional: ?['location' = String, 'sort_by' = Enum('date'/'popularity'/'creation' ) ])
|
|
|
|
- GET /events/{id} - returns a single event
|
|
|
|
- POST /events - create a new event (Auth)
|
|
|
|
- PUT /events/{id} - update an event (Auth + authorized)
|
|
|
|
- DELETE /events/{id} - (Soft)delete an event (Auth + authorized)
|
|
|
|
|
2024-01-09 09:17:01 +00:00
|
|
|
- GET /user - returns all users
|
|
|
|
- GET /user/{id} - returns a single user
|
2024-01-09 09:22:53 +00:00
|
|
|
- POST /user - create a new user
|
2024-01-09 09:17:01 +00:00
|
|
|
- PUT /user/{id} - update an user (Auth + authorized)
|
|
|
|
- DELETE /user/{id} - (Soft)delete an user (Auth + authorized)
|
|
|
|
|
|
|
|
|
2024-01-08 18:15:49 +00:00
|
|
|
|
2024-01-09 09:17:01 +00:00
|
|
|
# Application init flow
|
|
|
|
- init schaduler
|
|
|
|
- run the flask app
|
2024-01-08 18:15:49 +00:00
|
|
|
|
2024-01-04 12:21:37 +00:00
|
|
|
|
2024-01-09 09:06:43 +00:00
|
|
|
# how to run?
|
|
|
|
- pip install -r requirements.txt
|
|
|
|
- flask db upgrade
|
|
|
|
- flask run
|
|
|
|
|
2024-01-04 12:21:37 +00:00
|
|
|
|