-
Notifications
You must be signed in to change notification settings - Fork 1
Understanding Attendizer
thegu5 edited this page Nov 1, 2023
·
8 revisions
Example of the overall structure:
sequenceDiagram
Frontend->>+Backend: POST /api/getStudents
Backend->>+Vercel Postgres: prisma.students.findMany()
Vercel Postgres->>-Backend: [id: 18, osis:..]
Backend->>-Frontend: [id: 18, osis:..]
admin.js
This is the admin panel. There is a table, with each row being a StudentEntry that contains the student's ID (database key), Name (full name), OSIS (9-digit student ID number), and UID (13-digit number on ID card).
The "Edit" and "Delete" buttons allow you to edit a student's information (name, OSIS, UID), or delete the student entirely.
To add a student, press the "Add Student" button below the table. To export the student info, press the "Export as XLSX" button.
index.js
This is the home page for the application. There's a small text box that takes in either a student's OSIS or UID, and a larger box above that logs recent scan-ins. If invalid information is given, an error will display.
meetings.js
This is the meetings page for controlling meetings. There is a table, with each row being a MeetingEntry that contains the ID (meeting key, student key), Date (date of the meeting), and Name (full name of the student).
The "Delete Meeting" deletes the entire meeting, which affects all scan-ins for that particular meeting. To export the meeting info, press the "Export as XLSX" button.
/pages/api contains the serverless functions that the frontend uses to modify the database. Each file is a different route. These are separated from the frontend when the project is deployed to Vercel. Here's an example of a request:
POST /api/getStudents HTTP/1.1
Host: attendizer.stuypulse.com
{
"key": "thekey"
}
Since the key to access endpoints is in the request body, the request must be a POST. Some endpoints, such as editStudent, require other properties such as osis and uid.
TODO: explain each file in detail