add: metrage to company

This commit is contained in:
2026-02-16 12:34:15 +03:30
parent 2d3560dc65
commit f21f858b44
4 changed files with 16 additions and 1 deletions
+2
View File
@@ -550,6 +550,8 @@ export const enum CompanyMessage {
IS_ACTIVE_REQUIRED = "وضعیت فعالیت شرکت مورد نیاز است",
MAP_ADDRESS_LINK_MUST_BE_URL = "لینک نقشه شرکت باید یک URL معتبر باشد",
MAP_ADDRESS_LINK_REQUIRED = "لینک نقشه شرکت مورد نیاز است",
METRAGE_MUST_BE_INT = "متراژ شرکت باید یک عدد صحیح باشد",
METRAGE_MUST_BE_POSITIVE = "متراژ شرکت باید عددی مثبت باشد",
NAME_MUST_BE_STRING = "نام شرکت باید یک رشته باشد",
NAME_REQUIRED = "نام شرکت مورد نیاز است",
PHONE_MUST_BE_STRING = "شماره تلفن شرکت باید یک رشته باشد",
@@ -7,12 +7,14 @@ import {
IsDateString,
IsEmail,
IsEnum,
IsInt,
IsNotEmpty,
IsOptional,
IsString,
IsUUID,
IsUrl,
Length,
Min,
ValidateNested,
} from "class-validator";
@@ -74,6 +76,12 @@ export class CreateCompanyDto extends PickType(CompleteRegistrationDto, ["phone"
@ApiProperty({ description: "آدرس تصویر کاور", example: "https://www.example.com/cover.jpg" })
coverImageUrl: string;
@IsOptional()
@IsInt({ message: CompanyMessage.METRAGE_MUST_BE_INT })
@Min(1, { message: CompanyMessage.METRAGE_MUST_BE_POSITIVE })
@ApiProperty({ description: "متراژ شرکت (متر مربع)", example: 500 })
metrage?: number;
@IsOptional()
@IsNotEmpty({ message: CompanyMessage.IS_ACTIVE_REQUIRED })
@IsBoolean({ message: CompanyMessage.IS_ACTIVE_MUST_BE_BOOLEAN })
@@ -114,6 +122,7 @@ export class CreateCompanyRequestDto extends PickType(CreateCompanyDto, [
"websiteUrl",
"profileImageUrl",
"coverImageUrl",
"metrage",
"industryId",
"products",
"services",
@@ -48,6 +48,9 @@ export class Company extends BaseEntity {
@Property({ type: "varchar", length: 255 })
coverImageUrl!: string;
@Property({ type: "int", nullable: true })
metrage?: number;
@Property({ type: "boolean", default: true })
isActive!: boolean & Opt;
@@ -49,6 +49,7 @@ export class CompanyRepository extends EntityRepository<Company> {
"status",
"invoiceCount",
"chiefExecutiveOfficer",
"metrage",
"createdAt",
"industry.id",
"industry.title",
@@ -75,7 +76,7 @@ export class CompanyRepository extends EntityRepository<Company> {
return this.find(where, {
populate: ["industry"],
orderBy: { createdAt: "DESC" },
fields: ["id", "name", "description", "profileImageUrl", "coverImageUrl", "industry.id", "industry.title", "createdAt"],
fields: ["id", "name", "description", "profileImageUrl", "coverImageUrl", "metrage", "industry.id", "industry.title", "createdAt"],
});
}
}