cleanup + Property images
This commit is contained in:
@@ -7,6 +7,8 @@ import { SelectOptionsService } from '../select-options/select-options.service.j
|
||||
import { ListingsService } from '../listings/listings.service.js';
|
||||
|
||||
import { Entity, EntityData } from 'redis-om';
|
||||
import { businesses, commercials } from 'src/drizzle/schema.js';
|
||||
import { CommercialPropertyListing } from 'src/models/db.model.js';
|
||||
|
||||
@Controller('image')
|
||||
export class ImageController {
|
||||
@@ -38,16 +40,16 @@ export class ImageController {
|
||||
|
||||
@Get(':id')
|
||||
async getPropertyImagesById(@Param('id') id:string): Promise<any> {
|
||||
// const result = await this.listingService.getCommercialPropertyListingById(id);
|
||||
// const listing = result as CommercialPropertyListing;
|
||||
// if (listing.imageOrder){
|
||||
// return listing.imageOrder
|
||||
// } else {
|
||||
// const imageOrder = await this.fileService.getPropertyImages(id);
|
||||
// listing.imageOrder=imageOrder;
|
||||
// this.listingService.saveListing(listing);
|
||||
// return imageOrder;
|
||||
// }
|
||||
const result = await this.listingService.findById(id,commercials);
|
||||
const listing = result as CommercialPropertyListing;
|
||||
if (listing.imageOrder){
|
||||
return listing.imageOrder
|
||||
} else {
|
||||
const imageOrder = await this.fileService.getPropertyImages(id);
|
||||
listing.imageOrder=imageOrder;
|
||||
this.listingService.updateListing(listing.id,listing,commercials);
|
||||
return imageOrder;
|
||||
}
|
||||
}
|
||||
@Get('profileImages/:userids')
|
||||
async getProfileImagesForUsers(@Param('userids') userids:string): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user