Skip to content

[feat/image-marker]: 마커 생성 시 이미지 함께 저장 및 조회 응답에 포함#37

Merged
joojae02 merged 1 commit intomainfrom
feat/image-marker
Mar 19, 2026
Merged

[feat/image-marker]: 마커 생성 시 이미지 함께 저장 및 조회 응답에 포함#37
joojae02 merged 1 commit intomainfrom
feat/image-marker

Conversation

@joojae02
Copy link
Copy Markdown
Collaborator

관련 이슈

closes #이슈번호

작업 내용

변경 사항

  • [ ]
  • [ ]

테스트

  • 로컬에서 테스트 완료
  • 기존 기능 정상 동작 확인

리뷰어에게

@joojae02 joojae02 self-assigned this Mar 19, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 마커 생성 및 조회 기능에 이미지 첨부 기능을 통합합니다. 사용자가 마커를 생성할 때 관련 이미지를 함께 저장할 수 있게 하며, 이후 마커 정보를 조회할 때 해당 이미지들도 함께 응답에 포함되도록 개선되었습니다. 이는 사용자에게 더 풍부한 정보를 제공하고 데이터의 연관성을 강화하는 데 기여합니다.

Highlights

  • 마커 생성 시 이미지 저장 기능 추가: 마커 생성 요청 시 이미지 정보를 함께 받아 저장할 수 있도록 CreateMarkerDtoimages 필드를 추가하고, CreateMarkerImageDto를 정의하여 이미지 유효성 검사를 강화했습니다. marker.service.tscreate 메서드에 이미지 저장 로직이 추가되었습니다.
  • 마커 조회 응답에 이미지 정보 포함: 마커 조회 시 연관된 이미지 정보를 함께 반환하도록 ReportInMarkerDtoimages 필드를 추가하고, ImageInReportDto를 정의했습니다. marker.service.tsfindOnefindNearby 메서드에서 이미지 관계를 포함하도록 쿼리가 수정되었습니다.
  • 테스트 코드 내 HazardType enum 적용: 여러 테스트 파일(marker.controller.spec.ts, marker.service.spec.ts, report.controller.spec.ts, report.service.spec.ts)에서 위험 유형(hazardType)을 문자열 리터럴 대신 HazardType enum을 사용하도록 업데이트하여 코드의 일관성과 안정성을 높였습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@joojae02 joojae02 merged commit 76cabdb into main Mar 19, 2026
1 check passed
@joojae02 joojae02 deleted the feat/image-marker branch March 19, 2026 15:40
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이 PR은 마커 생성 시 이미지를 포함하는 기능을 성공적으로 추가하고 있습니다. 또한 마커 상세 정보 조회 시 응답에도 이미지가 포함됩니다. DTO 유효성 검사, 영속성을 위한 서비스 로직, 응답 구조 업데이트 등 변경 사항이 잘 구현되었습니다. 테스트 파일도 그에 맞게 업데이트되었습니다. 코드 가독성과 유지보수성을 개선하기 위한 몇 가지 제안 사항이 있습니다.

Comment on lines +20 to +38
const ALLOWED_MIME_TYPES = [
'image/jpeg',
'image/png',
'image/webp',
'image/gif',
] as const;

export class CreateMarkerImageDto {
@IsUrl()
url: string;

@IsIn(ALLOWED_MIME_TYPES)
mimeType: string;

@IsInt()
@Min(1)
@Max(10 * 1024 * 1024)
size: number;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

최대 이미지 크기를 나타내는 10 * 1024 * 1024는 매직 넘버입니다. 가독성과 유지보수성을 높이기 위해 상수로 정의하는 것이 좋습니다. 이렇게 하면 값이 무엇을 의미하는지 이해하기 쉽고, 나중에 변경해야 할 때 한 곳에서만 수정하면 됩니다.

const ALLOWED_MIME_TYPES = [
  'image/jpeg',
  'image/png',
  'image/webp',
  'image/gif',
] as const;

const MAX_IMAGE_SIZE_BYTES = 10 * 1024 * 1024; // 10MB

export class CreateMarkerImageDto {
  @IsUrl()
  url: string;

  @IsIn(ALLOWED_MIME_TYPES)
  mimeType: string;

  @IsInt()
  @Min(1)
  @Max(MAX_IMAGE_SIZE_BYTES)
  size: number;
}

Comment on lines +42 to +54
await manager
.createQueryBuilder()
.insert()
.into(Image)
.values(
dto.images.map((img) => ({
reportId,
url: img.url,
mimeType: img.mimeType,
size: img.size,
})),
)
.execute();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

간단한 삽입 작업의 경우, createQueryBuilder()를 사용하는 것보다 더 간결하고 가독성이 좋은 manager.insert()를 사용할 수 있습니다.

        await manager.insert(
          Image,
          dto.images.map((img) => ({
            reportId,
            url: img.url,
            mimeType: img.mimeType,
            size: img.size,
          })),
        );

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.

1 participant