mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
IssueAssignee table
This commit is contained in:
@@ -121,7 +121,6 @@ export const Issue = pgTable(
|
||||
creatorId: integer()
|
||||
.notNull()
|
||||
.references(() => User.id),
|
||||
assigneeId: integer().references(() => User.id),
|
||||
|
||||
sprintId: integer().references(() => Sprint.id),
|
||||
},
|
||||
@@ -132,6 +131,21 @@ export const Issue = pgTable(
|
||||
],
|
||||
);
|
||||
|
||||
export const IssueAssignee = pgTable(
|
||||
"IssueAssignee",
|
||||
{
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity(),
|
||||
issueId: integer()
|
||||
.notNull()
|
||||
.references(() => Issue.id, { onDelete: "cascade" }),
|
||||
userId: integer()
|
||||
.notNull()
|
||||
.references(() => User.id, { onDelete: "cascade" }),
|
||||
assignedAt: timestamp({ withTimezone: false }).defaultNow(),
|
||||
},
|
||||
(t) => [uniqueIndex("unique_issue_user").on(t.issueId, t.userId)],
|
||||
);
|
||||
|
||||
// Zod schemas
|
||||
export const UserSelectSchema = createSelectSchema(User);
|
||||
export const UserInsertSchema = createInsertSchema(User);
|
||||
@@ -151,6 +165,9 @@ export const SprintInsertSchema = createInsertSchema(Sprint);
|
||||
export const IssueSelectSchema = createSelectSchema(Issue);
|
||||
export const IssueInsertSchema = createInsertSchema(Issue);
|
||||
|
||||
export const IssueAssigneeSelectSchema = createSelectSchema(IssueAssignee);
|
||||
export const IssueAssigneeInsertSchema = createInsertSchema(IssueAssignee);
|
||||
|
||||
export const SessionSelectSchema = createSelectSchema(Session);
|
||||
export const SessionInsertSchema = createInsertSchema(Session);
|
||||
|
||||
@@ -178,6 +195,9 @@ export type SprintInsert = z.infer<typeof SprintInsertSchema>;
|
||||
export type IssueRecord = z.infer<typeof IssueSelectSchema>;
|
||||
export type IssueInsert = z.infer<typeof IssueInsertSchema>;
|
||||
|
||||
export type IssueAssigneeRecord = z.infer<typeof IssueAssigneeSelectSchema>;
|
||||
export type IssueAssigneeInsert = z.infer<typeof IssueAssigneeInsertSchema>;
|
||||
|
||||
export type SessionRecord = z.infer<typeof SessionSelectSchema>;
|
||||
export type SessionInsert = z.infer<typeof SessionInsertSchema>;
|
||||
|
||||
@@ -189,7 +209,7 @@ export type TimedSessionInsert = z.infer<typeof TimedSessionInsertSchema>;
|
||||
export type IssueResponse = {
|
||||
Issue: IssueRecord;
|
||||
Creator: UserRecord;
|
||||
Assignee: UserRecord | null;
|
||||
Assignees: UserRecord[];
|
||||
};
|
||||
|
||||
export type ProjectResponse = {
|
||||
|
||||
Reference in New Issue
Block a user