Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Update schema.ts
Browse files Browse the repository at this point in the history
Signed-off-by: Naya Singhania <naya.singhania@gmail.com>
  • Loading branch information
raspberri05 committed Oct 21, 2024
1 parent b84d308 commit ec2c73b
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions application/app/api/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,24 @@ export const personas = pgTable("personas", {
});

export const groups = pgTable("groups", {
id: uuid("id").primaryKey().defaultRandom(),
name: text("name").notNull().unique(),
uid: uuid("uid").primaryKey().notNull(),
name: text("name").notNull(),
});

export const groupMemberships = pgTable("group_memberships", {
userId: uuid("user_id").references(() => users.uid).notNull(),
groupId: uuid("group_id").references(() => groups.id).notNull(),
}, (table: { userId: any; groupId: any; }) => ({
pk: primaryKey(table.userId, table.groupId),
}));
export const memberships = pgTable("memberships", {
uid: uuid("uid").primaryKey().notNull(),
user_id: uuid("user_id").references(() => users.uid).notNull(),
group_id: uuid("group_id").references(() => groups.uid).notNull(),
});

export type InsertUser = typeof users.$inferInsert;
export type SelectUser = typeof users.$inferSelect;

export type InsertPersona = typeof personas.$inferInsert;
function primaryKey(userId: any, groupId: any) {
throw new Error("Function not implemented.");
}
export type SelectPersona = typeof personas.$inferSelect;

export type InsertGroup = typeof groups.$inferInsert;
export type SelectGroup = typeof groups.$inferSelect;

export type InsertMembership = typeof memberships.$inferSelect;
export type SelectMembership = typeof memberships.$inferInsert;

0 comments on commit ec2c73b

Please sign in to comment.