-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 웹소켓 API 중 서버에서 클라이언트에게 응답/알림하는 DTO 구현
- Loading branch information
1 parent
193ed66
commit 1d79137
Showing
16 changed files
with
172 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Link { | ||
id: number; | ||
url: string; | ||
description: string; | ||
} | ||
|
||
export class LinkCreateNotifyDto { | ||
domain: string; | ||
action: string; | ||
content: Link; | ||
|
||
static of(id: number, url: string, description: string) { | ||
const dto = new LinkCreateNotifyDto(); | ||
dto.domain = 'link'; | ||
dto.action = 'create'; | ||
dto.content = { id, url, description }; | ||
return dto; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Link { | ||
id: number; | ||
} | ||
|
||
export class LinkDeleteNotifyDto { | ||
domain: string; | ||
action: string; | ||
content: Link; | ||
|
||
static of(id: number) { | ||
const dto = new LinkDeleteNotifyDto(); | ||
dto.domain = 'link'; | ||
dto.action = 'delete'; | ||
dto.content = { id }; | ||
return dto; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { MemberStatus } from "../../enum/MemberStatus.enum"; | ||
|
||
class Member{ | ||
id: number; | ||
status: MemberStatus; | ||
} | ||
|
||
export class MemberUpdateNotifyDto { | ||
domain: string; | ||
action: string; | ||
content: Member; | ||
static of(id: number, status: MemberStatus){ | ||
const dto = new MemberUpdateNotifyDto(); | ||
dto.domain = 'member'; | ||
dto.action = 'update'; | ||
dto.content = {id, status}; | ||
return dto; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { memoColor } from "../../entity/memo.entity"; | ||
|
||
class Memo{ | ||
id: number; | ||
color: memoColor; | ||
} | ||
|
||
export class MemoColorUpdateNotifyDto { | ||
domain: string; | ||
action: string; | ||
content: Memo; | ||
static of(id: number, color: memoColor){ | ||
const dto = new MemoColorUpdateNotifyDto(); | ||
dto.domain = 'memo'; | ||
dto.action = 'colorUpdate'; | ||
dto.content = {id, color}; | ||
return dto; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Memo, memoColor } from '../../entity/memo.entity'; | ||
|
||
class MemoDto { | ||
id: number; | ||
title: string; | ||
content: string; | ||
createdAt: Date; | ||
author: string; | ||
color: memoColor; | ||
} | ||
|
||
export class MemoCreateNotifyDto { | ||
domain: string; | ||
action: string; | ||
content: MemoDto; | ||
static of(memo: Memo, author: string) { | ||
const dto = new MemoCreateNotifyDto(); | ||
dto.domain = 'memo'; | ||
dto.action = 'create'; | ||
const { id, title, content, color } = memo; | ||
dto.content = { | ||
id, | ||
title, | ||
content, | ||
color, | ||
createdAt: memo.created_at, | ||
author, | ||
}; | ||
return dto; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../src/project/dto/MemoCreateRequest.dto.ts → ...project/dto/memo/MemoCreateRequest.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Memo { | ||
id: number; | ||
} | ||
|
||
export class MemoDeleteNotifyDto { | ||
domain: string; | ||
action: string; | ||
content: Memo; | ||
static of(id: number) { | ||
const dto = new MemoDeleteNotifyDto(); | ||
dto.domain = 'memo'; | ||
dto.action = 'delete'; | ||
dto.content = { id }; | ||
return dto; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters