basic user-tailored UI

This commit is contained in:
Avraham Sakal
2025-09-18 10:45:00 -04:00
parent 83e3f867dd
commit 61540f9338
8 changed files with 43 additions and 34 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ export interface Entity<T> {
construct: (data: T) => T;
create: (data: Omit<T, "id">) => Promise<T>;
createMany: (data: Omit<T, "id">[]) => Promise<T[]>;
findAll: () => Promise<T[]>;
findAll: (user?: { userId: string }) => Promise<T[]>;
findById: (id: string) => Promise<T | undefined>;
update: (id: string, data: Partial<T>) => Promise<void>;
delete: (id: string) => Promise<void>;
+7 -5
View File
@@ -58,11 +58,13 @@ export function getDb(POSTGRES_CONNECTION_STRING: string) {
.execute();
return insertedRows;
},
findAll: async () => {
const rows = await dbClient
.selectFrom("conversations")
.selectAll()
.execute();
findAll: async (user) => {
const userId = user?.userId;
let query = await dbClient.selectFrom("conversations");
if (userId) {
query = query.where("userId", "=", userId);
}
const rows = query.selectAll().execute();
return rows;
},
findById: async (id) => {