diff --git a/prisma/migrations/20260527000000_add_virtual_tour_fields/migration.sql b/prisma/migrations/20260527000000_add_virtual_tour_fields/migration.sql new file mode 100644 index 00000000..79024dfd --- /dev/null +++ b/prisma/migrations/20260527000000_add_virtual_tour_fields/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE "properties" ADD COLUMN "virtual_tour_url" TEXT; +ALTER TABLE "properties" ADD COLUMN "video_url" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 7bc7ac6a..bbe00e2e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -400,10 +400,12 @@ model Property { neighborhoodId String? @map("neighborhood_id") latitude Float? longitude Float? - features String[] // Array of features (pool, garage, etc.) + features String[] // Array of features (pool, garage, etc.) + virtualTourUrl String? @map("virtual_tour_url") + videoUrl String? @map("video_url") + createdAt DateTime @default(now()) @map("created_at") + updatedAt DateTime @updatedAt @map("updated_at") viewCount Int @default(0) @map("view_count") - createdAt DateTime @default(now()) @map("created_at") - updatedAt DateTime @updatedAt @map("updated_at") // Relations owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade) diff --git a/src/properties/dto/property.dto.ts b/src/properties/dto/property.dto.ts index 9289548b..8f42fb8c 100644 --- a/src/properties/dto/property.dto.ts +++ b/src/properties/dto/property.dto.ts @@ -1,4 +1,4 @@ -import { IsString, IsNumber, IsOptional, IsArray, IsIn } from 'class-validator'; +import { IsString, IsNumber, IsOptional, IsArray, IsIn, IsUrl } from 'class-validator'; import { InputType, Field, Float } from '@nestjs/graphql'; export const PROPERTY_STATUS_ENUM = [ @@ -91,6 +91,16 @@ export class CreatePropertyDto { @IsOptional() @IsNumber() longitude?: number; + + @Field({ nullable: true }) + @IsOptional() + @IsUrl() + virtualTourUrl?: string; + + @Field({ nullable: true }) + @IsOptional() + @IsUrl() + videoUrl?: string; } import { PropertyStatus } from '../../common/common.types'; @@ -182,4 +192,14 @@ export class UpdatePropertyDto { @IsOptional() @IsNumber() longitude?: number; + + @Field({ nullable: true }) + @IsOptional() + @IsUrl() + virtualTourUrl?: string; + + @Field({ nullable: true }) + @IsOptional() + @IsUrl() + videoUrl?: string; } diff --git a/src/properties/models/property.model.ts b/src/properties/models/property.model.ts index 581c18fc..f607833e 100644 --- a/src/properties/models/property.model.ts +++ b/src/properties/models/property.model.ts @@ -67,6 +67,12 @@ export class Property { @Field(() => [String]) features: string[]; + @Field({ nullable: true }) + virtualTourUrl?: string; + + @Field({ nullable: true }) + videoUrl?: string; + @Field() createdAt: Date;