- Endpoint:
/api/entrysystem/health_check/ - Method:
GET - Permission: None
- Description: Verifies if the API service is running.
- Response:
- Success:
{ "message": "API is running" }
- Success:
- Endpoint:
/api/entrysystem/register/ - Method:
POST - Description: Allows a new user to register by providing email and Firebase UID.
- Request Body:
{ "email": "student@example.com", "firebaseUID": "uniqueFirebaseUID123", "profileDetails": { "name": "John Doe", "college": "ABC University", "phoneNumber": "1234567890", "imageURL": "http://example.com/image.jpg", "collegeID": "COL12345", "collegeIdUrl": "http://example.com/college-id.jpg" }, "paymentStatus": true } - Response:
- Success:
{ "message": "User created successfully", "_id": "USER_MONGO_ID" } - Error:
{ "error": "User already exists" } - Validation Error:
{ "email": ["This field is required."] }
- Success:
- Endpoint:
/api/entrysystem/login/ - Method:
POST - Description: Authenticates the user by verifying email and Firebase UID, and returns JWT tokens.
- Request Body:
{ "email": "user@example.com", "firebaseUID": "UID1234567890" } - Response:
- Success:
{ "refresh": "REFRESH_TOKEN", "access": "ACCESS_TOKEN", "message": "Login successful" } - Error:
{ "error": "Invalid credentials" } - Validation Error:
{ "error": "Email and Firebase UID are required" }
- Success:
- Endpoint:
/api/entrysystem/payments/ - Method:
POST - Permission:
IsAuthenticated - Description: Handles payment processing and updates the user's payment status.
- Request Body:
{ "status": "Completed", "amount": 100 } - Response:
- Success:
{ "message": "Payment successfully processed" } - Error:
{ "error": "User not found" } - Payment Status Error:
{ "error": "Invalid payment status" }
- Success:
- Endpoint:
/api/entrysystem/check_jwt/ - Method:
GET - Permission:
IsAuthenticated - Description: Returns the user details based on the authenticated JWT token.
- Response:
{ "user_id": "USER_MONGO_ID", "email": "user@example.com", "name": "User Name" }
- Endpoint:
/api/entrysystem/profile/ - Method:
GET - Permission:
IsAuthenticated - Description: Fetches the full profile details of the logged-in user.
- Response:
{ "_id": "USER_MONGO_ID", "email": "user@example.com", "firebaseUID": "UID1234567890", "profileDetails": { "name": "User Name", "college": "Some College", "phoneNumber": "+91 9876543210", "imageURL": "https://example.com/profile.jpg" }, "paymentStatus": true, "created_at": "2024-10-12T14:53:03.917Z", "updated_at": "2024-10-12T14:53:03.917Z" } - Error:
{ "error": "User not found" }
- Endpoint:
/api/entrysystem/profile_checker/ - Method:
GET - Permission:
IsAuthenticated - Description: Checks whether the user's profile is complete by verifying essential fields (email, name, phone number, and image URL).
- Response:
- Complete Profile:
{ "success": true } - Incomplete Profile:
{ "success": false, "missing_fields": [ "profileDetails.phoneNumber", "profileDetails.imageURL" ] } - Error:
{ "success": false, "error": "User not found" }
- Complete Profile:
- Endpoint:
/api/entrysystem/health_check/ - Method:
GET - Permission: None
- Description: Checks the health of the API.
- Response:
- Complete Profile:
{ "message": "API is running" }
- Complete Profile:
-
Endpoint:
/api/entrysystem/validate_qr/ -
Method:
POST -
Description: Validates a QR code for entry or exit, and checks the current entry status of the user associated with the QR code.
-
Request Body:
{ "qr_code": "670a1b65847c0d3f9c57b70c", "mode": "entry" // or "exit" } -
Response Examples:
-
Successful Entry Approval:
{ "success": true, "message": "Entry approved", "data": { "name": "Ankita Sharma", "vip": true } } -
Successful Exit Approval:
{ "success": true, "message": "Exit approved", "data": { "name": "Ankita Sharma", "vip": true } } -
Duplicate Entry (if user is already inside):
{ "success": false, "message": "Duplicate entry detected" } -
Duplicate Exit (if user is already outside):
{ "success": false, "message": "Duplicate exit detected" } -
Invalid QR Code:
{ "success": false, "message": "QR code not found" } -
Invalid Mode:
{ "success": false, "message": "Invalid mode" } -
Missing
qr_codeormodein Request:{ "success": false, "message": "qr_code and mode are required" } -
User Not Found:
{ "success": false, "message": "User not found" } -
Entry/Exit Data Not Found:
{ "success": false, "message": "Entry/Exit data not found" } -
Internal Server Error:
{ "success": false, "message": "An error occurred while processing the request" }
-
Endpoint:
/api/entrysystem/analytics/ -
Method:
GET -
Permission: Admin
-
Description: Provides analytics data for the entry system, including the total number of users, counts of users inside campus and concert hall, and the breakdown by roles (students, VIPs, faculty), including paid students.
-
Response:
-
Successful Response:
{ "success": true, "message": "Analytics data fetched successfully", "data": { "total_users": 1000, "inside_campus": 500, "inside_concert_hall": 200, "students_count": 700, "vips_count": 50, "faculty_count": 150, "paid_students_count": 600, "students_inside_concert_hall": 150, "vips_inside_concert_hall": 30, "faculty_inside_concert_hall": 20 } } -
Error Response:
{ "success": false, "message": "Error message here" }
-
- Endpoint:
/api/entrysystem/validate_dynamic_qr/ - Method:
POST - Permission: None
- Description: Validates a dynamic QR code for entry or exit with a number of people.
- Request:
- Body:
{ "qr_code": "dynamic-qr-code-object-id", "mode": "entry", "number": 5 }
- Body:
- Response:
- Entry Approved:
{ "success": true, "message": "Entry approved", "data": { "entered_ppl": 1, "vip": true } } - Duplicate Entry:
{ "success": false, "message": "Duplicate entry detected" }
- Entry Approved: