Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async updateById(placeId: string, place: string, placeImg?: Express.Multer.File): Promise<IExtendedPlace> {
- const existingPlace = await this.retriveById(placeId);
- const placeIndex = this.findPlaceIndex(placeId);
- if(!existingPlace || (placeIndex < 0)) {
- return undefined;
- }
- const basicPlace: IBasicPlace = this.toBasicPlace(place);
- Object.assign(existingPlace, basicPlace);
- if(placeImg){
- const imagePath: string = await this.storeImageInDisk(placeId, basicPlace.name, placeImg);
- existingPlace.image = imagePath;
- }
- this.places[placeIndex] = existingPlace;
- return existingPlace;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement