Skip to content

Commit

Permalink
refactor: 코스/지도에 장소 추가 전 확인 메서드명 수정 #86
Browse files Browse the repository at this point in the history
  • Loading branch information
Miensoap committed Nov 11, 2024
1 parent 13f50e2 commit 04084ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/src/course/course.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class CourseService {
const course = await this.courseRepository.findById(id);
if (!course) throw new CourseNotFoundException(id);

await this.checkPlacesExist(
await this.validatePlacesForCourse(
setPlacesOfCourseRequest.places.map((p) => p.placeId),
);

Expand All @@ -131,7 +131,7 @@ export class CourseService {
};
}

private async checkPlacesExist(placeIds: number[]) {
private async validatePlacesForCourse(placeIds: number[]) {
const notExistsPlaceIds = await Promise.all(
placeIds.map(async (placeId) => {
const exists = await this.placeRepository.existById(placeId);
Expand Down
4 changes: 2 additions & 2 deletions backend/src/map/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class MapService {
) {
const map = await this.mapRepository.findById(id);
if (!map) throw new MapNotFoundException(id);
await this.checkPlaceCanAddToMap(placeId, map);
await this.validatePlacesForMap(placeId, map);

map.addPlace(placeId, color, comment);
await this.mapRepository.save(map);
Expand All @@ -124,7 +124,7 @@ export class MapService {
};
}

private async checkPlaceCanAddToMap(placeId: number, map: Map) {
private async validatePlacesForMap(placeId: number, map: Map) {
if (!(await this.placeRepository.existById(placeId))) {
throw new InvalidPlaceToMapException(placeId);
}
Expand Down

0 comments on commit 04084ad

Please sign in to comment.