issue #39
All checks were successful
Test CI / build (push) Successful in 1m23s

- 자동 로그인 로직 cookie 로 변경
This commit is contained in:
2025-12-07 22:46:01 +09:00
parent 91e4f987ea
commit abee778691
13 changed files with 239 additions and 70 deletions

View File

@@ -18,8 +18,8 @@ export const commentRelations = relations(comment, ({one, many}) => ({
export const accountRelations = relations(account, ({many}) => ({
comments: many(comment),
schedules: many(schedule),
participants: many(participant),
schedules: many(schedule),
favorites: many(favorite),
follows_follower: many(follow, {
relationName: "follow_follower_account_id"
@@ -29,15 +29,6 @@ export const accountRelations = relations(account, ({many}) => ({
}),
}));
export const scheduleRelations = relations(schedule, ({one, many}) => ({
account: one(account, {
fields: [schedule.owner],
references: [account.id]
}),
participants: many(participant),
favorites: many(favorite),
}));
export const participantRelations = relations(participant, ({one}) => ({
schedule: one(schedule, {
fields: [participant.scheduleId],
@@ -49,6 +40,15 @@ export const participantRelations = relations(participant, ({one}) => ({
}),
}));
export const scheduleRelations = relations(schedule, ({one, many}) => ({
participants: many(participant),
account: one(account, {
fields: [schedule.owner],
references: [account.id]
}),
favorites: many(favorite),
}));
export const favoriteRelations = relations(favorite, ({one}) => ({
schedule: one(schedule, {
fields: [favorite.scheduleId],

View File

@@ -1,7 +1,23 @@
import { pgTable, foreignKey, uuid, text, date, boolean, index, varchar, primaryKey } from "drizzle-orm/pg-core"
import { pgTable, foreignKey, uuid, text, date, boolean, varchar, index, time, primaryKey, pgSequence } from "drizzle-orm/pg-core"
import { sql } from "drizzle-orm"
export const versionIdSeq = pgSequence("version_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const accessTokenIdSeq = pgSequence("access_token_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const oauth2ApplicationIdSeq = pgSequence("oauth2_application_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const oauth2AuthorizationCodeIdSeq = pgSequence("oauth2_authorization_code_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const oauth2GrantIdSeq = pgSequence("oauth2_grant_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const loginSourceIdSeq = pgSequence("login_source_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const twoFactorIdSeq = pgSequence("two_factor_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const webauthnCredentialIdSeq = pgSequence("webauthn_credential_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const dbfsMetaIdSeq = pgSequence("dbfs_meta_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const dbfsDataIdSeq = pgSequence("dbfs_data_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const noticeIdSeq = pgSequence("notice_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const systemSettingIdSeq = pgSequence("system_setting_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const badgeIdSeq = pgSequence("badge_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const userBadgeIdSeq = pgSequence("user_badge_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const userBlockingIdSeq = pgSequence("user_blocking_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const emailAddressIdSeq = pgSequence("email_address_id_seq", { startWith: "1", increment: "1", minValue: "1", maxValue: "9223372036854775807", cache: "1", cycle: false })
export const comment = pgTable("comment", {
id: uuid().primaryKey().notNull(),
@@ -23,30 +39,6 @@ export const comment = pgTable("comment", {
}),
]);
export const schedule = pgTable("schedule", {
id: uuid().primaryKey().notNull(),
name: varchar(),
startAt: date("start_at"),
endAt: date("end_at"),
status: varchar(),
content: text(),
isDeleted: boolean("is_deleted").default(false),
type: varchar(),
createdAt: date("created_at"),
owner: uuid(),
}, (table) => [
index("schedule_enddatetime_idx").using("btree", table.endAt.asc().nullsLast().op("date_ops")),
index("schedule_name_idx").using("btree", table.name.asc().nullsLast().op("text_ops"), table.content.asc().nullsLast().op("text_ops")),
index("schedule_startdatetime_idx").using("btree", table.startAt.asc().nullsLast().op("date_ops")),
index("schedule_status_idx").using("btree", table.status.asc().nullsLast().op("text_ops")),
index("schedule_type_idx").using("btree", table.type.asc().nullsLast().op("text_ops")),
foreignKey({
columns: [table.owner],
foreignColumns: [account.id],
name: "schedule_user_fk"
}),
]);
export const account = pgTable("account", {
name: varchar().notNull(),
email: varchar().notNull(),
@@ -79,6 +71,33 @@ export const participant = pgTable("participant", {
}),
]);
export const schedule = pgTable("schedule", {
id: uuid().primaryKey().notNull(),
name: varchar(),
startDate: date("start_date"),
endDate: date("end_date"),
status: varchar(),
content: text(),
isDeleted: boolean("is_deleted").default(false),
type: varchar(),
createdAt: date("created_at"),
owner: uuid(),
style: varchar(),
startTime: time("start_time"),
endTime: time("end_time"),
}, (table) => [
index("schedule_enddatetime_idx").using("btree", table.endDate.asc().nullsLast().op("date_ops")),
index("schedule_name_idx").using("btree", table.name.asc().nullsLast().op("text_ops"), table.content.asc().nullsLast().op("text_ops")),
index("schedule_startdatetime_idx").using("btree", table.startDate.asc().nullsLast().op("date_ops")),
index("schedule_status_idx").using("btree", table.status.asc().nullsLast().op("text_ops")),
index("schedule_type_idx").using("btree", table.type.asc().nullsLast().op("text_ops")),
foreignKey({
columns: [table.owner],
foreignColumns: [account.id],
name: "schedule_user_fk"
}),
]);
export const favorite = pgTable("favorite", {
isDeleted: boolean("is_deleted").default(false),
createdAt: date("created_at"),