Skip to content
A realtime online sign-in system
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
_correction-modal.scss
_member-details.scss
firebase-structure.json
index.html
main.js
style.scss

README.md

Sign-in

A real-time online sign-in system integrated into Discord with Firebase.

Structure of Firebase JSON

Example: firebase-structure.json.

The database is organized into three categories, corrections, log, and members:

  • corrections contains messages that members send to the database organizer to manually change something in the database.
  • log contains the meetings and subtract for each member
  • members contains data about each member

Screenshot when signing in

Screenshot when signing out

Firebase rules

Ensures that:

  • corrections/$membername has valid datetime keys (YY-MM-DD HH:mm)
  • log/$membername/meetings/$date has a valid date (YY-MM-DD) and valid start and end times (HH:mm:ss)
  • members/$membername has a Boolean board, a Boolean present, and a String discordId as children
  • All $membername in corrections or log are also in members
{
  "rules": {
    ".read": true,
    "corrections": {
      "$membername": {
        ".write": "root.child('members').hasChild($membername)",
        "$datetime": {
          ".validate": "$datetime.matches(/^\\d{2}\\-(0[1-9]|1[012])\\-(0[1-9]|[12][0-9]|3[01]) (2[0-3]|[0|1]\\d):[0-5]\\d$/)"
        }
      }
    },
    "log": {
      "$membername": {
        ".write": "root.child('members').hasChild($membername)",
        "meetings": {
          "$day": {
            ".validate": "$day.matches(/^\\d{2}\\-(0[1-9]|1[012])\\-(0[1-9]|[12][0-9]|3[01])$/)",
            "$endstart": {
              ".validate": "$endstart.matches(/^(start|end)(0|[1-9]\\d*)$/) && newData.isString() && newData.val().matches(/^(2[0-3]|[0|1]\\d):[0-5]\\d:[0-5]\\d$/)"
            }
          }
        }
      }
    },
    "members": {
      ".write": true,
      "$membername": {
        ".validate": "newData.hasChildren(['board', 'discordId', 'present'])",
        "board": {
          ".validate": "newData.isBoolean()"
        },
        "discordId": {
          ".validate": "newData.isString()"
        },
        "present": {
          ".validate": "newData.isBoolean()"
        }
      }
    }
  }
}
You can’t perform that action at this time.