remove id before create Listing, set location/companyLocation to null if not set

This commit is contained in:
2024-08-11 13:06:48 +02:00
parent 1e1d5cea57
commit d71a5c25c3
3 changed files with 22 additions and 13 deletions

View File

@@ -127,6 +127,7 @@ export class CommercialPropertyService {
data.updated = new Date();
const validatedCommercialPropertyListing = CommercialPropertyListingSchema.parse(data);
const convertedCommercialPropertyListing = convertCommercialToDrizzleCommercial(data);
delete convertedCommercialPropertyListing.id;
const [createdListing] = await this.conn.insert(commercials).values(convertedCommercialPropertyListing).returning();
return convertDrizzleCommercialToCommercial(createdListing);
} catch (error) {