BugFix deletion of prop images
This commit is contained in:
parent
f51a298227
commit
492c03c2be
|
|
@ -59,16 +59,16 @@ export class ImageController {
|
||||||
return await this.fileService.getCompanyLogosForUsers(userids);
|
return await this.fileService.getCompanyLogosForUsers(userids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete('propertyPicture/:listingid/:imagename')
|
@Delete('propertyPicture/:imagePath/:imagename')
|
||||||
async deletePropertyImagesById(@Param('listingid') listingid: string, @Param('imagename') imagename: string): Promise<any> {
|
async deletePropertyImagesById(@Param('imagePath') imagePath: string, @Param('imagename') imagename: string): Promise<any> {
|
||||||
this.fileService.deleteImage(`pictures/property/${listingid}/${imagename}`);
|
this.fileService.deleteImage(`pictures/property/${imagePath}/${imagename}`);
|
||||||
}
|
}
|
||||||
@Delete('logo/:userid/')
|
@Delete('logo/:userid/')
|
||||||
async deleteLogoImagesById(@Param('id') id: string): Promise<any> {
|
async deleteLogoImagesById(@Param('id') id: string): Promise<any> {
|
||||||
this.fileService.deleteImage(`pictures/property//${id}`);
|
this.fileService.deleteImage(`pictures/property/${id}`);
|
||||||
}
|
}
|
||||||
@Delete('profile/:userid/')
|
@Delete('profile/:userid/')
|
||||||
async deleteProfileImagesById(@Param('id') id: string): Promise<any> {
|
async deleteProfileImagesById(@Param('id') id: string): Promise<any> {
|
||||||
this.fileService.deleteImage(`pictures/property//${id}`);
|
this.fileService.deleteImage(`pictures/property/${id}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ export class EditCommercialPropertyListingComponent {
|
||||||
|
|
||||||
accept: async () => {
|
accept: async () => {
|
||||||
this.listing.imageOrder = this.listing.imageOrder.filter(item => item !== imageName);
|
this.listing.imageOrder = this.listing.imageOrder.filter(item => item !== imageName);
|
||||||
await Promise.all([this.imageService.deleteListingImage(this.listing.id, imageName), this.listingsService.save(this.listing, 'commercialProperty')]);
|
await Promise.all([this.imageService.deleteListingImage(this.listing.imagePath, imageName), this.listingsService.save(this.listing, 'commercialProperty')]);
|
||||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Image deleted' });
|
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Image deleted' });
|
||||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ export class ImageService {
|
||||||
async deleteUserImage(userid: string, type: ImageType, name?: string) {
|
async deleteUserImage(userid: string, type: ImageType, name?: string) {
|
||||||
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/${type.delete}${userid}`));
|
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/${type.delete}${userid}`));
|
||||||
}
|
}
|
||||||
async deleteListingImage(listingid: string, name?: string) {
|
async deleteListingImage(imagePath: string, name?: string) {
|
||||||
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/propertyPicture/${listingid}/${name}`));
|
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/propertyPicture/${imagePath}/${name}`));
|
||||||
}
|
}
|
||||||
async getProfileImagesForUsers(userids: string[]) {
|
async getProfileImagesForUsers(userids: string[]) {
|
||||||
return await lastValueFrom(this.http.get<[]>(`${this.apiBaseUrl}/bizmatch/image/profileImages/${userids.join(',')}`));
|
return await lastValueFrom(this.http.get<[]>(`${this.apiBaseUrl}/bizmatch/image/profileImages/${userids.join(',')}`));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue