summaryrefslogtreecommitdiff
path: root/app/src/lib/common
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2025-02-19 18:37:33 +0100
committerLinnnus <[email protected]>2025-02-19 18:37:51 +0100
commitf7a6244cc1a8f39ad44186a4da6b743ab6821d51 (patch)
tree54e63d1509f56caaac542a4548325f9716d42069 /app/src/lib/common
parent80a432fbda4ca2f35286197c636ad2a733ca4b5a (diff)
Add assignment submission
Diffstat (limited to 'app/src/lib/common')
-rw-r--r--app/src/lib/common/assignments.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/src/lib/common/assignments.ts b/app/src/lib/common/assignments.ts
new file mode 100644
index 0000000..79553cd
--- /dev/null
+++ b/app/src/lib/common/assignments.ts
@@ -0,0 +1,32 @@
+/** A row from the `cemetary_plot` table. */
+export interface CemetaryPlot {
+ id: number;
+ address: string;
+ ownerId: number;
+ //assignmentInterval: Date;
+}
+
+/** Corresponds to `assignment_state`. */
+export type AssignmentState = "AWAITING_GARDENER_NOTIFICATION"
+ | "AWAITING_FINISH"
+ | "AWAITING_WATERMARKING"
+ | "AWAITING_OWNER_NOTIFICATION"
+ | "DONE"
+ ;
+
+/** A row from the `assignments` table. */
+export interface Assignment {
+ id: number;
+ gardenerId: number;
+ cemetaryPlotId: number;
+ date: Date;
+ state: AssignmentState;
+}
+
+
+// FIXME: We have ORM at home. A more clearly defined (OOP) model layer.
+/** Checks whether the state of the assignment allows it to be "finished". */
+export function canBeFinished(assignment: Assignment): boolean {
+ return (assignment.state === "AWAITING_GARDENER_NOTIFICATION" ||
+ assignment.state === "AWAITING_FINISH")
+}