mirror of
https://git.moonleay.net/Websites/liljudd-website.git
synced 2025-07-26 11:22:04 +02:00
chore: squashed some commits, which are not for public viewing
fix: fixed ImageSection being broken on mobile feat: added proper imprint feat: added name to privacy-policy feat: bump version fix: fixed footer not rendering correct on some mobile devices chore: bump version feat: imported html from Config repo Updated packages Migration from astro to solid-start Add database and auth Add discord rest testing Database schema rework API meeting progress Fix styles
This commit is contained in:
parent
eb3acd206c
commit
2e529cede8
50 changed files with 9903 additions and 5045 deletions
139
src/drizzle/schema.ts
Normal file
139
src/drizzle/schema.ts
Normal file
|
@ -0,0 +1,139 @@
|
|||
import type { AdapterAccount } from "@auth/core/adapters";
|
||||
import { relations } from "drizzle-orm";
|
||||
import {
|
||||
integer,
|
||||
pgTable,
|
||||
primaryKey,
|
||||
serial,
|
||||
smallint,
|
||||
text,
|
||||
timestamp,
|
||||
varchar,
|
||||
} from "drizzle-orm/pg-core";
|
||||
|
||||
export const users = pgTable("user", {
|
||||
id: text("id").primaryKey(),
|
||||
name: text("name"),
|
||||
email: text("email").notNull(),
|
||||
emailVerified: timestamp("email_verified", { mode: "date" }),
|
||||
image: text("image"),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const accounts = pgTable(
|
||||
"account",
|
||||
{
|
||||
userId: text("user_id")
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
type: text("type").$type<AdapterAccount["type"]>().notNull(),
|
||||
provider: text("provider").notNull(),
|
||||
providerAccountId: text("provider_account_id").notNull(),
|
||||
refresh_token: text("refresh_token"),
|
||||
access_token: text("access_token"),
|
||||
expires_at: integer("expires_at"),
|
||||
token_type: text("token_type"),
|
||||
scope: text("scope"),
|
||||
id_token: text("id_token"),
|
||||
session_state: text("session_state"),
|
||||
},
|
||||
(account) => ({
|
||||
compoundKey: primaryKey({
|
||||
columns: [account.provider, account.providerAccountId],
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
export const sessions = pgTable("session", {
|
||||
sessionToken: text("session_token").primaryKey(),
|
||||
userId: text("user_id")
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
expires: timestamp("expires", { mode: "date" }).notNull(),
|
||||
});
|
||||
|
||||
export const verificationTokens = pgTable(
|
||||
"verification_token",
|
||||
{
|
||||
identifier: text("identifier").notNull(),
|
||||
token: text("token").notNull(),
|
||||
expires: timestamp("expires", { mode: "date" }).notNull(),
|
||||
},
|
||||
(vt) => ({
|
||||
compoundKey: primaryKey({ columns: [vt.identifier, vt.token] }),
|
||||
}),
|
||||
);
|
||||
|
||||
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(),
|
||||
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 })
|
||||
.notNull()
|
||||
.references(() => guilds.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const matchPlanningsRelations = relations(matchPlannings, ({ one }) => ({
|
||||
guild: one(guilds, {
|
||||
fields: [matchPlannings.guildId],
|
||||
references: [guilds.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const guilds = pgTable("guild", {
|
||||
id: varchar("id", { length: 19 }).primaryKey(),
|
||||
});
|
||||
|
||||
export const guildsRelations = relations(guilds, ({ one, many }) => ({
|
||||
matches: many(matchPlannings),
|
||||
timePlanning: one(timePlannings, {
|
||||
fields: [guilds.id],
|
||||
references: [timePlannings.guildId],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const timePlannings = pgTable("time_planning", {
|
||||
id: serial("id").primaryKey(),
|
||||
guildId: varchar("guild_id", { length: 19 })
|
||||
.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 }),
|
||||
wantsToBeNotifieRoledId: varchar("wants_to_be_notified_role_id", {
|
||||
length: 19,
|
||||
}),
|
||||
});
|
||||
|
||||
export const timePlanningsRelations = relations(
|
||||
timePlannings,
|
||||
({ one, many }) => ({
|
||||
guild: one(tpMessages),
|
||||
messages: many(tpMessages),
|
||||
}),
|
||||
);
|
||||
|
||||
export const tpMessages = pgTable("tp_message", {
|
||||
messageId: varchar("message_id", { length: 19 }).primaryKey(),
|
||||
day: smallint("day").notNull(),
|
||||
planId: varchar("plan_id", { length: 19 })
|
||||
.notNull()
|
||||
.references(() => timePlannings.guildId, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const tpMessagesRelations = relations(tpMessages, ({ one }) => ({
|
||||
timePlanning: one(timePlannings, {
|
||||
fields: [tpMessages.messageId],
|
||||
references: [timePlannings.channelId],
|
||||
}),
|
||||
}));
|
Loading…
Add table
Add a link
Reference in a new issue