Files
karibeo_api/src/entities/place-of-interest.entity.ts
2025-10-10 21:47:56 -04:00

81 lines
2.7 KiB
TypeScript
Executable File

import { Entity, Column, ManyToOne, JoinColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { BaseEntity } from './base.entity';
import { Destination } from './destination.entity';
@Entity({ name: 'places_of_interest', schema: 'tourism' })
export class PlaceOfInterest extends BaseEntity {
@ApiProperty({ description: 'Destination ID', example: 1 })
@Column({ name: 'destination_id', nullable: true })
destinationId: number;
@ApiProperty({ description: 'Place name', example: 'Alcázar de Colón' })
@Column({ length: 255 })
name: string;
@ApiProperty({ description: 'Place description' })
@Column({ type: 'text', nullable: true })
description: string;
@ApiProperty({ description: 'Category', example: 'monument' })
@Column({ length: 50, nullable: true })
category: string;
@ApiProperty({ description: 'Coordinates (lat, lng)' })
@Column({ type: 'point' })
coordinates: string;
@ApiProperty({ description: 'Address', example: 'Plaza de Armas, Santo Domingo' })
@Column({ type: 'text', nullable: true })
address: string;
@ApiProperty({ description: 'Phone number', example: '+1809555XXXX' })
@Column({ length: 20, nullable: true })
phone: string;
@ApiProperty({ description: 'Website URL' })
@Column({ length: 255, nullable: true })
website: string;
@ApiProperty({ description: 'Opening hours' })
@Column({ name: 'opening_hours', type: 'jsonb', nullable: true })
openingHours: Record<string, any>;
@ApiProperty({ description: 'Entrance fee', example: 25.00 })
@Column({ name: 'entrance_fee', type: 'decimal', precision: 10, scale: 2, nullable: true })
entranceFee: number;
@ApiProperty({ description: 'Images' })
@Column({ type: 'jsonb', nullable: true })
images: Record<string, any>;
@ApiProperty({ description: 'Historical information' })
@Column({ name: 'historical_info', type: 'text', nullable: true })
historicalInfo: string;
@ApiProperty({ description: 'AR content' })
@Column({ name: 'ar_content', type: 'jsonb', nullable: true })
arContent: Record<string, any>;
@ApiProperty({ description: 'Audio guide URL' })
@Column({ name: 'audio_guide_url', type: 'text', nullable: true })
audioGuideUrl: string;
@ApiProperty({ description: 'Average rating', example: 4.5 })
@Column({ type: 'decimal', precision: 3, scale: 2, nullable: true })
rating: number;
@ApiProperty({ description: 'Total reviews', example: 150 })
@Column({ name: 'total_reviews', default: 0 })
totalReviews: number;
@ApiProperty({ description: 'Active status', example: true })
@Column({ default: true })
active: boolean;
// Relations
@ManyToOne(() => Destination)
@JoinColumn({ name: 'destination_id' })
destination: Destination;
}