update rent
This commit is contained in:
@@ -100,7 +100,7 @@ export class CreateCompanyDto extends PickType(CompleteRegistrationDto, ["phone"
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@ApiPropertyOptional({ description: "تصاویر قرارداد اجاره" })
|
||||
rentContractImages?: string[];
|
||||
contractImages?: string[];
|
||||
|
||||
@IsNotEmpty({ message: CompanyMessage.INDUSTRY_ID_REQUIRED })
|
||||
@IsUUID("7", { message: CompanyMessage.INDUSTRY_ID_SHOULD_BE_UUID })
|
||||
@@ -142,7 +142,7 @@ export class CreateCompanyRequestDto extends PickType(CreateCompanyDto, [
|
||||
"services",
|
||||
"metrage",
|
||||
"isRented",
|
||||
"rentContractImages",
|
||||
"contractImages",
|
||||
"rentEndAt"
|
||||
]) {
|
||||
@IsNotEmpty({ message: CompanyMessage.CHIEF_EXECUTIVE_REQUIRED })
|
||||
|
||||
@@ -58,7 +58,7 @@ export class Company extends BaseEntity {
|
||||
isRented!: boolean & Opt;
|
||||
|
||||
@Property({ type: "json", nullable: true })
|
||||
rentContractImages?: string[];
|
||||
contractImages?: string[];
|
||||
|
||||
@Property({ nullable: true })
|
||||
rentEndAt?: Date;
|
||||
|
||||
@@ -289,7 +289,7 @@ export class CompaniesService {
|
||||
try {
|
||||
await em.begin();
|
||||
// rental related field should not be update by user
|
||||
const { services, products, isRented, rentEndAt, rentContractImages, ...rest } = updateDto;
|
||||
const { services, products, isRented, rentEndAt, contractImages, ...rest } = updateDto;
|
||||
|
||||
const company = await em.findOne(Company, { id, business: { id: businessId }, user: { id: userId }, deletedAt: null });
|
||||
if (!company) throw new BadRequestException(CompanyMessage.COMPANY_NOT_FOUND);
|
||||
@@ -419,7 +419,7 @@ export class CompaniesService {
|
||||
throw new BadRequestException(CompanyMessage.RENT_END_IS_REQUIRED)
|
||||
}
|
||||
|
||||
if (!createDto.rentContractImages?.length) {
|
||||
if (!createDto.contractImages?.length) {
|
||||
throw new BadRequestException(CompanyMessage.RENT_CONTRACT_IMAGE_IS_REQUIRED)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user