Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
528 changes: 528 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tsx": "^4.21.0",
"typescript": "^5.7.3",
"typescript-eslint": "^8.20.0"
},
Expand Down
22 changes: 11 additions & 11 deletions prisma/data/notification.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
id,userId,type,isRead,createdAt,deletedAt,title,body
1,2,RECOMMEND,0,2025-12-29 9:06,,새로운 추천이 도착했어요,취향이 비슷한 상대를 확인해보세요.
2,3,CHAT,0,2025-12-29 10:12,,새 메시지,새로운 채팅 메시지가 도착했습니다.
3,4,HEART,1,2025-12-29 11:18,,하트 도착,누군가 당신에게 하트를 보냈어요.
4,5,PROFILE,0,2025-12-29 12:24,,프로필 조회,누군가 당신의 프로필을 확인했어요.
5,6,REMIND,0,2025-12-29 13:30,,리마인드,오늘도 인사 한마디 보내볼까요?
6,7,UPDATE,1,2025-12-29 14:36,,업데이트 안내,새 기능이 추가됐어요. 업데이트 내용을 확인해보세요.
7,8,RECOMMEND,0,2025-12-29 15:43,2026-01-18 16:43,새로운 추천이 도착했어요,취향이 비슷한 상대를 확인해보세요.
8,9,CHAT,0,2025-12-29 16:49,,새 메시지,새로운 채팅 메시지가 도착했습니다.
9,1,HEART,1,2025-12-29 17:55,,하트 도착,누군가 당신에게 하트를 보냈어요.
10,2,PROFILE,0,2025-12-29 19:01,,프로필 조회,누군가 당신의 프로필을 확인했어요.
id,userId,type,isRead,createdAt,deletedAt,title,body,sentById
1,2,RECOMMEND,0,2025-12-29 9:06,,새로운 추천이 도착했어요,취향이 비슷한 상대를 확인해보세요.,
2,3,CHAT,0,2025-12-29 10:12,,새 메시지,새로운 채팅 메시지가 도착했습니다.,
3,4,HEART,1,2025-12-29 11:18,,하트 도착,누군가 당신에게 하트를 보냈어요.,1
4,5,PROFILE,0,2025-12-29 12:24,,프로필 조회,누군가 당신의 프로필을 확인했어요.,
5,6,REMIND,0,2025-12-29 13:30,,리마인드,오늘도 인사 한마디 보내볼까요?,
6,7,UPDATE,1,2025-12-29 14:36,,업데이트 안내,새 기능이 추가됐어요. 업데이트 내용을 확인해보세요.,
7,8,RECOMMEND,0,2025-12-29 15:43,2026-01-18 16:43,새로운 추천이 도착했어요,취향이 비슷한 상대를 확인해보세요.,
8,9,CHAT,0,2025-12-29 16:49,,새 메시지,새로운 채팅 메시지가 도착했습니다.,
9,1,HEART,1,2025-12-29 17:55,,하트 도착,누군가 당신에게 하트를 보냈어요.,2
10,2,PROFILE,0,2025-12-29 19:01,,프로필 조회,누군가 당신의 프로필을 확인했어요.,
5 changes: 5 additions & 0 deletions prisma/dbml/schema.dbml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Table User {
idealPersonalities UserIdealPersonality [not null]
personalities UserPersonality [not null]
notifications Notification [not null]
notificaionsFrom Notification [not null]
chatRooms ChatRoom [not null]
chatParticipations ChatParticipant [not null]
sentMessages ChatMessage [not null]
Expand Down Expand Up @@ -197,7 +198,9 @@ Table Notification {
deletedAt DateTime
title String [not null]
body String [not null]
sentById BigInt
user User [not null]
sentBy User
}

Table ChatRoom {
Expand Down Expand Up @@ -352,6 +355,8 @@ Ref: Report.reportedId > User.id [delete: Cascade]

Ref: Notification.userId > User.id [delete: Cascade]

Ref: Notification.sentById > User.id [delete: Cascade]

Ref: ChatRoom.userId > User.id [delete: Cascade]

Ref: ChatParticipant.roomId > ChatRoom.id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- AlterTable
ALTER TABLE `Notification` ADD COLUMN `sentById` BIGINT NULL;

-- CreateIndex
CREATE INDEX `Notification_sentById_idx` ON `Notification`(`sentById`);

-- AddForeignKey
ALTER TABLE `Notification` ADD CONSTRAINT `Notification_sentById_fkey` FOREIGN KEY (`sentById`) REFERENCES `User`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
8 changes: 6 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ model User {
interests UserInterest[]
idealPersonalities UserIdealPersonality[]
personalities UserPersonality[]
notifications Notification[]
notifications Notification[] @relation("sentTo")
notificationsFrom Notification[] @relation("sentBy")
chatRooms ChatRoom[]
chatParticipations ChatParticipant[]
sentMessages ChatMessage[] @relation("ChatMessagesSentBy")
Expand Down Expand Up @@ -285,11 +286,14 @@ model Notification {
deletedAt DateTime? @db.DateTime(6)
title String @db.VarChar(50)
body String @db.VarChar(100)
sentById BigInt? @db.BigInt

user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(name: "sentTo", fields: [userId], references: [id], onDelete: Cascade)
sentBy User? @relation(name: "sentBy", fields: [sentById], references: [id], onDelete: Cascade)

@@index([userId, isRead])
@@index([createdAt])
@@index([sentById])
}

model ChatRoom {
Expand Down
2 changes: 2 additions & 0 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ interface RawNotificationRecord {
body: string;
createdAt: string;
deletedAt?: string;
sentById?: string;
}
const ROOT = process.cwd();

Expand Down Expand Up @@ -512,6 +513,7 @@ async function main() {
body: n.body,
createdAt: new Date(n.createdAt),
deletedAt: n.deletedAt ? new Date(n.deletedAt) : null,
sentById: n.sentById ? BigInt(n.sentById) : null,
})),
skipDuplicates: true,
});
Expand Down
Loading