fix: prohibit updating rent related field by user
This commit is contained in:
@@ -288,7 +288,8 @@ export class CompaniesService {
|
|||||||
const em = this.em.fork();
|
const em = this.em.fork();
|
||||||
try {
|
try {
|
||||||
await em.begin();
|
await em.begin();
|
||||||
const { services, products, ...rest } = updateDto;
|
// rental related field should not be update by user
|
||||||
|
const { services, products, isRented, rentEndAt, rentContractImages, ...rest } = updateDto;
|
||||||
|
|
||||||
const company = await em.findOne(Company, { id, business: { id: businessId }, user: { id: userId }, deletedAt: null });
|
const company = await em.findOne(Company, { id, business: { id: businessId }, user: { id: userId }, deletedAt: null });
|
||||||
if (!company) throw new BadRequestException(CompanyMessage.COMPANY_NOT_FOUND);
|
if (!company) throw new BadRequestException(CompanyMessage.COMPANY_NOT_FOUND);
|
||||||
|
|||||||
Reference in New Issue
Block a user