Skip to content

Commit 90fec8e

Browse files
committed
feat: add comment changes for contact-us
1 parent d46f93f commit 90fec8e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/properties/properties.service.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -707,17 +707,22 @@ export class PropertiesService {
707707
}
708708

709709
async addComment(propertyId: string, addCommentDto: AddCommentDto) {
710-
const foundProperty = await this.dataSource.query(`
711-
SELECT * FROM wp_realty_listingsdb WHERE listingsdb_id = ?;
712-
`, [propertyId]);
710+
// if property id is 0 then it is comment from contact us form
711+
if (propertyId !== '0') {
712+
const foundProperty = await this.dataSource.query(`
713+
SELECT * FROM wp_realty_listingsdb WHERE listingsdb_id = ?;
714+
`, [propertyId]);
713715

714-
if (!(foundProperty.length > 0)) throw new NotFoundException(CONSTANTS.PROPERTY_NOT_FOUND);
716+
if (!(foundProperty.length > 0)) throw new NotFoundException(CONSTANTS.PROPERTY_NOT_FOUND);
717+
}
715718

716719
await this.dataSource.query(`
717720
INSERT INTO property_comment (comment, propertyId, name, email, phone_number)
718721
VALUES (?, ?, ?, ?, ?);
719722
`, [addCommentDto.comment, propertyId, addCommentDto.name, addCommentDto.email, addCommentDto.phone_number]);
720-
return 'ok';
723+
return {
724+
message: 'ok'
725+
};
721726
}
722727

723728
async getComments(getCommentsDto: GetCommentsDto): Promise<IGenericResult> {

0 commit comments

Comments
 (0)