mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
added Session table for cookie-based auth
This commit is contained in:
@@ -11,6 +11,8 @@ export type {
|
|||||||
ProjectInsert,
|
ProjectInsert,
|
||||||
ProjectRecord,
|
ProjectRecord,
|
||||||
ProjectResponse,
|
ProjectResponse,
|
||||||
|
SessionInsert,
|
||||||
|
SessionRecord,
|
||||||
UserInsert,
|
UserInsert,
|
||||||
UserRecord,
|
UserRecord,
|
||||||
} from "./schema";
|
} from "./schema";
|
||||||
@@ -27,6 +29,9 @@ export {
|
|||||||
Project,
|
Project,
|
||||||
ProjectInsertSchema,
|
ProjectInsertSchema,
|
||||||
ProjectSelectSchema,
|
ProjectSelectSchema,
|
||||||
|
Session,
|
||||||
|
SessionInsertSchema,
|
||||||
|
SessionSelectSchema,
|
||||||
User,
|
User,
|
||||||
UserInsertSchema,
|
UserInsertSchema,
|
||||||
UserSelectSchema,
|
UserSelectSchema,
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ export const Project = pgTable("Project", {
|
|||||||
.references(() => User.id),
|
.references(() => User.id),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const Session = pgTable("Session", {
|
||||||
|
id: integer().primaryKey().generatedAlwaysAsIdentity(),
|
||||||
|
userId: integer()
|
||||||
|
.notNull()
|
||||||
|
.references(() => User.id),
|
||||||
|
csrfToken: varchar({ length: 64 }).notNull(),
|
||||||
|
expiresAt: timestamp({ withTimezone: false }).notNull(),
|
||||||
|
createdAt: timestamp({ withTimezone: false }).defaultNow(),
|
||||||
|
});
|
||||||
|
|
||||||
export const Issue = pgTable(
|
export const Issue = pgTable(
|
||||||
"Issue",
|
"Issue",
|
||||||
{
|
{
|
||||||
@@ -86,6 +96,9 @@ export const ProjectInsertSchema = createInsertSchema(Project);
|
|||||||
export const IssueSelectSchema = createSelectSchema(Issue);
|
export const IssueSelectSchema = createSelectSchema(Issue);
|
||||||
export const IssueInsertSchema = createInsertSchema(Issue);
|
export const IssueInsertSchema = createInsertSchema(Issue);
|
||||||
|
|
||||||
|
export const SessionSelectSchema = createSelectSchema(Session);
|
||||||
|
export const SessionInsertSchema = createInsertSchema(Session);
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
export type UserRecord = z.infer<typeof UserSelectSchema>;
|
export type UserRecord = z.infer<typeof UserSelectSchema>;
|
||||||
export type UserInsert = z.infer<typeof UserInsertSchema>;
|
export type UserInsert = z.infer<typeof UserInsertSchema>;
|
||||||
@@ -102,6 +115,9 @@ export type ProjectInsert = z.infer<typeof ProjectInsertSchema>;
|
|||||||
export type IssueRecord = z.infer<typeof IssueSelectSchema>;
|
export type IssueRecord = z.infer<typeof IssueSelectSchema>;
|
||||||
export type IssueInsert = z.infer<typeof IssueInsertSchema>;
|
export type IssueInsert = z.infer<typeof IssueInsertSchema>;
|
||||||
|
|
||||||
|
export type SessionRecord = z.infer<typeof SessionSelectSchema>;
|
||||||
|
export type SessionInsert = z.infer<typeof SessionInsertSchema>;
|
||||||
|
|
||||||
// Responses
|
// Responses
|
||||||
|
|
||||||
export type IssueResponse = {
|
export type IssueResponse = {
|
||||||
|
|||||||
Reference in New Issue
Block a user