Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
clr-li committed Nov 18, 2023
2 parents 58e7caa + 8e7fd29 commit 0616eb6
Show file tree
Hide file tree
Showing 7 changed files with 8,224 additions and 27 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Automated Tests

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- run: npm ci
- name: Create SA key
run: echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' > gcloud.json
- name: Run tests
run: npm test
env:
TOKEN: ${{ secrets.TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: "gcloud.json"
MERCHANTID: ${{ secrets.MERCHANTID }}
MERCHANTPUBLIC: ${{ secrets.MERCHANTPUBLIC }}
MERCHANTPRIVATE: ${{ secrets.MERCHANTPRIVATE }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ node_modules
.DS_Store
.env
.firebase
package-lock.json
test.log
15 changes: 15 additions & 0 deletions Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,23 @@ function asyncRunWithChanges(sql, params=[]) {
});
}

/**
* Closes the current database connection.
* @returns a Promise of the database connection closing.
*/
async function close() {
return new Promise((resolve, reject) => {
if (!db) resolve();
db.close((err) => {
if (err) reject(err);
else resolve();
});
});
}

// ============================ MODULE EXPORTS ============================
exports.reinitializeIfNotExists = reinitializeIfNotExists;
exports.close = close;
exports.asyncGet = asyncGet;
exports.asyncAll = asyncAll;
exports.asyncRun = asyncRun;
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![](https://img.shields.io/website?url=https%3A%2F%2Fattendancescannerqr.web.app%2F
)](https://github.com/clr-li/AttendanceScanner)
<img alt="gitleaks badge" src="https://img.shields.io/badge/protected%20by-gitleaks-blue">
![Tests](https://github.com/clr-li/AttendanceScanner/actions/workflows/tests.yml/badge.svg)

This project (in progress) uses QR codes to take attendance and a SQLite database to store data of businesses, attendees, and events. It uses oauth2 through Firebase Auth to authenticate users using Google as the identity provider and has custom authorization logic. Braintree is used as the payment gateway for the electronic payment/subscription system.
URL: https://attendancescannerqr.web.app
Expand Down
Loading

0 comments on commit 0616eb6

Please sign in to comment.