better README.md
This commit is contained in:
parent
0c7f0f4ca4
commit
2a092e1eb2
1 changed files with 47 additions and 57 deletions
104
README.md
104
README.md
|
@ -1,43 +1,45 @@
|
|||
### Flask-API managing Users And Events
|
||||
# Flask-API for 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.
|
||||
This Flask-based RESTful API provides functionality for managing and interacting with events. It offers users the capability to schedule, retrieve, update, and delete events. Additionally, it features user authentication and event reminders.
|
||||
|
||||
# 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
|
||||
## Flask-API - Interface
|
||||
The API allows interaction through the following features:
|
||||
|
||||
- Event:
|
||||
- (Auth Users) An event is an upcomming Party/Concert/Sport event/etc. It is tied to a user that created this event.
|
||||
- **Retrieval of Upcoming Events:**
|
||||
- Sort by:
|
||||
- Popularity
|
||||
- Date
|
||||
- Filter by:
|
||||
- Location
|
||||
|
||||
- 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.
|
||||
- **Event Management:**
|
||||
- Users can create and update events.
|
||||
|
||||
# Backend-reminder
|
||||
- The Users will be able to be reminded of upcoming events.
|
||||
- The backend will Send reminders 30 minutes before the event's scheduled time based on there location and the event location.
|
||||
- **User Authentication:**
|
||||
- Users can log in and out.
|
||||
- Anonymous users can register.
|
||||
|
||||
- **Event Details:**
|
||||
- Events include parties, concerts, sports events, etc., and are linked to the user who created them.
|
||||
|
||||
- **Authentication Mechanism:**
|
||||
- Logging in generates a JWT token stored in the Flask session.
|
||||
- The JWT token is returned in the response cookie header.
|
||||
|
||||
# Database
|
||||
- Sqlite(for simplicity use)
|
||||
# Schema
|
||||
- User -
|
||||
## Backend Reminder System
|
||||
- Users receive reminders for upcoming events.
|
||||
- The backend sends reminders 30 minutes prior to the event, considering user and event locations.
|
||||
|
||||
## Database Configuration
|
||||
- **Database Used:** SQLite (for simplicity)
|
||||
- **Schema:**
|
||||
- `User`:
|
||||
- Id (UUID, primary key)
|
||||
- Name (string, required)
|
||||
- Email (string, required, unique)
|
||||
- Password_hash (string, required)
|
||||
- location (string, required)
|
||||
- Event
|
||||
- Location (string, required)
|
||||
- `Event`:
|
||||
- Id (int, primary key)
|
||||
- Title (string, required)
|
||||
- Description (string, required)
|
||||
|
@ -45,35 +47,23 @@ update, delete, and be reminded of events with additional advanced features.
|
|||
- Deleted (bool, required)
|
||||
- DueDate (string, required)
|
||||
- User_id (string, required, foreign key)
|
||||
- `User Event Association` (Many-to-Many):
|
||||
- User_id (string, foreign key, primary key)
|
||||
- Event_id (int, foreign key, primary key)
|
||||
|
||||
- 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)
|
||||
|
||||
|
||||
# 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)
|
||||
|
||||
- GET /user - returns all users
|
||||
- GET /user/{id} - returns a single user
|
||||
- POST /user - create a new user
|
||||
- PUT /user/{id} - update an user (Auth + authorized)
|
||||
- DELETE /user/{id} - (Soft)delete an user (Auth + authorized)
|
||||
|
||||
|
||||
|
||||
# Application init flow
|
||||
- init schaduler
|
||||
- run the flask app
|
||||
|
||||
|
||||
# how to run?
|
||||
- pip install -r requirements.txt
|
||||
- flask db upgrade
|
||||
- flask run
|
||||
## API Endpoints
|
||||
- `GET /events` (Optional: `location`, `sort_by` (date/popularity/creation))
|
||||
- `GET /events/{id}` - Retrieve a single event
|
||||
- `POST /events` - Create a new event (Auth required)
|
||||
- `PUT /events/{id}` - Update an event (Auth + authorization required)
|
||||
- `DELETE /events/{id}` - Soft delete an event (Auth + authorization required)
|
||||
- User management endpoints (`/user`), including creation, retrieval, update, and deletion (with appropriate authentication and authorization).
|
||||
|
||||
## Application Initialization Flow
|
||||
- Initialize scheduler.
|
||||
- Run the Flask application.
|
||||
|
||||
## How to Run?
|
||||
1. Install dependencies: `pip install -r requirements.txt`
|
||||
2. Upgrade the database: `flask db upgrade`
|
||||
3. Start the Flask application: `flask run`
|
||||
|
|
Loading…
Reference in a new issue