add organizer role and features
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 29s

This commit is contained in:
2026-02-28 01:50:20 -05:00
parent e97bf95ca8
commit 83e552bd07
8 changed files with 173 additions and 40 deletions

View File

@@ -4,9 +4,10 @@ A digital alternate reality game — find and scan hidden QR codes in real life
## How It Works
1. **Organizers** create a "hunt" and generate printable QR code cards
2. **Players** scan hidden QR codes to earn points — first find gets the most points
3. **Leaderboards** track top players per hunt and globally
1. **Admins** create hunts, manage all content, assign roles, and reset passwords
2. **Organizers** create and manage their own hunts with printable QR code cards
3. **Players** scan hidden QR codes to earn points — first find gets the most points
4. **Leaderboards** track top players per hunt and globally
### Point System
@@ -19,10 +20,34 @@ A digital alternate reality game — find and scan hidden QR codes in real life
Players earn points only once per package. Re-scanning lets you update the package hint.
### Roles
| Capability | Admin | Organizer | Player |
|---|---|---|---|
| Create hunts | Yes | Yes | No |
| Manage/edit/delete own hunts | Yes | Yes | No |
| Manage other users' hunts | Yes | No | No |
| Download QR code PDFs | Yes | Own hunts | No |
| Password reset | Yes | No | No |
| Delete any image / clear hints | Yes | No | No |
| Assign organizer role | Yes | No | No |
### Features
- **QR Code Cards** — Printable Avery 5371 format PDFs with double-sided backs
- **First Finder Photos** — First scanner can upload/replace an image per package
- **Hints** — Most recent scanner can leave a message for the next finder
- **Player Profiles** — Stats, rank, hunt breakdown, and recent activity
- **Dark Mode** — Toggle with system preference detection and localStorage persistence
- **Relative Timestamps** — "3h ago" format with full date on hover
- **Flash Messages** — Feedback on actions (create, edit, delete, upload, etc.)
- **Paginated Leaderboards** — 25 per page with navigation controls
- **Admin Dashboard** — Hunt stats, top finders, discovery rate, recent scans, role management
## Tech Stack
- **Node.js** + Express
- **SQLite** via better-sqlite3
- **SQLite** via sql.js (WASM)
- **EJS** templates
- **PDFKit** + qrcode for printable QR sheets
- **Docker** deployment via Portainer
@@ -75,17 +100,22 @@ src/
├── app.js # Express application entry point
├── setup-admin.js # CLI tool to create/promote admin users
├── config/
│ └── database.js # SQLite initialization & schema
│ └── database.js # SQLite (sql.js) initialization, schema & migrations
├── middleware/
│ └── auth.js # Auth & admin middleware
│ └── auth.js # Auth, admin & organizer middleware
├── models/
│ └── index.js # All database operations
├── routes/
│ ├── auth.js # Login/register/logout
│ ├── admin.js # Hunt management & PDF download
│ ├── auth.js # Login/register/logout/password reset
│ ├── admin.js # Hunt management, PDF download, roles, password reset
│ ├── loot.js # QR scan handling, image upload, hints
│ └── hunts.js # Public hunt profiles & leaderboards
│ └── hunts.js # Public hunt profiles, leaderboards, player profiles
├── utils/
│ └── pdf.js # QR code PDF generation
│ └── pdf.js # Avery 5371 QR code PDF generation
└── views/ # EJS templates
public/
├── css/
│ └── style.css # Styles with dark mode support
└── js/
└── timeago.js # Relative timestamp formatting
```