issue # nestjs 로 초기화

This commit is contained in:
geonhee-min
2025-11-21 15:18:37 +09:00
parent ce50a53256
commit 0170421d16
57 changed files with 2483 additions and 143 deletions

74
drizzle/relations.ts Normal file
View File

@@ -0,0 +1,74 @@
import { relations } from "drizzle-orm/relations";
import { account, comment, schedule, participant, favorite, follow } from "./schema";
export const commentRelations = relations(comment, ({one, many}) => ({
account: one(account, {
fields: [comment.writerId],
references: [account.id]
}),
comment: one(comment, {
fields: [comment.parentId],
references: [comment.id],
relationName: "comment_parentId_comment_id"
}),
comments: many(comment, {
relationName: "comment_parentId_comment_id"
}),
}));
export const accountRelations = relations(account, ({many}) => ({
comments: many(comment),
schedules: many(schedule),
participants: many(participant),
favorites: many(favorite),
follows_follower: many(follow, {
relationName: "follow_follower_account_id"
}),
follows_following: many(follow, {
relationName: "follow_following_account_id"
}),
}));
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],
references: [schedule.id]
}),
account: one(account, {
fields: [participant.participantId],
references: [account.id]
}),
}));
export const favoriteRelations = relations(favorite, ({one}) => ({
schedule: one(schedule, {
fields: [favorite.scheduleId],
references: [schedule.id]
}),
account: one(account, {
fields: [favorite.userId],
references: [account.id]
}),
}));
export const followRelations = relations(follow, ({one}) => ({
account_follower: one(account, {
fields: [follow.follower],
references: [account.id],
relationName: "follow_follower_account_id"
}),
account_following: one(account, {
fields: [follow.following],
references: [account.id],
relationName: "follow_following_account_id"
}),
}));