diff --git a/drizzle/0025_greedy_krista_starr.sql b/drizzle/0025_greedy_krista_starr.sql
new file mode 100644
index 0000000..69083a8
--- /dev/null
+++ b/drizzle/0025_greedy_krista_starr.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "market_item_order" ADD COLUMN "marketItemId" integer;--> statement-breakpoint
+ALTER TABLE "market_item_order" ADD CONSTRAINT "market_item_order_marketItemId_market_item_id_fk" FOREIGN KEY ("marketItemId") REFERENCES "public"."market_item"("id") ON DELETE no action ON UPDATE no action;
\ No newline at end of file
diff --git a/drizzle/0026_wealthy_shinko_yamashiro.sql b/drizzle/0026_wealthy_shinko_yamashiro.sql
new file mode 100644
index 0000000..54ac3fd
--- /dev/null
+++ b/drizzle/0026_wealthy_shinko_yamashiro.sql
@@ -0,0 +1 @@
+-- ALTER TABLE "market_item_order" ALTER COLUMN "marketItemId" DROP NOT NULL;
\ No newline at end of file
diff --git a/drizzle/meta/0025_snapshot.json b/drizzle/meta/0025_snapshot.json
new file mode 100644
index 0000000..555af2e
--- /dev/null
+++ b/drizzle/meta/0025_snapshot.json
@@ -0,0 +1,1248 @@
+{
+ "id": "df45bdcb-ea12-47e9-8d07-e4348aa43961",
+ "prevId": "530bbae3-07b0-4ea9-bb7e-3d249c2632d1",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.devlog": {
+ "name": "devlog",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timeSpent": {
+ "name": "timeSpent",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deleted": {
+ "name": "deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "devlog_userId_user_id_fk": {
+ "name": "devlog_userId_user_id_fk",
+ "tableFrom": "devlog",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "devlog_projectId_project_id_fk": {
+ "name": "devlog_projectId_project_id_fk",
+ "tableFrom": "devlog",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.impersonate_audit_log": {
+ "name": "impersonate_audit_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "adminUserId": {
+ "name": "adminUserId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "targetUserId": {
+ "name": "targetUserId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "impersonate_audit_log_adminUserId_user_id_fk": {
+ "name": "impersonate_audit_log_adminUserId_user_id_fk",
+ "tableFrom": "impersonate_audit_log",
+ "tableTo": "user",
+ "columnsFrom": [
+ "adminUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "impersonate_audit_log_targetUserId_user_id_fk": {
+ "name": "impersonate_audit_log_targetUserId_user_id_fk",
+ "tableFrom": "impersonate_audit_log",
+ "tableTo": "user",
+ "columnsFrom": [
+ "targetUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.legion_review": {
+ "name": "legion_review",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback": {
+ "name": "feedback",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "filamentUsed": {
+ "name": "filamentUsed",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "legion_action",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "legion_review_userId_user_id_fk": {
+ "name": "legion_review_userId_user_id_fk",
+ "tableFrom": "legion_review",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "legion_review_projectId_project_id_fk": {
+ "name": "legion_review_projectId_project_id_fk",
+ "tableFrom": "legion_review",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.market_item": {
+ "name": "market_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "minRequiredShopScore": {
+ "name": "minRequiredShopScore",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "minShopScore": {
+ "name": "minShopScore",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "maxShopScore": {
+ "name": "maxShopScore",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "maxPrice": {
+ "name": "maxPrice",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "minPrice": {
+ "name": "minPrice",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "isPublic": {
+ "name": "isPublic",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "deleted": {
+ "name": "deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "market_item_createdBy_user_id_fk": {
+ "name": "market_item_createdBy_user_id_fk",
+ "tableFrom": "market_item",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.market_item_order": {
+ "name": "market_item_order",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "marketItemId": {
+ "name": "marketItemId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "addressId": {
+ "name": "addressId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bricksPaid": {
+ "name": "bricksPaid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "market_order_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'awaiting_approval'"
+ },
+ "userNotes": {
+ "name": "userNotes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted": {
+ "name": "deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "market_item_order_userId_user_id_fk": {
+ "name": "market_item_order_userId_user_id_fk",
+ "tableFrom": "market_item_order",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "market_item_order_marketItemId_market_item_id_fk": {
+ "name": "market_item_order_marketItemId_market_item_id_fk",
+ "tableFrom": "market_item_order",
+ "tableTo": "market_item",
+ "columnsFrom": [
+ "marketItemId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ovenpheus_log": {
+ "name": "ovenpheus_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "clay": {
+ "name": "clay",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bricksReceived": {
+ "name": "bricksReceived",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "ovenpheus_log_userId_user_id_fk": {
+ "name": "ovenpheus_log_userId_user_id_fk",
+ "tableFrom": "ovenpheus_log",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "editorFileType": {
+ "name": "editorFileType",
+ "type": "editor_file_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "editorUrl": {
+ "name": "editorUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploadedFileUrl": {
+ "name": "uploadedFileUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "modelFile": {
+ "name": "modelFile",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'building'"
+ },
+ "printedBy": {
+ "name": "printedBy",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "submittedToAirtable": {
+ "name": "submittedToAirtable",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "deleted": {
+ "name": "deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_userId_user_id_fk": {
+ "name": "project_userId_user_id_fk",
+ "tableFrom": "project",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "project_printedBy_user_id_fk": {
+ "name": "project_printedBy_user_id_fk",
+ "tableFrom": "project",
+ "tableTo": "user",
+ "columnsFrom": [
+ "printedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ship": {
+ "name": "ship",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "editorFileType": {
+ "name": "editorFileType",
+ "type": "editor_file_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "editorUrl": {
+ "name": "editorUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploadedFileUrl": {
+ "name": "uploadedFileUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "modelFile": {
+ "name": "modelFile",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "ship_userId_user_id_fk": {
+ "name": "ship_userId_user_id_fk",
+ "tableFrom": "ship",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "ship_projectId_project_id_fk": {
+ "name": "ship_projectId_project_id_fk",
+ "tableFrom": "ship",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.t1_review": {
+ "name": "t1_review",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback": {
+ "name": "feedback",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "t1_review_action",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "t1_review_userId_user_id_fk": {
+ "name": "t1_review_userId_user_id_fk",
+ "tableFrom": "t1_review",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "t1_review_projectId_project_id_fk": {
+ "name": "t1_review_projectId_project_id_fk",
+ "tableFrom": "t1_review",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.t2_review": {
+ "name": "t2_review",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback": {
+ "name": "feedback",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shopScoreMultiplier": {
+ "name": "shopScoreMultiplier",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 25
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "t2_review_userId_user_id_fk": {
+ "name": "t2_review_userId_user_id_fk",
+ "tableFrom": "t2_review",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "t2_review_projectId_project_id_fk": {
+ "name": "t2_review_projectId_project_id_fk",
+ "tableFrom": "t2_review",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "idvId": {
+ "name": "idvId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idvToken": {
+ "name": "idvToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slackId": {
+ "name": "slackId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "profilePicture": {
+ "name": "profilePicture",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "hackatimeTrust": {
+ "name": "hackatimeTrust",
+ "type": "hackatime_trust",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trust": {
+ "name": "trust",
+ "type": "trust",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'blue'"
+ },
+ "clay": {
+ "name": "clay",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "brick": {
+ "name": "brick",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "shopScore": {
+ "name": "shopScore",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "hasBasePrinter": {
+ "name": "hasBasePrinter",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "hasT1Review": {
+ "name": "hasT1Review",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "hasT2Review": {
+ "name": "hasT2Review",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "hasAdmin": {
+ "name": "hasAdmin",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "isPrinter": {
+ "name": "isPrinter",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "lastLoginAt": {
+ "name": "lastLoginAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_idvId_unique": {
+ "name": "user_idvId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "idvId"
+ ]
+ },
+ "user_slackId_unique": {
+ "name": "user_slackId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slackId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.editor_file_type": {
+ "name": "editor_file_type",
+ "schema": "public",
+ "values": [
+ "url",
+ "upload"
+ ]
+ },
+ "public.hackatime_trust": {
+ "name": "hackatime_trust",
+ "schema": "public",
+ "values": [
+ "green",
+ "blue",
+ "yellow",
+ "red"
+ ]
+ },
+ "public.legion_action": {
+ "name": "legion_action",
+ "schema": "public",
+ "values": [
+ "mark_for_printing",
+ "unmark_for_printing",
+ "print",
+ "add_comment",
+ "reject",
+ "already_printed"
+ ]
+ },
+ "public.market_order_status": {
+ "name": "market_order_status",
+ "schema": "public",
+ "values": [
+ "awaiting_approval",
+ "fulfilled",
+ "denied",
+ "refunded"
+ ]
+ },
+ "public.project_audit_log_type": {
+ "name": "project_audit_log_type",
+ "schema": "public",
+ "values": [
+ "create",
+ "update",
+ "delete"
+ ]
+ },
+ "public.status": {
+ "name": "status",
+ "schema": "public",
+ "values": [
+ "building",
+ "submitted",
+ "t1_approved",
+ "printing",
+ "printed",
+ "t2_approved",
+ "finalized",
+ "rejected",
+ "rejected_locked"
+ ]
+ },
+ "public.t1_review_action": {
+ "name": "t1_review_action",
+ "schema": "public",
+ "values": [
+ "approve",
+ "approve_no_print",
+ "add_comment",
+ "reject",
+ "reject_lock"
+ ]
+ },
+ "public.trust": {
+ "name": "trust",
+ "schema": "public",
+ "values": [
+ "green",
+ "blue",
+ "yellow",
+ "red"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/drizzle/meta/0026_snapshot.json b/drizzle/meta/0026_snapshot.json
new file mode 100644
index 0000000..24e7535
--- /dev/null
+++ b/drizzle/meta/0026_snapshot.json
@@ -0,0 +1,1248 @@
+{
+ "id": "d7a8ece8-d669-4251-96f7-6b98213f328c",
+ "prevId": "df45bdcb-ea12-47e9-8d07-e4348aa43961",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.devlog": {
+ "name": "devlog",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timeSpent": {
+ "name": "timeSpent",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deleted": {
+ "name": "deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "devlog_userId_user_id_fk": {
+ "name": "devlog_userId_user_id_fk",
+ "tableFrom": "devlog",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "devlog_projectId_project_id_fk": {
+ "name": "devlog_projectId_project_id_fk",
+ "tableFrom": "devlog",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.impersonate_audit_log": {
+ "name": "impersonate_audit_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "adminUserId": {
+ "name": "adminUserId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "targetUserId": {
+ "name": "targetUserId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "impersonate_audit_log_adminUserId_user_id_fk": {
+ "name": "impersonate_audit_log_adminUserId_user_id_fk",
+ "tableFrom": "impersonate_audit_log",
+ "tableTo": "user",
+ "columnsFrom": [
+ "adminUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "impersonate_audit_log_targetUserId_user_id_fk": {
+ "name": "impersonate_audit_log_targetUserId_user_id_fk",
+ "tableFrom": "impersonate_audit_log",
+ "tableTo": "user",
+ "columnsFrom": [
+ "targetUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.legion_review": {
+ "name": "legion_review",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback": {
+ "name": "feedback",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "filamentUsed": {
+ "name": "filamentUsed",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "legion_action",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "legion_review_userId_user_id_fk": {
+ "name": "legion_review_userId_user_id_fk",
+ "tableFrom": "legion_review",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "legion_review_projectId_project_id_fk": {
+ "name": "legion_review_projectId_project_id_fk",
+ "tableFrom": "legion_review",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.market_item": {
+ "name": "market_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "minRequiredShopScore": {
+ "name": "minRequiredShopScore",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "minShopScore": {
+ "name": "minShopScore",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "maxShopScore": {
+ "name": "maxShopScore",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "maxPrice": {
+ "name": "maxPrice",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "minPrice": {
+ "name": "minPrice",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "isPublic": {
+ "name": "isPublic",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "deleted": {
+ "name": "deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "market_item_createdBy_user_id_fk": {
+ "name": "market_item_createdBy_user_id_fk",
+ "tableFrom": "market_item",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.market_item_order": {
+ "name": "market_item_order",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "marketItemId": {
+ "name": "marketItemId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "addressId": {
+ "name": "addressId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bricksPaid": {
+ "name": "bricksPaid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "market_order_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'awaiting_approval'"
+ },
+ "userNotes": {
+ "name": "userNotes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted": {
+ "name": "deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "market_item_order_userId_user_id_fk": {
+ "name": "market_item_order_userId_user_id_fk",
+ "tableFrom": "market_item_order",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "market_item_order_marketItemId_market_item_id_fk": {
+ "name": "market_item_order_marketItemId_market_item_id_fk",
+ "tableFrom": "market_item_order",
+ "tableTo": "market_item",
+ "columnsFrom": [
+ "marketItemId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ovenpheus_log": {
+ "name": "ovenpheus_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "clay": {
+ "name": "clay",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bricksReceived": {
+ "name": "bricksReceived",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "ovenpheus_log_userId_user_id_fk": {
+ "name": "ovenpheus_log_userId_user_id_fk",
+ "tableFrom": "ovenpheus_log",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "editorFileType": {
+ "name": "editorFileType",
+ "type": "editor_file_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "editorUrl": {
+ "name": "editorUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploadedFileUrl": {
+ "name": "uploadedFileUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "modelFile": {
+ "name": "modelFile",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'building'"
+ },
+ "printedBy": {
+ "name": "printedBy",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "submittedToAirtable": {
+ "name": "submittedToAirtable",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "deleted": {
+ "name": "deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_userId_user_id_fk": {
+ "name": "project_userId_user_id_fk",
+ "tableFrom": "project",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "project_printedBy_user_id_fk": {
+ "name": "project_printedBy_user_id_fk",
+ "tableFrom": "project",
+ "tableTo": "user",
+ "columnsFrom": [
+ "printedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ship": {
+ "name": "ship",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "editorFileType": {
+ "name": "editorFileType",
+ "type": "editor_file_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "editorUrl": {
+ "name": "editorUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploadedFileUrl": {
+ "name": "uploadedFileUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "modelFile": {
+ "name": "modelFile",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "ship_userId_user_id_fk": {
+ "name": "ship_userId_user_id_fk",
+ "tableFrom": "ship",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "ship_projectId_project_id_fk": {
+ "name": "ship_projectId_project_id_fk",
+ "tableFrom": "ship",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.t1_review": {
+ "name": "t1_review",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback": {
+ "name": "feedback",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "t1_review_action",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "t1_review_userId_user_id_fk": {
+ "name": "t1_review_userId_user_id_fk",
+ "tableFrom": "t1_review",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "t1_review_projectId_project_id_fk": {
+ "name": "t1_review_projectId_project_id_fk",
+ "tableFrom": "t1_review",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.t2_review": {
+ "name": "t2_review",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projectId": {
+ "name": "projectId",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback": {
+ "name": "feedback",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shopScoreMultiplier": {
+ "name": "shopScoreMultiplier",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 25
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "t2_review_userId_user_id_fk": {
+ "name": "t2_review_userId_user_id_fk",
+ "tableFrom": "t2_review",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "t2_review_projectId_project_id_fk": {
+ "name": "t2_review_projectId_project_id_fk",
+ "tableFrom": "t2_review",
+ "tableTo": "project",
+ "columnsFrom": [
+ "projectId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "idvId": {
+ "name": "idvId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idvToken": {
+ "name": "idvToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slackId": {
+ "name": "slackId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "profilePicture": {
+ "name": "profilePicture",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "hackatimeTrust": {
+ "name": "hackatimeTrust",
+ "type": "hackatime_trust",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trust": {
+ "name": "trust",
+ "type": "trust",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'blue'"
+ },
+ "clay": {
+ "name": "clay",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "brick": {
+ "name": "brick",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "shopScore": {
+ "name": "shopScore",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "hasBasePrinter": {
+ "name": "hasBasePrinter",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "hasT1Review": {
+ "name": "hasT1Review",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "hasT2Review": {
+ "name": "hasT2Review",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "hasAdmin": {
+ "name": "hasAdmin",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "isPrinter": {
+ "name": "isPrinter",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "lastLoginAt": {
+ "name": "lastLoginAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_idvId_unique": {
+ "name": "user_idvId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "idvId"
+ ]
+ },
+ "user_slackId_unique": {
+ "name": "user_slackId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slackId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.editor_file_type": {
+ "name": "editor_file_type",
+ "schema": "public",
+ "values": [
+ "url",
+ "upload"
+ ]
+ },
+ "public.hackatime_trust": {
+ "name": "hackatime_trust",
+ "schema": "public",
+ "values": [
+ "green",
+ "blue",
+ "yellow",
+ "red"
+ ]
+ },
+ "public.legion_action": {
+ "name": "legion_action",
+ "schema": "public",
+ "values": [
+ "mark_for_printing",
+ "unmark_for_printing",
+ "print",
+ "add_comment",
+ "reject",
+ "already_printed"
+ ]
+ },
+ "public.market_order_status": {
+ "name": "market_order_status",
+ "schema": "public",
+ "values": [
+ "awaiting_approval",
+ "fulfilled",
+ "denied",
+ "refunded"
+ ]
+ },
+ "public.project_audit_log_type": {
+ "name": "project_audit_log_type",
+ "schema": "public",
+ "values": [
+ "create",
+ "update",
+ "delete"
+ ]
+ },
+ "public.status": {
+ "name": "status",
+ "schema": "public",
+ "values": [
+ "building",
+ "submitted",
+ "t1_approved",
+ "printing",
+ "printed",
+ "t2_approved",
+ "finalized",
+ "rejected",
+ "rejected_locked"
+ ]
+ },
+ "public.t1_review_action": {
+ "name": "t1_review_action",
+ "schema": "public",
+ "values": [
+ "approve",
+ "approve_no_print",
+ "add_comment",
+ "reject",
+ "reject_lock"
+ ]
+ },
+ "public.trust": {
+ "name": "trust",
+ "schema": "public",
+ "values": [
+ "green",
+ "blue",
+ "yellow",
+ "red"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json
index f350c57..e960053 100644
--- a/drizzle/meta/_journal.json
+++ b/drizzle/meta/_journal.json
@@ -176,6 +176,20 @@
"when": 1767390464394,
"tag": "0024_bored_valeria_richards",
"breakpoints": true
+ },
+ {
+ "idx": 25,
+ "version": "7",
+ "when": 1768071572705,
+ "tag": "0025_greedy_krista_starr",
+ "breakpoints": true
+ },
+ {
+ "idx": 26,
+ "version": "7",
+ "when": 1768171539001,
+ "tag": "0026_wealthy_shinko_yamashiro",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/src/lib/server/db/schema.ts b/src/lib/server/db/schema.ts
index 2f4591e..8481c2b 100644
--- a/src/lib/server/db/schema.ts
+++ b/src/lib/server/db/schema.ts
@@ -249,6 +249,7 @@ export const marketOrderStatus = pgEnum('market_order_status', [
export const marketItemOrder = pgTable('market_item_order', {
id: serial().primaryKey(),
userId: integer().references(() => user.id).notNull(),
+ marketItemId: integer().references(() => marketItem.id),
addressId: text().notNull(),
bricksPaid: integer().notNull(),
diff --git a/src/routes/dashboard/admin/admin/orders/+page.server.ts b/src/routes/dashboard/admin/admin/orders/+page.server.ts
index 64b2711..22293f4 100644
--- a/src/routes/dashboard/admin/admin/orders/+page.server.ts
+++ b/src/routes/dashboard/admin/admin/orders/+page.server.ts
@@ -1,26 +1,26 @@
import { db } from '$lib/server/db/index.js';
-import { project, user, devlog } from '$lib/server/db/schema.js';
+import { marketItemOrder, marketItem, user } from '$lib/server/db/schema.js';
import { error } from '@sveltejs/kit';
-import { eq, and, sql, ne, inArray } from 'drizzle-orm';
+import { eq, and, ne, inArray, desc } from 'drizzle-orm';
import type { Actions } from './$types';
export async function load({ locals }) {
if (!locals.user) {
throw error(500);
}
- if (!locals.user.hasT2Review) {
+ if (!locals.user.hasAdmin) {
throw error(403, { message: 'oi get out' });
}
- const projects = await getProjects(['printed'], [], []);
+ const orders = await getOrders(['awaiting_approval'], [], []);
- const allProjects = await db
+ const allMarketItems = await db
.select({
- id: project.id,
- name: project.name
+ id: marketItem.id,
+ name: marketItem.name
})
- .from(project)
- .where(and(eq(project.deleted, false)));
+ .from(marketItem)
+ .where(eq(marketItem.deleted, false));
const users = await db
.select({
@@ -31,8 +31,8 @@ export async function load({ locals }) {
.where(and(ne(user.trust, 'red'), ne(user.hackatimeTrust, 'red'))); // hide banned users
return {
- allProjects,
- projects,
+ allMarketItems,
+ orders,
users
};
}
@@ -42,79 +42,79 @@ export const actions = {
if (!locals.user) {
throw error(500);
}
- if (!locals.user.hasT2Review) {
+ if (!locals.user.hasAdmin) {
throw error(403, { message: 'oi get out' });
}
const data = await request.formData();
- const statusFilter = data.getAll('status') as (typeof project.status._.data)[];
+ const statusFilter = data.getAll('status') as (typeof marketItemOrder.status._.data)[];
- const projectFilter = data.getAll('project').map((projectId) => {
- const parsedInt = parseInt(projectId.toString());
- if (!parsedInt) throw error(400, { message: 'malformed project filter' });
- return parseInt(projectId.toString());
+ const marketItemFilter = data.getAll('marketItem').map((itemId) => {
+ const parsedInt = parseInt(itemId.toString());
+ if (!parsedInt) throw error(400, { message: 'malformed market item filter' });
+ return parsedInt;
});
const userFilter = data.getAll('user').map((userId) => {
const parsedInt = parseInt(userId.toString());
if (!parsedInt) throw error(400, { message: 'malformed user filter' });
- return parseInt(userId.toString());
+ return parsedInt;
});
- const projects = await getProjects(statusFilter, projectFilter, userFilter);
+ const orders = await getOrders(statusFilter, marketItemFilter, userFilter);
return {
- projects,
+ orders,
fields: {
status: statusFilter,
- project: projectFilter,
+ marketItem: marketItemFilter,
user: userFilter
}
};
}
} satisfies Actions;
-async function getProjects(
- statusFilter: (typeof project.status._.data)[],
- projectFilter: number[],
+async function getOrders(
+ statusFilter: (typeof marketItemOrder.status._.data)[],
+ marketItemFilter: number[],
userFilter: number[]
) {
return await db
.select({
- project: {
- id: project.id,
- name: project.name,
- description: project.description,
- url: project.url,
- createdAt: project.createdAt,
- status: project.status
+ order: {
+ id: marketItemOrder.id,
+ userId: marketItemOrder.userId,
+ marketItemId: marketItemOrder.marketItemId,
+ addressId: marketItemOrder.addressId,
+ bricksPaid: marketItemOrder.bricksPaid,
+ status: marketItemOrder.status,
+ userNotes: marketItemOrder.userNotes,
+ notes: marketItemOrder.notes,
+ createdAt: marketItemOrder.createdAt
+ },
+ marketItem: {
+ id: marketItem.id,
+ name: marketItem.name,
+ image: marketItem.image
},
user: {
id: user.id,
- name: user.name
- },
- timeSpent: sql
You'll get {bricks} bricks
++ You'll get {bricks} bricks and have {Math.floor(data.user.clay - clay)} left +