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

Feat: Map API 수정 및 맛집 삭제 API, 키워드 저장 로직 추가 #34

Merged
merged 16 commits into from
Jul 7, 2024

Conversation

chanwoonglee
Copy link
Collaborator

@chanwoonglee chanwoonglee commented Jul 5, 2024

PR Type

  • Bugfix
  • Feature
  • Docs
  • Refactoring (no functional changes, no api changes)

For what purpose

ui에 맞춘 API 수정 및 MVP 기능 API 추가

Key changes

  • 지도 생성 API 수정
    • 서버에서 id 생성하도록 수정
  • 지도 정보 조회 수정
    • ui상 필요한 place 개수 return
  • 등록된 맛집 삭제 API 추가
  • 최근 검색한 키워드 저장 로직 추가
  • etc
    • exception filter 로직수정
    • jwt validate exception 추가
    • mikro-orm disable foreign key 설정 추가
    • mvp 이외 api나 사용하지 않는 api swagger hide

To reviewers

ui따라 바꿀게 많아서 테스트는 나중에..

Screenshots

sally0226 and others added 9 commits July 5, 2024 00:48
- invite link 생성 API 구현
    - invite-link module, service 생성
    - map controller에서 invite-link service 호출
- user-map 권한체크를 위한 guard 추가
- 지도 삭제 API는 soft delete vs hard delete 중에 선택이 필요하므로 우선 보류 (mvp 범위아님)
- 지도 생성
  - 서버에서 id 생성하도록 수정
- 지도 정보 조회
  - ui상 필요한 place 개수 return
- 등록된 맛집 삭제 API 추가
- 최근 검색한 키워드 저장 로직 추가
@chanwoonglee chanwoonglee requested review from saehun, sally0226 and Ho-s July 5, 2024 04:50
@chanwoonglee chanwoonglee changed the title Feat/add map api Feat: Map API 수정 및 맛집 삭제 API, 키워드 저장 로직 추가 Jul 5, 2024

@Property({ type: 'string' })
@Property({ type: 'string', unique: true })
Copy link
Collaborator

Choose a reason for hiding this comment

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

class validator로 unique 침범하면, 에러 메시지 커스텀하게 보여줄 수 있도록 하는 건 어떨까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

오~ 좋은데 한번 해볼게 감사링!

@@ -38,7 +38,7 @@ export class PlaceForMap {
})
likedUserIds: number[];

@OneToOne(() => User)
@ManyToOne(() => User)
Copy link
Collaborator

Choose a reason for hiding this comment

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

good

src/entities/user.entity.ts Show resolved Hide resolved
@@ -27,7 +28,7 @@ export class CustomExceptionFilter implements ExceptionFilter {
private readonly utilService: UtilService,
) {}

async catch(exception: Error, host: ArgumentsHost) {
async catch(exception: BaseException | Error, host: ArgumentsHost) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋㅋㅋㅋㅋ

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋ

id: payload.id,
});
if (!user) {
throw new UserNotFoundException();
Copy link
Collaborator

Choose a reason for hiding this comment

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

guard에 들어가는 strategy라서 unauth 로 날려주는 게 맞을 거 같은데, 404로 바꾼 이유가 잇을까여?

Copy link
Collaborator Author

@chanwoonglee chanwoonglee Jul 5, 2024

Choose a reason for hiding this comment

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

오이 jwt strategy에서 토큰이 유효하지 않는 경우는 401로 다 처리하고 있어서,
유효한 토큰에 유저가 없는 경우를 알려줄려고 404로 하고 유저 없다고 에러 메시지로 따로 적었어
401이 맞긴 하겠다 code만 401로 바꿀게!

@@ -30,6 +30,10 @@ const MikroOrmConfig: Options = {
entities: entities,
metadataProvider: ReflectMetadataProvider,
debug: utilService.isDev(),
schemaGenerator: {
disableForeignKeys: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

설명 구다사이!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

실제 DB에 foreignkey 안생기게 하는 옵션인데, mapID 타입 바꾸다가 constraint 계속 걸려서 화딱지가 나버림
그래서 일단 추가했는데 문제 생길게 있을까 ??

Copy link
Collaborator

Choose a reason for hiding this comment

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

외래키가 없을 떄 실무에서도 문제된 적 없지? 그때도 얘기 나왔던 거 같은데 그럼 컷!!!

Copy link
Member

Choose a reason for hiding this comment

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

화나지마 찬웅이형

Copy link
Collaborator

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

Copy link
Collaborator

@Ho-s Ho-s left a comment

Choose a reason for hiding this comment

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

발리데이터 너무 이쁘다 굿

@chanwoonglee chanwoonglee merged commit 0dfae8c into stage Jul 7, 2024
3 checks passed
@chanwoonglee chanwoonglee deleted the feat/add-map-api branch July 7, 2024 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants