Skip to content
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

Merged
merged 8 commits into from
Nov 5, 2024
Merged

지도 조회/생성/삭제 구현 #42

merged 8 commits into from
Nov 5, 2024

Conversation

Miensoap
Copy link
Collaborator

@Miensoap Miensoap commented Nov 5, 2024

📄 Summary

지도 C R D API 구현했습니다.
수정은 핀 등록이랑 연동해서 진행합시다~~ (#13 #14 #15)

ref

https://documenter.getpostman.com/view/29034241/2sAY4yeLr5 (postman 테스트)

🙋🏻 More

기능

  • 지도 조회 API 구현 (제목검색/내지도)
  • 지도 생성 API 구현
  • 지도 상세 조회 API 구현 (장소 포함)
  • SoftDeleteRepository , SoftDeletableEntity 추가

기타 / 설정

  • DDL 수정. 지도, 코스에 is_public 추가
  • ValidationPipe , transform 활성화 / entity 확장자 식별 수정
  • 임시 유저 모듈 구현

🕰️ Actual Time of Completion

3H

closes #21

@Miensoap Miensoap added BE 백엔드 관련 이슈입니다 🌱 기능추가 새로운 기능 요청입니다 👀 테스트 테스트를 작성하거나 수정합니다 labels Nov 5, 2024
@Miensoap Miensoap added this to the week2 milestone Nov 5, 2024
@Miensoap Miensoap self-assigned this Nov 5, 2024
@Miensoap Miensoap changed the title 지도 CRUD 구현 지도 조회/생성/삭제 구현 Nov 5, 2024
@Miensoap Miensoap marked this pull request as ready for review November 5, 2024 06:32
Copy link
Collaborator

@hyohyo12 hyohyo12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고했습니다!

Copy link
Collaborator

@koomchang koomchang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

Comment on lines +1 to +14
-- 무결성 제약 조건 비활성화
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;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: 테이블 초기화 용인가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞습니다!

Comment on lines +20 to +38
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,
);
}
Copy link
Collaborator

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 {
Copy link
Collaborator

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로 쓰더라구요! 물론 어떤 걸 쓰든 통일만하면 좋을 것 같아서 원하시는 의견 말씀주세요! 저도 큰 상관 없습니다!

Copy link
Collaborator Author

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 {
Copy link
Collaborator

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>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: @InjectRepository() 는 왜 필요한가요?

Copy link
Collaborator Author

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. 유저 기능 완성 후 교체
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: 무엇을 교체해야 하는건가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 실제 유저 대신 1번 아이디를 가지는 유저 하나를 (존재하지 않는다면) 만들어,
지도생성/내지도 기능에서 모든 지도의 주인으로 사용하고 있어요.

@Miensoap Miensoap merged commit 791001c into develop Nov 5, 2024
2 checks passed
@Miensoap Miensoap deleted the feature/#21 branch November 13, 2024 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 관련 이슈입니다 🌱 기능추가 새로운 기능 요청입니다 👀 테스트 테스트를 작성하거나 수정합니다
Projects
None yet
Development

Successfully merging this pull request may close these issues.

지도 조회/생성/삭제 API를 구현한다
3 participants