-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
지도 조회/생성/삭제 구현 #42
지도 조회/생성/삭제 구현 #42
Conversation
- soft delete 적용한 조회를 지원 - MapRepository 리팩터링
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
-- 무결성 제약 조건 비활성화 | ||
SET FOREIGN_KEY_CHECKS = 0; | ||
|
||
-- 기존 테이블 삭제 | ||
DROP TABLE IF EXISTS COURSE_PLACE; | ||
DROP TABLE IF EXISTS COURSE; | ||
DROP TABLE IF EXISTS MAP_PLACE; | ||
DROP TABLE IF EXISTS MAP; | ||
DROP TABLE IF EXISTS PLACE; | ||
DROP TABLE IF EXISTS USER; | ||
|
||
-- 무결성 제약 조건 재활성화 | ||
SET FOREIGN_KEY_CHECKS = 1; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: 테이블 초기화 용인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞습니다!
static from({ title, isPublic, description, thumbnailUrl }) { | ||
const form = new CreateMapForm(); | ||
form.title = title; | ||
form.isPublic = isPublic; | ||
form.description = description; | ||
form.thumbnailUrl = thumbnailUrl; | ||
|
||
return form; | ||
} | ||
|
||
toEntity(user: User) { | ||
return new Map( | ||
user, | ||
this.title, | ||
this.isPublic, | ||
this.thumbnailUrl, | ||
this.description, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
import { PlaceResponse } from '../../place/dto/PlaceResponse'; | ||
import { DEFAULT_THUMBNAIL_URL } from './MapListResponse'; | ||
|
||
export class MapDetailResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: DTO
네이밍은 Response
, Request
로 통일할가요? 이전에 작업한게 Dto
로 저장을 해뒀어서 한쪽으로 통일하는게 좋을 것 같습니다!
저도 원래 Response
, Request
로 썼었는데
https://docs.nestjs.com/recipes/crud-generator#generating-a-new-resource
공식문서에서는 Dto
로 쓰더라구요! 물론 어떤 걸 쓰든 통일만하면 좋을 것 같아서 원하시는 의견 말씀주세요! 저도 큰 상관 없습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
음 저는 aaaResponseDTO
or aaaResponse
가 좋아 보여요!
의미와 사용처가 잘 보이면 좋겠다고 생각해서요.
말씀주신 두 가지 중에서는 전자를 선호합니다~
@@ -0,0 +1,33 @@ | |||
import { Place } from '../place.entity'; | |||
|
|||
export class PlaceResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 이미 바꿔두셨군요 ㅎㅎ 좋습니다
export class MapService { | ||
constructor( | ||
private readonly mapRepository: MapRepository, | ||
@InjectRepository(User) private readonly userRepository: Repository<User>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: @InjectRepository()
는 왜 필요한가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 실제 유저 대신 1번 아이디를 가지는 유저 하나를 (존재하지 않는다면) 만들어,
지도생성/내지도 기능에서 모든 지도의 주인으로 사용하고 있어요.
그 과정에서 유저 레포지토리에 대한 의존성을 임시로 두었습니다~~
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { Module } from '@nestjs/common'; | ||
|
||
// Todo. 유저 기능 완성 후 교체 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: 무엇을 교체해야 하는건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 실제 유저 대신 1번 아이디를 가지는 유저 하나를 (존재하지 않는다면) 만들어,
지도생성/내지도 기능에서 모든 지도의 주인으로 사용하고 있어요.
📄 Summary
ref
https://documenter.getpostman.com/view/29034241/2sAY4yeLr5 (postman 테스트)
🙋🏻 More
기능
기타 / 설정
🕰️ Actual Time of Completion
closes #21