image-cropper component, drag & drop bilder

This commit is contained in:
2024-03-29 20:59:34 +01:00
parent 840d7a63b1
commit 89bb85a512
20 changed files with 478 additions and 261 deletions

View File

@@ -3,24 +3,22 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston';
import { FileInterceptor } from '@nestjs/platform-express';
import { FileService } from '../file/file.service.js';
import { SelectOptionsService } from '../select-options/select-options.service.js';
@Controller('image')
export class ImageController {
constructor(private fileService:FileService,@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) {
constructor(private fileService:FileService,
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
private selectOptions:SelectOptionsService) {
}
@Post('uploadPropertyPicture/:id')
@UseInterceptors(FileInterceptor('file'),)
async uploadFile(@UploadedFile() file: Express.Multer.File,@Param('id') id:string) {
async uploadPropertyPicture(@UploadedFile() file: Express.Multer.File,@Param('id') id:string) {
await this.fileService.storePropertyPicture(file,id);
}
@Get(':id')
async getPropertyImagesById(@Param('id') id:string): Promise<any> {
return await this.fileService.getPropertyImages(id);
}
@Post('uploadProfile/:id')
@UseInterceptors(FileInterceptor('file'),)
async uploadProfile(@UploadedFile() file: Express.Multer.File,@Param('id') id:string) {
@@ -32,7 +30,11 @@ export class ImageController {
async uploadCompanyLogo(@UploadedFile() file: Express.Multer.File,@Param('id') id:string) {
await this.fileService.storeCompanyLogo(file,id);
}
@Get(':id')
async getPropertyImagesById(@Param('id') id:string): Promise<any> {
return await this.fileService.getPropertyImages(id);
}
@Get('profileImages/:userids')
async getProfileImagesForUsers(@Param('userids') userids:string): Promise<any> {
return await this.fileService.getProfileImagesForUsers(userids);
@@ -41,4 +43,16 @@ export class ImageController {
async getCompanyLogosForUsers(@Param('userids') userids:string): Promise<any> {
return await this.fileService.getCompanyLogosForUsers(userids);
}
@Delete('propertyPicture/:listingid/:imagename')
async deletePropertyImagesById(@Param('listingid') listingid:string,@Param('imagename') imagename:string): Promise<any> {
this.fileService.deleteImage(`pictures/property/${listingid}/${imagename}`)
}
@Delete('logo/:userid/')
async deleteLogoImagesById(@Param('id') id:string): Promise<any> {
this.fileService.deleteImage(`pictures/property//${id}`)
}
@Delete('profile/:userid/')
async deleteProfileImagesById(@Param('id') id:string): Promise<any> {
this.fileService.deleteImage(`pictures/property//${id}`)
}
}