mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
TimedSession table
This commit is contained in:
@@ -13,6 +13,8 @@ export type {
|
||||
ProjectResponse,
|
||||
SessionInsert,
|
||||
SessionRecord,
|
||||
TimedSessionInsert,
|
||||
TimedSessionRecord,
|
||||
UserInsert,
|
||||
UserRecord,
|
||||
} from "./schema";
|
||||
@@ -32,7 +34,12 @@ export {
|
||||
Session,
|
||||
SessionInsertSchema,
|
||||
SessionSelectSchema,
|
||||
TimedSession,
|
||||
TimedSessionInsertSchema,
|
||||
TimedSessionSelectSchema,
|
||||
User,
|
||||
UserInsertSchema,
|
||||
UserSelectSchema,
|
||||
} from "./schema";
|
||||
|
||||
export { calculateBreakTimeMs, calculateWorkTimeMs, isTimerRunning } from "./utils/time-tracking";
|
||||
|
||||
@@ -55,6 +55,19 @@ export const Session = pgTable("Session", {
|
||||
createdAt: timestamp({ withTimezone: false }).defaultNow(),
|
||||
});
|
||||
|
||||
export const TimedSession = pgTable("TimedSession", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity(),
|
||||
userId: integer()
|
||||
.notNull()
|
||||
.references(() => User.id),
|
||||
issueId: integer()
|
||||
.notNull()
|
||||
.references(() => Issue.id),
|
||||
timestamps: timestamp({ withTimezone: false }).array().notNull(),
|
||||
endedAt: timestamp({ withTimezone: false }),
|
||||
createdAt: timestamp({ withTimezone: false }).defaultNow(),
|
||||
});
|
||||
|
||||
export const Issue = pgTable(
|
||||
"Issue",
|
||||
{
|
||||
@@ -99,6 +112,9 @@ export const IssueInsertSchema = createInsertSchema(Issue);
|
||||
export const SessionSelectSchema = createSelectSchema(Session);
|
||||
export const SessionInsertSchema = createInsertSchema(Session);
|
||||
|
||||
export const TimedSessionSelectSchema = createSelectSchema(TimedSession);
|
||||
export const TimedSessionInsertSchema = createInsertSchema(TimedSession);
|
||||
|
||||
// Types
|
||||
export type UserRecord = z.infer<typeof UserSelectSchema>;
|
||||
export type UserInsert = z.infer<typeof UserInsertSchema>;
|
||||
@@ -118,6 +134,9 @@ export type IssueInsert = z.infer<typeof IssueInsertSchema>;
|
||||
export type SessionRecord = z.infer<typeof SessionSelectSchema>;
|
||||
export type SessionInsert = z.infer<typeof SessionInsertSchema>;
|
||||
|
||||
export type TimedSessionRecord = z.infer<typeof TimedSessionSelectSchema>;
|
||||
export type TimedSessionInsert = z.infer<typeof TimedSessionInsertSchema>;
|
||||
|
||||
// Responses
|
||||
|
||||
export type IssueResponse = {
|
||||
|
||||
Reference in New Issue
Block a user