Skip to content

Instantly share code, notes, and snippets.

@Meng-V
Last active April 1, 2025 20:20
Show Gist options
  • Save Meng-V/60156366b873c8488e01ce810dab18bd to your computer and use it in GitHub Desktop.
Save Meng-V/60156366b873c8488e01ce810dab18bd to your computer and use it in GitHub Desktop.

This is for "today" usage only.

Eveyday @7AM, a CRON job will retrieve past day events from DB. Make sure these events' dates are for today only.

flowchart TD
    A([Start]) --> B[Email Server: Received a new email from reserve\@something.miamioh.edu]
    B --> C[Nodejs: fs. Read log and extract email for BookingID]
    C --> |input BookingID| D[LibCalAPI: GET. NetID, Confirm or Cancel, Date&Time, Location&Room, Stud2&Stud3]
    D --> E[Node: Split into individual records with full details. _Even for Stud2&Stud3_]
    E --> F{Confirm or Cancel?}
    F -->|Cancel| G[DB: DELETE. _Mind Date and Time_]
    G --> H[If today --> PatronGroup: DELETE]
    H --> Z([End])
    F -->|Confirm| I{/patrons/ endpoint: GET. Validate NetID}
    I -->|Invalid| K[LibCalAPI: DELETE. Send email notification]
    I -->|Valid| M{DB: FINDMANY. Is NetID duplicated? Y/N _Mind Date_ }
    M -->|Yes| W{Is the booking Today? Y/N}
    W --> |Yes| K
    W --> |No| O[DB: ADD. BookingID, NetID, Date, StartTime, EndTime, Location&Room]
    O --> Z
    M -->|No| J[DB: ADD. BookingID, NetID, Date, StartTime, EndTime, Location&Room]
    J --> Q{Is the booking Today? Y/N}
    Q -->|Yes| P[PatronGroup: ADD. NetID, Date, Start/End Time, Location, Room]
    Q -->|No| Z
    P --> Y[DB: DELETE. Remove today's expired reservations.]
    K --> Z
    
    Y --> Z
    
Loading
@Meng-V
Copy link
Author

Meng-V commented Mar 3, 2025

Note: in the above design, a group of students has to meet the following requirement:

  1. All students have to be valid. Otherwise reservation of the group will be cancelled.
  2. No single student could reserve study room more than once in a day prior to the first reservation end time. Even him/her (single person) is not the primary reserver. It will delete the whole group's reservation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment