Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ The same words are used in the code, the database and the screens.
| Word | Meaning |
| --------------- | ------------------------------------------------------------------------------------------ |
| **User** | Anyone who signed in with a FreeIPA account |
| **Role** | What a user may do, derived from their FreeIPA groups: `member` or `admin` |
| **Role** | What a user may do, derived from their FreeIPA groups: `member`, `pixel` or `admin` |
| **Member** | A user in a member group (`pixels`, `members`); does tasks |
| **Pixel** | A member in the `pixels` group; may also add own tasks |
| **Admin** | A user in an admin group (`team_juhatus`); reviews proofs and manages tasks, never submits |
| **Task** | Something to do for the club, worth points, in a **category** |
| **Own task** | A task a pixel adds for work they already did, sent with its proof; a reviewer sets points |
| **Policy** | How often a task can be done: once per user, repeatable, first one wins |
| **Proof** | What a member submits to show they did a task, often with photos |
| **Reviewer** | An admin asked to review a proof, like a reviewer on a pull request |
Expand All @@ -64,6 +66,7 @@ Who can do what:
| Visitor | Read the feed, the leaderboard and user pages |
| Signed in, no group | Also like, comment, and get notified of replies |
| Member | Also browse tasks, submit proofs, and request reviewers |
| Pixel | Also add own tasks |
| Admin | Review proofs, manage tasks and categories; never submits proofs |

A proof with requested reviewers notifies them; without any, nobody is notified and it simply waits in the review queue. Groups are set in `src/config/access.ts`. Every rule lives in `src/domain/rules.ts`.
Expand Down
8 changes: 8 additions & 0 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Everyone signs in with their existing FreeIPA account. The app never creates or
| Visitor | not signed in | Reads public pages |
| Account | any other FreeIPA | Likes, comments, gets notified |
| Member | `pixels`, `members` | Does tasks and submits proofs |
| Pixel | `pixels` | A member who may add own tasks |
| Admin | `team_juhatus` | Reviews proofs and manages tasks |

Admin replaces member: someone in both groups is an admin and never submits proofs, so nobody approves their own work.
Expand All @@ -32,6 +33,7 @@ Every permission is a named rule in `src/domain/rules.ts`. Services enforce them
| `userCanReadNotifications` | Signed in |
| `userCanBrowseTasks` | Members |
| `userCanSubmitProof` | Members |
| `userCanAddOwnTask` | Pixels |
| `userCanReviewProofs` | Admins |
| `userCanManageTasks` | Admins |
| `userCanManageCategories` | Admins |
Expand Down Expand Up @@ -68,6 +70,12 @@ The check runs twice: once in the service for a quick answer, and again in the d

A proof is reviewed once; a second review of the same proof changes nothing.

### Own tasks

A pixel can add an own task for work that is not on the task list (`/tasks/new`): a title, details, category, suggested points and optional photos. This creates a task only they did (`tasks.created_by` is the pixel) with a pending proof on it, so it goes through the normal review queue, feed and points ledger. Own tasks never show in the task lists.

The reviewer may change the points when approving; the task's points are updated to match. Only own tasks accept a points override. Rejecting the proof archives the own task, so it cannot be resubmitted.

### Photos

- JPEG, PNG or WebP; size and count limits come from `NEXT_PUBLIC_PHOTO_MAX_FILE_SIZE_BYTES` and `NEXT_PUBLIC_PHOTO_MAX_PER_PROOF` (default 5 MB, 5 photos).
Expand Down
2 changes: 2 additions & 0 deletions migrations/0002_bouncy_trauma.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "proofs" ADD COLUMN "text_answer" text;--> statement-breakpoint
ALTER TABLE "tasks" ADD COLUMN "text_required" boolean DEFAULT false NOT NULL;
2 changes: 2 additions & 0 deletions migrations/0003_sloppy_omega_red.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "tasks" ADD COLUMN "created_by" uuid;--> statement-breakpoint
ALTER TABLE "tasks" ADD CONSTRAINT "tasks_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;
Loading
Loading