generated from Medici-Mansion/basic-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/SNP-70' into develop
- Loading branch information
Showing
13 changed files
with
165 additions
and
73 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,4 @@ | ||
import { Controller } from '@nestjs/common'; | ||
|
||
@Controller('answers') | ||
export class AnswerController {} |
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,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { AnswerService } from './answer.service'; | ||
import { AnswerController } from './answer.controller'; | ||
import { AnswerRepository } from './answer.repository'; | ||
|
||
@Module({ | ||
providers: [AnswerService, AnswerRepository], | ||
controllers: [AnswerController], | ||
}) | ||
export class AnswerModule {} |
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 @@ | ||
export class AnswerRepository {} |
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,4 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class AnswerService {} |
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,23 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsString, IsUUID } from 'class-validator'; | ||
|
||
export class CreateAnswerDto { | ||
@ApiProperty({ description: '보내는 사용자 닉네임', default: '홍길동' }) | ||
@IsString() | ||
senderNickname: string; | ||
|
||
@ApiProperty({ description: '받는 사용자 아이디', default: '{uuid}' }) | ||
@IsUUID() | ||
receiverId: string; | ||
|
||
@ApiProperty({ description: '받는 사용자 이름', default: '덕배' }) | ||
@IsString() | ||
receiverNickname: string; | ||
|
||
@ApiProperty({ | ||
description: '보낼 편지의 내용', | ||
default: '이 편지는 영국에서부터 시작되어..', | ||
}) | ||
@IsString() | ||
content: string; | ||
} |
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 @@ | ||
export class AnswerResponseDto {} |
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,36 @@ | ||
import { Column, Entity } from 'typeorm'; | ||
import { BaseEntity } from '../common/entities/base.entity'; | ||
|
||
@Entity({ name: 'answers' }) | ||
export class Answer extends BaseEntity { | ||
@Column({ | ||
name: 'sender_id', | ||
comment: '답장하는 사용자 아이디', | ||
nullable: true, | ||
}) | ||
senderId: string; | ||
|
||
@Column({ | ||
name: 'receiver_id', | ||
comment: '답장받는 사용자 아이디', | ||
nullable: false, | ||
}) | ||
receiverId: string; | ||
|
||
@Column({ | ||
name: 'sender_nickname', | ||
comment: '답장하는 사용자 닉네임', | ||
nullable: false, | ||
}) | ||
senderNickname: string; | ||
|
||
@Column({ | ||
name: 'receiver_nickname', | ||
comment: '답장받는 사용자 닉네임', | ||
nullable: false, | ||
}) | ||
receiverNickname: string; | ||
|
||
@Column({ name: 'content', comment: '답장 내용', nullable: false }) | ||
content: string; | ||
} |
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 |
---|---|---|
@@ -1,41 +1,37 @@ | ||
import { ApiProperty, PickType } from '@nestjs/swagger'; | ||
import { IsString, IsUUID } from 'class-validator'; | ||
import { LetterResponseDto } from './letter.response.dto'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsString } from 'class-validator'; | ||
import { Letter } from '../../entities/letter.entity'; | ||
|
||
export class PostLetterRequestDto { | ||
@ApiProperty({ description: '보내는 사용자 아이디' }) | ||
@IsUUID() | ||
senderId: string; | ||
|
||
@ApiProperty({ description: '보내는 사용자 닉네임' }) | ||
export class CreateLetterDto { | ||
@ApiProperty({ description: '보내는 사용자 닉네임', default: '홍길동' }) | ||
@IsString() | ||
senderNickname: string; | ||
|
||
@ApiProperty({ description: '받는 사용자 이름', default: '덕배' }) | ||
@IsString() | ||
receiverName: string; | ||
receiverNickname: string; | ||
|
||
@ApiProperty({ | ||
description: '보낼 편지의 내용', | ||
default: '이 편지는 영국에서부터 시작되어...', | ||
}) | ||
@IsString() | ||
content: string; | ||
|
||
@ApiProperty( { description: '고양이 타입', default: 'umu' }) | ||
@IsString() | ||
catType: string; | ||
} | ||
|
||
export function toEntity(postLetterRequestDto: PostLetterRequestDto): Letter { | ||
export function toEntity( | ||
userId: string, | ||
createLetterDto: CreateLetterDto, | ||
): Letter { | ||
const letter = new Letter(); | ||
letter.senderId = postLetterRequestDto.senderId; | ||
letter.senderNickname = postLetterRequestDto.senderNickname; | ||
letter.receiverName = postLetterRequestDto.receiverName; | ||
letter.content = postLetterRequestDto.content; | ||
letter.senderId = userId; | ||
letter.senderNickname = createLetterDto.senderNickname; | ||
letter.receiverNickname = createLetterDto.receiverNickname; | ||
letter.content = createLetterDto.content; | ||
letter.catType = createLetterDto.catType; | ||
return letter; | ||
} | ||
|
||
export class PostLetterResponseDto extends PickType(LetterResponseDto, ['id']) { | ||
constructor(id: string) { | ||
super(); | ||
this.id = id; | ||
} | ||
} |
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