update rent

This commit is contained in:
2026-04-05 09:44:38 +03:30
parent 0d81e62e8a
commit 321bffe26f
3 changed files with 5 additions and 5 deletions
@@ -100,7 +100,7 @@ export class CreateCompanyDto extends PickType(CompleteRegistrationDto, ["phone"
@IsArray() @IsArray()
@ValidateNested({ each: true }) @ValidateNested({ each: true })
@ApiPropertyOptional({ description: "تصاویر قرارداد اجاره" }) @ApiPropertyOptional({ description: "تصاویر قرارداد اجاره" })
rentContractImages?: string[]; contractImages?: string[];
@IsNotEmpty({ message: CompanyMessage.INDUSTRY_ID_REQUIRED }) @IsNotEmpty({ message: CompanyMessage.INDUSTRY_ID_REQUIRED })
@IsUUID("7", { message: CompanyMessage.INDUSTRY_ID_SHOULD_BE_UUID }) @IsUUID("7", { message: CompanyMessage.INDUSTRY_ID_SHOULD_BE_UUID })
@@ -142,7 +142,7 @@ export class CreateCompanyRequestDto extends PickType(CreateCompanyDto, [
"services", "services",
"metrage", "metrage",
"isRented", "isRented",
"rentContractImages", "contractImages",
"rentEndAt" "rentEndAt"
]) { ]) {
@IsNotEmpty({ message: CompanyMessage.CHIEF_EXECUTIVE_REQUIRED }) @IsNotEmpty({ message: CompanyMessage.CHIEF_EXECUTIVE_REQUIRED })
@@ -58,7 +58,7 @@ export class Company extends BaseEntity {
isRented!: boolean & Opt; isRented!: boolean & Opt;
@Property({ type: "json", nullable: true }) @Property({ type: "json", nullable: true })
rentContractImages?: string[]; contractImages?: string[];
@Property({ nullable: true }) @Property({ nullable: true })
rentEndAt?: Date; rentEndAt?: Date;
@@ -289,7 +289,7 @@ export class CompaniesService {
try { try {
await em.begin(); await em.begin();
// rental related field should not be update by user // 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 }); 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);
@@ -419,7 +419,7 @@ export class CompaniesService {
throw new BadRequestException(CompanyMessage.RENT_END_IS_REQUIRED) 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) throw new BadRequestException(CompanyMessage.RENT_CONTRACT_IMAGE_IS_REQUIRED)
} }
} }