docs for memories
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-06-29 15:00:34 +01:00
parent 701d39982f
commit 421c96c814
14 changed files with 956 additions and 33 deletions

View File

@@ -0,0 +1,19 @@
CREATE TABLE IF NOT EXISTS "resource_links" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid NOT NULL,
"date" date NOT NULL,
"week_start" date NOT NULL,
"title" varchar(300) NOT NULL,
"url" text NOT NULL,
"category" varchar(120) DEFAULT 'Interesting things to read up:' NOT NULL,
"notes" text,
"status" varchar(20) DEFAULT 'inbox' NOT NULL,
"exported_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "resource_links" ADD CONSTRAINT "resource_links_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "resource_links_user_week_idx" ON "resource_links" ("user_id", "week_start");
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "resource_links_user_status_idx" ON "resource_links" ("user_id", "status");

View File

@@ -238,6 +238,29 @@ export const weeklyReviews = pgTable("weekly_reviews", {
userIntention: text("user_intention"),
});
export const resourceLinks = pgTable(
"resource_links",
{
id: uuid("id").primaryKey().defaultRandom(),
userId: uuid("user_id")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
date: date("date").notNull(),
weekStart: date("week_start").notNull(),
title: varchar("title", { length: 300 }).notNull(),
url: text("url").notNull(),
category: varchar("category", { length: 120 }).notNull().default("Interesting things to read up:"),
notes: text("notes"),
status: varchar("status", { length: 20 }).notNull().default("inbox"),
exportedAt: timestamp("exported_at", { withTimezone: true }),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
},
(t) => [
index("resource_links_user_week_idx").on(t.userId, t.weekStart),
index("resource_links_user_status_idx").on(t.userId, t.status),
]
);
export const xpEvents = pgTable("xp_events", {
id: uuid("id").primaryKey().defaultRandom(),
userId: uuid("user_id")
@@ -439,6 +462,7 @@ export const usersRelations = relations(users, ({ one, many }) => ({
aiMemories: many(aiMemories),
aiMemorySuggestions: many(aiMemorySuggestions),
aiChatSessions: many(aiChatSessions),
resourceLinks: many(resourceLinks),
}));
export const adventureTemplatesRelations = relations(