mirror of
https://git.moonleay.net/Websites/liljudd-website.git
synced 2025-07-26 11:22:04 +02:00
feat: complete last commit
This commit is contained in:
parent
55b81fac91
commit
c3bf31b3d4
14 changed files with 8344 additions and 58 deletions
|
@ -65,14 +65,14 @@ export const verificationTokens = pgTable(
|
|||
|
||||
export const matchPlannings = pgTable("match_planning", {
|
||||
id: serial("id").primaryKey(),
|
||||
channelId: varchar("channel_id", { length: 19 }).notNull(),
|
||||
matchtype: varchar("matchtype", { length: 50 }).notNull(),
|
||||
createrId: varchar("creater_id", { length: 19 }).notNull(),
|
||||
roleId: varchar("role_id", { length: 19 }).notNull(),
|
||||
channelId: varchar("channel_id", { length: 20 }).notNull(),
|
||||
matchtype: varchar("match_type", { length: 50 }).notNull(),
|
||||
createrId: varchar("creater_id", { length: 20 }).notNull(),
|
||||
roleId: varchar("role_id", { length: 20 }).notNull(),
|
||||
opponentName: varchar("opponent_name", { length: 100 }).notNull(),
|
||||
messageId: varchar("message_id", { length: 19 }).notNull(),
|
||||
plannedFor: timestamp("planned_for", { precision: 3 }).notNull(),
|
||||
guildId: varchar("guild_id", { length: 19 })
|
||||
messageId: varchar("message_id", { length: 20 }).notNull(),
|
||||
ts: timestamp("ts").notNull(),
|
||||
guildId: varchar("guild_id", { length: 20 })
|
||||
.notNull()
|
||||
.references(() => guilds.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
@ -85,7 +85,8 @@ export const matchPlanningsRelations = relations(matchPlannings, ({ one }) => ({
|
|||
}));
|
||||
|
||||
export const guilds = pgTable("guild", {
|
||||
id: varchar("id", { length: 19 }).primaryKey(),
|
||||
id: varchar("id", { length: 20 }).primaryKey(),
|
||||
timezone: text("timezone").notNull(),
|
||||
});
|
||||
|
||||
export const guildsRelations = relations(guilds, ({ one, many }) => ({
|
||||
|
@ -98,41 +99,42 @@ export const guildsRelations = relations(guilds, ({ one, many }) => ({
|
|||
|
||||
export const timePlannings = pgTable("time_planning", {
|
||||
id: serial("id").primaryKey(),
|
||||
guildId: varchar("guild_id", { length: 19 })
|
||||
guildId: varchar("guild_id", { length: 20 })
|
||||
.notNull()
|
||||
.unique()
|
||||
.references(() => guilds.id, {
|
||||
onDelete: "cascade",
|
||||
})
|
||||
.notNull()
|
||||
.unique(),
|
||||
channelId: varchar("channel_id", { length: 19 }).notNull(),
|
||||
targetWeekday: smallint("target_weekday").notNull(),
|
||||
targetHour: smallint("target_hour").notNull(),
|
||||
targetMinute: smallint("target_minute").notNull(),
|
||||
isAvailableRoleId: varchar("is_available_role_id", { length: 19 }),
|
||||
}),
|
||||
channelId: varchar("channel_id", { length: 20 }).notNull(),
|
||||
target_interval: smallint("target_interval").notNull(),
|
||||
isAvailableRoleId: varchar("is_available_role_id", { length: 20 }),
|
||||
wantsToBeNotifieRoledId: varchar("wants_to_be_notified_role_id", {
|
||||
length: 19,
|
||||
length: 20,
|
||||
}),
|
||||
});
|
||||
|
||||
export const timePlanningsRelations = relations(
|
||||
timePlannings,
|
||||
({ one, many }) => ({
|
||||
guild: one(tpMessages),
|
||||
guild: one(guilds, {
|
||||
fields: [timePlannings.guildId],
|
||||
references: [guilds.id],
|
||||
}),
|
||||
messages: many(tpMessages),
|
||||
}),
|
||||
);
|
||||
|
||||
export const tpMessages = pgTable("tp_message", {
|
||||
messageId: varchar("message_id", { length: 19 }).primaryKey(),
|
||||
messageId: varchar("message_id", { length: 20 }).primaryKey(),
|
||||
day: smallint("day").notNull(),
|
||||
planId: varchar("plan_id", { length: 19 })
|
||||
planId: integer("plan_id")
|
||||
.notNull()
|
||||
.references(() => timePlannings.guildId, { onDelete: "cascade" }),
|
||||
.references(() => timePlannings.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const tpMessagesRelations = relations(tpMessages, ({ one }) => ({
|
||||
timePlanning: one(timePlannings, {
|
||||
fields: [tpMessages.messageId],
|
||||
references: [timePlannings.channelId],
|
||||
plan: one(timePlannings, {
|
||||
fields: [tpMessages.planId],
|
||||
references: [timePlannings.id],
|
||||
}),
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue