Users will be able to register, login, out, to attend to events, and to unattend to events.
Events CRUD
API Flask-python3
middlewares | ||
migrations | ||
routes | ||
services | ||
.gitignore | ||
app.py | ||
config.py | ||
models.py | ||
README.md | ||
requirements.txt |
Flask-API for Managing Users and Events
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 API allows interaction through the following features:
-
Retrieval of Upcoming Events:
- Sort by:
- Popularity
- Date
- Filter by:
- Location
- Sort by:
-
Event Management:
- Users can create and update events.
-
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.
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
:- 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)
User Event Association
(Many-to-Many):- User_id (string, foreign key, primary key)
- Event_id (int, foreign key, primary key)
API Endpoints
GET /events
(Optional:location
,sort_by
(date/popularity/creation))GET /events/{id}
- Retrieve a single eventPOST /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?
- Install dependencies:
pip install -r requirements.txt
- Upgrade the database:
flask db upgrade
- Start the Flask application:
flask run