diff --git a/backend/src/course/CourseRepository.ts b/backend/src/course/CourseRepository.ts index 9a2e8532..8c9bf0a5 100644 --- a/backend/src/course/CourseRepository.ts +++ b/backend/src/course/CourseRepository.ts @@ -66,7 +66,7 @@ export class CourseRepository extends SoftDeleteRepository { return this.update(id, { title, description, thumbnailUrl }); } - async updateCoursePlaceById(course: Course) { + async updatePins(course: Course) { await this.coursePlaceRepository .createQueryBuilder() .delete() @@ -77,7 +77,7 @@ export class CourseRepository extends SoftDeleteRepository { .createQueryBuilder() .insert() .into(CoursePlace) - .values(course.coursePlaces) + .values(course.pins) .orUpdate(['order'], ['course_id', 'place_id']) .execute(); } diff --git a/backend/src/course/CourseService.ts b/backend/src/course/CourseService.ts index ec931ff4..1fcdb3d8 100644 --- a/backend/src/course/CourseService.ts +++ b/backend/src/course/CourseService.ts @@ -9,7 +9,7 @@ import { import { PagedCourseResponse } from '@src/course/dto/PagedCourseResponse'; import { CreateCourseRequest } from '@src/course/dto/CreateCourseRequest'; import { UpdateCourseInfoRequest } from '@src/course/dto/UpdateCourseInfoRequest'; -import { UpdatePinsOfCourseRequest } from '@src/course/dto/AddPlaceToCourseRequest'; +import { UpdatePinsOfCourseRequest } from '@src/course/dto/UpdatePinsOfCourseRequest'; import { CourseNotFoundException } from '@src/course/exception/CourseNotFoundException'; import { PlaceRepository } from '@src/place/PlaceRepository'; import { InvalidPlaceToCourseException } from '@src/course/exception/InvalidPlaceToCourseException'; @@ -102,18 +102,13 @@ export class CourseService { } @Transactional() - async updatePins( - id: number, - setPlacesOfCourseRequest: UpdatePinsOfCourseRequest, - ) { + async updatePins(id: number, request: UpdatePinsOfCourseRequest) { const course = await this.getCourseOrElseThrowNotFound(id); - await this.validatePlacesForCourse( - setPlacesOfCourseRequest.places.map((p) => p.placeId), - ); + await this.validatePlacesForCourse(request.pins.map((pin) => pin.placeId)); - course.setPlaces(setPlacesOfCourseRequest.places); - await this.courseRepository.updateCoursePlaceById(course); + course.setPins(request.pins); + await this.courseRepository.updatePins(course); const reloadedCourse = await this.courseRepository.findById(course.id); return { @@ -125,7 +120,7 @@ export class CourseService { async updatePin(id: number, placeId: number, comment?: string) { const course = await this.getCourseOrElseThrowNotFound(id); - course.updatePlace(placeId, comment); + course.updatePin(placeId, comment); return this.courseRepository.save(course); } diff --git a/backend/src/course/dto/CourseDetailResponse.ts b/backend/src/course/dto/CourseDetailResponse.ts index b71d921e..080db74e 100644 --- a/backend/src/course/dto/CourseDetailResponse.ts +++ b/backend/src/course/dto/CourseDetailResponse.ts @@ -35,7 +35,7 @@ export class CourseDetailResponse { } export async function getPlacesResponseOfCourseWithOrder(course: Course) { - return (await course.getPlacesWithComment()).map((place, index) => { + return (await course.getPinsWithComment()).map((place, index) => { return { ...PlaceListResponse.from(place.place), comment: place.comment, diff --git a/backend/src/course/entity/Course.ts b/backend/src/course/entity/Course.ts index 6648e3f4..43d1091c 100644 --- a/backend/src/course/entity/Course.ts +++ b/backend/src/course/entity/Course.ts @@ -2,7 +2,7 @@ import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm'; import { BaseEntity } from '@src/common/BaseEntity'; import { User } from '@src/user/entity/User'; import { CoursePlace } from '@src/course/entity/CoursePlace'; -import { SetPlacesOfCourseRequestItem } from '@src/course/dto/AddPlaceToCourseRequest'; +import { UpdatePinsOfCourseRequestItem } from '@src/course/dto/UpdatePinsOfCourseRequest'; import { PlaceInCourseNotFoundException } from '@src/course/exception/PlaceInCourseNotFoundException'; @Entity() @@ -31,7 +31,7 @@ export class Course extends BaseEntity { eager: true, cascade: true, }) - coursePlaces: CoursePlace[]; + pins: CoursePlace[]; constructor( user: User, @@ -49,39 +49,37 @@ export class Course extends BaseEntity { } get pinCount() { - if (!this.coursePlaces) return 0; - return this.coursePlaces.length; + if (!this.pins) return 0; + return this.pins.length; } - setPlaces(coursePlaces: SetPlacesOfCourseRequestItem[]) { - this.coursePlaces = coursePlaces.map((item, index) => { + setPins(pins: UpdatePinsOfCourseRequestItem[]) { + this.pins = pins.map((item, index) => { return CoursePlace.of(index + 1, item.placeId, this, item.comment); }); } - getPlace(placeId: number) { - const coursePlace = this.coursePlaces.find( - (coursePlace) => coursePlace.placeId === placeId, - ); - if (!coursePlace) { + getPin(placeId: number) { + const pin = this.pins.find((pin) => pin.placeId === placeId); + if (!pin) { throw new PlaceInCourseNotFoundException(this.id, placeId); } - return coursePlace; + return pin; } - updatePlace(placeId: number, comment?: string) { - const updated = this.getPlace(placeId).update(comment); - this.coursePlaces = this.coursePlaces.map((coursePlace) => - coursePlace.placeId === placeId ? updated : coursePlace, + updatePin(placeId: number, comment?: string) { + const updated = this.getPin(placeId).update(comment); + this.pins = this.pins.map((pin) => + pin.placeId === placeId ? updated : pin, ); } - async getPlacesWithComment() { - const coursePlaces = this.coursePlaces.sort((a, b) => a.order - b.order); + async getPinsWithComment() { + const pins = this.pins.sort((a, b) => a.order - b.order); return await Promise.all( - coursePlaces.map(async (coursePlace) => ({ - place: await coursePlace.place, - comment: coursePlace.description, + pins.map(async (pin) => ({ + place: await pin.place, + comment: pin.description, })), ); } diff --git a/backend/src/course/pipes/IsNotConsecutiveDuplicatePlace.ts b/backend/src/course/pipes/IsNotConsecutiveDuplicatePlace.ts index c4d129b5..c4e5c7b7 100644 --- a/backend/src/course/pipes/IsNotConsecutiveDuplicatePlace.ts +++ b/backend/src/course/pipes/IsNotConsecutiveDuplicatePlace.ts @@ -2,14 +2,14 @@ import { ValidatorConstraint, ValidatorConstraintInterface, } from 'class-validator'; -import { SetPlacesOfCourseRequestItem } from '@src/course/dto/AddPlaceToCourseRequest'; +import { UpdatePinsOfCourseRequestItem } from '@src/course/dto/UpdatePinsOfCourseRequest'; import { ConsecutivePlaceException } from '@src/course/exception/ConsecutivePlaceException'; @ValidatorConstraint({ name: 'isNotConsecutiveDuplicatePlace', async: false }) export class IsNotConsecutiveDuplicatePlace implements ValidatorConstraintInterface { - validate(places: SetPlacesOfCourseRequestItem[]) { + validate(places: UpdatePinsOfCourseRequestItem[]) { for (let i = 1; i < places.length; i++) { if (places[i].placeId === places[i - 1].placeId) { throw new ConsecutivePlaceException(); diff --git a/backend/src/map/MapController.ts b/backend/src/map/MapController.ts index 54b09416..0fb027e4 100644 --- a/backend/src/map/MapController.ts +++ b/backend/src/map/MapController.ts @@ -15,7 +15,7 @@ import { CreateMapRequest } from '@src/map/dto/CreateMapRequest'; import { UpdateMapInfoRequest } from '@src/map/dto/UpdateMapInfoRequest'; import { AddPinToMapRequest } from '@src/map/dto/AddPinToMapRequest'; import { UpdateMapVisibilityRequest } from '@src/map/dto/UpdateMapVisibilityRequest'; -import { UpdatePinInMapRequest } from '@src/map/dto/UpdatePinInMapRequest'; +import { UpdatePinInfoInMapRequest } from '@src/map/dto/UpdatePinInfoInMapRequest'; import { ParseOptionalNumberPipe } from '@src/common/pipe/ParseOptionalNumberPipe'; import { MapPermissionGuard } from '@src/map/guards/MapPermissionGuard'; import { EmptyRequestException } from '@src/common/exception/EmptyRequestException'; @@ -60,26 +60,26 @@ export class MapController { @UseGuards(JwtAuthGuard, MapPermissionGuard) @Post('/:id/places') - async addPlaceToMap( + async addPinToMap( @Param('id') id: number, @Body() addPinToMapRequest: AddPinToMapRequest, ) { - return await this.mapService.addPlace(id, addPinToMapRequest); + return await this.mapService.addPin(id, addPinToMapRequest); } @UseGuards(JwtAuthGuard, MapPermissionGuard) @Put('/:id/places/:placeId') - async updatePinInMap( + async updatePinInfoInMap( @Param('id') id: number, @Param('placeId') placeId: number, - @Body() updatePinInMapRequest: UpdatePinInMapRequest, + @Body() updatePinInfoInMapRequest: UpdatePinInfoInMapRequest, ) { - if (updatePinInMapRequest.isEmpty()) { + if (updatePinInfoInMapRequest.isEmpty()) { throw new EmptyRequestException(); } - await this.mapService.updatePin(id, placeId, updatePinInMapRequest); - return { mapId: id, placeId, ...updatePinInMapRequest }; + await this.mapService.updatePin(id, placeId, updatePinInfoInMapRequest); + return { mapId: id, placeId, ...updatePinInfoInMapRequest }; } @UseGuards(JwtAuthGuard, MapPermissionGuard) diff --git a/backend/src/map/MapService.ts b/backend/src/map/MapService.ts index fb1b0f13..76b7f4af 100644 --- a/backend/src/map/MapService.ts +++ b/backend/src/map/MapService.ts @@ -13,7 +13,7 @@ import { InvalidPlaceToMapException } from '@src/map/exception/InvalidPlaceToMap import { User } from '@src/user/entity/User'; import { PlaceRepository } from '@src/place/PlaceRepository'; import { AddPinToMapRequest } from '@src/map/dto/AddPinToMapRequest'; -import { UpdatePinInMapRequest } from '@src/map/dto/UpdatePinInMapRequest'; +import { UpdatePinInfoInMapRequest } from '@src/map/dto/UpdatePinInfoInMapRequest'; import { UpdateMapVisibilityRequest } from '@src/map/dto/UpdateMapVisibilityRequest'; @Injectable() @@ -104,13 +104,13 @@ export class MapService { return this.mapRepository.update(id, { isPublic: visibility.isPublic }); } - async addPlace(id: number, pinInfo: AddPinToMapRequest) { + async addPin(id: number, pinInfo: AddPinToMapRequest) { const { placeId, color, comment } = pinInfo; const map = await this.mapRepository.findById(id); if (!map) throw new MapNotFoundException(id); await this.validatePlacesForMap(placeId, map); - map.addPlace(placeId, color, comment); + map.addPin(placeId, color, comment); await this.mapRepository.save(map); return { @@ -121,10 +121,14 @@ export class MapService { } @Transactional() - async updatePin(id: number, placeId: number, pinInfo: UpdatePinInMapRequest) { + async updatePin( + id: number, + placeId: number, + pinInfo: UpdatePinInfoInMapRequest, + ) { const { color, comment } = pinInfo; const map = await this.getMapOrElseThrowNotFound(id); - map.updatePlace(placeId, color, comment); + map.updatePin(placeId, color, comment); return this.mapRepository.save(map); } @@ -132,7 +136,7 @@ export class MapService { async deletePin(id: number, placeId: number) { const map = await this.getMapOrElseThrowNotFound(id); - map.deletePlace(placeId); + map.deletePin(placeId); await this.mapRepository.save(map); return { deletedId: placeId }; diff --git a/backend/src/map/dto/MapDetailResponse.ts b/backend/src/map/dto/MapDetailResponse.ts index bddb1c81..5672291d 100644 --- a/backend/src/map/dto/MapDetailResponse.ts +++ b/backend/src/map/dto/MapDetailResponse.ts @@ -18,7 +18,7 @@ export class MapDetailResponse { ) {} static async from(map: Map) { - const places = (await map.getPlacesWithComment()).map((place) => { + const places = (await map.getPinsWithComment()).map((place) => { return { ...PlaceListResponse.from(place.place), comment: place.comment, diff --git a/backend/src/map/dto/UpdatePinInMapRequest.ts b/backend/src/map/dto/UpdatePinInfoInMapRequest.ts similarity index 87% rename from backend/src/map/dto/UpdatePinInMapRequest.ts rename to backend/src/map/dto/UpdatePinInfoInMapRequest.ts index 0d3cf556..a6eda818 100644 --- a/backend/src/map/dto/UpdatePinInMapRequest.ts +++ b/backend/src/map/dto/UpdatePinInfoInMapRequest.ts @@ -1,7 +1,7 @@ import { IsEnum, IsOptional, IsString } from 'class-validator'; import { Color } from '@src/place/enum/Color'; -export class UpdatePinInMapRequest { +export class UpdatePinInfoInMapRequest { @IsOptional() @IsEnum(Color) color?: Color; diff --git a/backend/src/map/entity/Map.ts b/backend/src/map/entity/Map.ts index 161295ea..0489c9e6 100644 --- a/backend/src/map/entity/Map.ts +++ b/backend/src/map/entity/Map.ts @@ -30,7 +30,7 @@ export class Map extends BaseEntity { eager: true, cascade: true, }) - mapPlaces: MapPlace[]; + pins: MapPlace[]; constructor( user: User, @@ -48,43 +48,43 @@ export class Map extends BaseEntity { } get pinCount() { - return this.mapPlaces.length; + return this.pins.length; } - addPlace(placeId: number, color: Color, description: string) { - this.mapPlaces.push(MapPlace.of(placeId, this, color, description)); + addPin(placeId: number, color: Color, description: string) { + this.pins.push(MapPlace.of(placeId, this, color, description)); } - getPlace(placeId: number) { - const mapPlace = this.mapPlaces.find((p) => p.placeId === placeId); - if (!mapPlace) throw new PlaceInMapNotFoundException(this.id, placeId); + getPin(placeId: number) { + const pin = this.pins.find((p) => p.placeId === placeId); + if (!pin) throw new PlaceInMapNotFoundException(this.id, placeId); - return mapPlace; + return pin; } - async getPlacesWithComment() { + async getPinsWithComment() { return await Promise.all( - this.mapPlaces.map(async (mapPlace) => ({ - place: await mapPlace.place, - comment: mapPlace.description, - color: mapPlace.color, + this.pins.map(async (pin) => ({ + place: await pin.place, + comment: pin.description, + color: pin.color, })), ); } hasPlace(placeId: number) { - return this.mapPlaces.some((p) => p.placeId === placeId); + return this.pins.some((p) => p.placeId === placeId); } - updatePlace(placeId: number, color?: Color, comment?: string) { - const updated = this.getPlace(placeId).update(color, comment); + updatePin(placeId: number, color?: Color, comment?: string) { + const updated = this.getPin(placeId).update(color, comment); - this.mapPlaces = this.mapPlaces.map((mapPlace) => - mapPlace.placeId === placeId ? updated : mapPlace, + this.pins = this.pins.map((pin) => + pin.placeId === placeId ? updated : pin, ); } - deletePlace(placeId: number) { - this.mapPlaces = this.mapPlaces.filter((p) => p.placeId !== placeId); + deletePin(placeId: number) { + this.pins = this.pins.filter((p) => p.placeId !== placeId); } } diff --git a/backend/src/map/entity/MapPlace.ts b/backend/src/map/entity/MapPlace.ts index 65fff67a..bb350086 100644 --- a/backend/src/map/entity/MapPlace.ts +++ b/backend/src/map/entity/MapPlace.ts @@ -13,7 +13,7 @@ export class MapPlace extends BaseEntity { @JoinColumn({ name: 'place_id' }) place: Promise; - @ManyToOne(() => Map, (map) => map.mapPlaces, { + @ManyToOne(() => Map, (map) => map.pins, { onDelete: 'CASCADE', orphanedRowAction: 'delete', }) diff --git a/backend/test/course/course.service.test.ts b/backend/test/course/course.service.test.ts index 500e525e..36a7cea3 100644 --- a/backend/test/course/course.service.test.ts +++ b/backend/test/course/course.service.test.ts @@ -11,8 +11,8 @@ import { CreateCourseRequest } from '@src/course/dto/CreateCourseRequest'; import { UpdateCourseInfoRequest } from '@src/course/dto/UpdateCourseInfoRequest'; import { UpdatePinsOfCourseRequest, - SetPlacesOfCourseRequestItem, -} from '@src/course/dto/AddPlaceToCourseRequest'; + UpdatePinsOfCourseRequestItem, +} from '@src/course/dto/UpdatePinsOfCourseRequest'; import { InvalidPlaceToCourseException } from '@src/course/exception/InvalidPlaceToCourseException'; import { initializeTransactionalContext } from 'typeorm-transactional'; import { MySqlContainer, StartedMySqlContainer } from '@testcontainers/mysql'; @@ -316,12 +316,12 @@ describe('CourseService', () => { describe('코스에 장소를 추가할 때', () => { const setPlacesOfCourseRequest = { - places: [ + pins: [ { placeId: 1, comment: 'A popular place', }, - ] as SetPlacesOfCourseRequestItem[], + ] as UpdatePinsOfCourseRequestItem[], } as UpdatePinsOfCourseRequest; it('코스가 존재하지 않으면 예외를 던진다', async () => { diff --git a/backend/test/map/integration-test/map.integration.test.ts b/backend/test/map/integration-test/map.integration.test.ts index ba8b5dec..6e9f1b3f 100644 --- a/backend/test/map/integration-test/map.integration.test.ts +++ b/backend/test/map/integration-test/map.integration.test.ts @@ -170,8 +170,8 @@ describe('MapController 통합 테스트', () => { const publicMapsWithPlace = createPublicMaps(3, fakeUser1); const privateMaps = createPrivateMaps(5, fakeUser1); publicMapsWithPlace.forEach((publicMapWithPlace) => { - publicMapWithPlace.mapPlaces = []; - publicMapWithPlace.mapPlaces.push( + publicMapWithPlace.pins = []; + publicMapWithPlace.pins.push( MapPlace.of(1, publicMapWithPlace, Color.RED, 'test'), ); }); @@ -215,13 +215,13 @@ describe('MapController 통합 테스트', () => { ); const privateMaps = createPrivateMaps(5, fakeUser1); publicMapsWithCoolTitleAndPlace.forEach((publicMapWithPlace) => { - publicMapWithPlace.mapPlaces = []; - publicMapWithPlace.mapPlaces.push( + publicMapWithPlace.pins = []; + publicMapWithPlace.pins.push( MapPlace.of(1, publicMapWithPlace, Color.RED, 'test'), ); }); publicMapsWithCoolTitle.forEach((publicMap) => { - publicMap.mapPlaces = []; + publicMap.pins = []; }); const publicMaps = [ ...publicMapsWithCoolTitle, @@ -457,7 +457,7 @@ describe('MapController 통합 테스트', () => { color: 'BLUE', } as AddPinToMapRequest; - await mapService.addPlace(1, testPlace); + await mapService.addPin(1, testPlace); const fakeUserInfo = await userRepository.findById(fakeUser1Id); payload = { @@ -556,7 +556,7 @@ describe('MapController 통합 테스트', () => { color: 'BLUE', } as AddPinToMapRequest; - await mapService.addPlace(1, testPlace); + await mapService.addPin(1, testPlace); return request(app.getHttpServer()) .post('/maps/1/places') @@ -635,7 +635,7 @@ describe('MapController 통합 테스트', () => { color: 'BLUE', } as AddPinToMapRequest; - await mapService.addPlace(1, testPlace); + await mapService.addPin(1, testPlace); payload = { userId: fakeUserOneInfo.id, @@ -693,7 +693,7 @@ describe('MapController 통합 테스트', () => { }), ); const map = await mapRepository.findById(1); - expect(map.mapPlaces.length).toBe(0); + expect(map.pins.length).toBe(0); }); }); }); @@ -712,7 +712,7 @@ describe('MapController 통합 테스트', () => { color: 'BLUE', } as AddPinToMapRequest; - await mapService.addPlace(1, testPlace); + await mapService.addPin(1, testPlace); const fakeUserInfo = await userRepository.findById(fakeUser1Id); payload = { @@ -854,7 +854,7 @@ describe('MapController 통합 테스트', () => { color: 'BLUE', } as AddPinToMapRequest; - await mapService.addPlace(1, testPlace); + await mapService.addPin(1, testPlace); const fakeUserInfo = await userRepository.findById(fakeUser1Id); payload = { diff --git a/backend/test/map/map.repository.test.ts b/backend/test/map/map.repository.test.ts index 9eef95ab..9503f17e 100644 --- a/backend/test/map/map.repository.test.ts +++ b/backend/test/map/map.repository.test.ts @@ -153,12 +153,12 @@ describe('MapRepository', () => { const privateMapsWithPlaces = createPrivateMaps(5, fakeUser1); publicMapsWithPlaces.forEach((publicMapWithPlaces) => { - publicMapWithPlaces.mapPlaces = [ + publicMapWithPlaces.pins = [ MapPlace.of(1, publicMapWithPlaces, Color.RED, 'test'), ]; }); privateMapsWithPlaces.forEach((privateMapsWithPlaces) => { - privateMapsWithPlaces.mapPlaces = [ + privateMapsWithPlaces.pins = [ MapPlace.of(1, privateMapsWithPlaces, Color.RED, 'test'), ]; }); @@ -171,7 +171,7 @@ describe('MapRepository', () => { const expectedMaps = mapEntities.slice(5, 10).map((map) => { return { ...map, - mapPlaces: map.mapPlaces.map((place) => { + mapPlaces: map.pins.map((place) => { return { color: place.color, createdAt: place.createdAt, @@ -200,12 +200,12 @@ describe('MapRepository', () => { const privateMapsWithPlaces = createPrivateMaps(5, fakeUser1); publicMapsWithPlaces.forEach((publicMapWithPlaces) => { - publicMapWithPlaces.mapPlaces = [ + publicMapWithPlaces.pins = [ MapPlace.of(1, publicMapWithPlaces, Color.RED, 'test'), ]; }); privateMapsWithPlaces.forEach((privateMapsWithPlaces) => { - privateMapsWithPlaces.mapPlaces = [ + privateMapsWithPlaces.pins = [ MapPlace.of(1, privateMapsWithPlaces, Color.RED, 'test'), ]; }); @@ -252,7 +252,7 @@ describe('MapRepository', () => { await mapRepository.save(publicFirstUsers); const expectedMaps = publicFirstUsers.slice(20, 25); expectedMaps.forEach((expectedMap) => { - expectedMap.mapPlaces = []; + expectedMap.pins = []; }); const firstUsersFifthPage = await mapRepository.findByUserId( diff --git a/backend/test/map/map.service.test.ts b/backend/test/map/map.service.test.ts index 09377d2f..bf9377e1 100644 --- a/backend/test/map/map.service.test.ts +++ b/backend/test/map/map.service.test.ts @@ -121,7 +121,7 @@ describe('MapService 테스트', () => { ); const savedMaps = await mapRepository.save([...publicMapsWithTitle]); savedMaps.forEach((mapEntity) => { - mapEntity.mapPlaces = []; + mapEntity.pins = []; }); const expectedMaps = await Promise.all( savedMaps.map((savedMap) => MapListResponse.from(savedMap)), @@ -143,7 +143,7 @@ describe('MapService 테스트', () => { const publicMapsWithPlaces = createPublicMaps(2, fakeUser1); const privateMaps = createPrivateMaps(5, fakeUser1); publicMapsWithPlaces.forEach((publicMapWithPlaces) => { - publicMapWithPlaces.mapPlaces = [ + publicMapWithPlaces.pins = [ MapPlace.of(1, publicMapWithPlaces, Color.RED, 'test'), ]; }); @@ -174,7 +174,7 @@ describe('MapService 테스트', () => { it('유저 아이디를 파라미터로 받아서 해당 유저의 지도를 반환한다.', async () => { const fakeUserMaps = createPublicMaps(5, fakeUser1); const savedMaps = await mapRepository.save([...fakeUserMaps]); - savedMaps.forEach((savedMap) => (savedMap.mapPlaces = [])); + savedMaps.forEach((savedMap) => (savedMap.pins = [])); const expectedMaps = await Promise.all( fakeUserMaps.map((fakeUserMap) => MapListResponse.from(fakeUserMap)), ); @@ -197,7 +197,7 @@ describe('MapService 테스트', () => { it('파라미터로 받은 mapId 로 지도를 찾은 결과가 있으면 결과를 반환한다.', async () => { const publicMap = createPublicMaps(1, fakeUser1)[0]; const publicMapEntity = await mapRepository.save(publicMap); - publicMapEntity.mapPlaces = []; + publicMapEntity.pins = []; const expectedMap = await MapDetailResponse.from(publicMapEntity); const result = await mapService.getMap(publicMapEntity.id); @@ -293,7 +293,7 @@ describe('MapService 테스트', () => { it('장소를 추가하려는 지도가 없을 경우 MapNotFoundException 을 발생시킨다.', async () => { const pinInfo = new AddPinToMapRequest(2, 'test', Color.BLUE); - await expect(mapService.addPlace(1, pinInfo)).rejects.toThrow( + await expect(mapService.addPin(1, pinInfo)).rejects.toThrow( MapNotFoundException, ); }); @@ -303,7 +303,7 @@ describe('MapService 테스트', () => { await mapRepository.save(publicMap); const pinInfo = new AddPinToMapRequest(777777, 'test', Color.BLUE); - await expect(mapService.addPlace(1, pinInfo)).rejects.toThrow( + await expect(mapService.addPin(1, pinInfo)).rejects.toThrow( InvalidPlaceToMapException, ); }); @@ -314,8 +314,8 @@ describe('MapService 테스트', () => { const alreadyAddPlace: Place = await placeRepository.findById( publicMapEntity.id, ); - publicMapEntity.mapPlaces = []; - publicMapEntity.addPlace(alreadyAddPlace.id, Color.RED, 'test'); + publicMapEntity.pins = []; + publicMapEntity.addPin(alreadyAddPlace.id, Color.RED, 'test'); await mapRepository.save(publicMapEntity); const pinInfo = new AddPinToMapRequest( @@ -324,7 +324,7 @@ describe('MapService 테스트', () => { Color.BLUE, ); - await expect(mapService.addPlace(1, pinInfo)).rejects.toThrow( + await expect(mapService.addPin(1, pinInfo)).rejects.toThrow( DuplicatePlaceToMapException, ); }); @@ -335,7 +335,7 @@ describe('MapService 테스트', () => { const addPlace = await placeRepository.findById(savedMap.id); const pinInfo = new AddPinToMapRequest(addPlace.id, 'test', Color.RED); - const result = await mapService.addPlace(1, pinInfo); + const result = await mapService.addPin(1, pinInfo); expect(result).toEqual(expect.objectContaining(pinInfo)); });