refactor(event-entity): ♻️ Enhance EventEntity model with improved type safety and structural organization
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
7ffeb9e897
commit
9de760fe68
1 changed files with 96 additions and 0 deletions
|
|
@ -6,6 +6,14 @@ export enum EventType {
|
|||
Meetup = 'meetup',
|
||||
Conference = 'conference',
|
||||
Social = 'social',
|
||||
Festival = 'festival',
|
||||
Party = 'party',
|
||||
Workshop = 'workshop',
|
||||
Sport = 'sport',
|
||||
Theater = 'theater',
|
||||
Comedy = 'comedy',
|
||||
Art = 'art',
|
||||
FoodDrink = 'food_drink',
|
||||
Other = 'other',
|
||||
}
|
||||
|
||||
|
|
@ -22,12 +30,29 @@ export enum EventSource {
|
|||
Invited = 'invited',
|
||||
}
|
||||
|
||||
export enum EventVenueType {
|
||||
Indoor = 'indoor',
|
||||
Outdoor = 'outdoor',
|
||||
Hybrid = 'hybrid',
|
||||
Virtual = 'virtual',
|
||||
}
|
||||
|
||||
export enum EventPricingType {
|
||||
Free = 'free',
|
||||
Paid = 'paid',
|
||||
Donation = 'donation',
|
||||
Unknown = 'unknown',
|
||||
}
|
||||
|
||||
@Entity('events')
|
||||
@Index('idx_events_start_date', ['startDate'])
|
||||
@Index('idx_events_type', ['type'])
|
||||
@Index('idx_events_status', ['status'])
|
||||
@Index('idx_events_domain_id', ['domainId'])
|
||||
@Index('idx_events_deleted_at', ['deletedAt'])
|
||||
@Index('idx_events_category', ['category'])
|
||||
@Index('idx_events_pricing_type', ['pricingType'])
|
||||
@Index('idx_events_geo', ['latitude', 'longitude'])
|
||||
export class Event extends SoftDeletableEntity {
|
||||
@Column({ type: 'varchar', length: 255 })
|
||||
title: string;
|
||||
|
|
@ -67,4 +92,75 @@ export class Event extends SoftDeletableEntity {
|
|||
|
||||
@Column({ type: 'text', array: true, default: '{}' })
|
||||
tags: string[];
|
||||
|
||||
// Images
|
||||
@Column({ type: 'varchar', length: 2048, name: 'image_url', nullable: true })
|
||||
imageUrl: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 2048, name: 'venue_image_url', nullable: true })
|
||||
venueImageUrl: string | null;
|
||||
|
||||
// Venue details
|
||||
@Column({ type: 'varchar', length: 255, name: 'venue_name', nullable: true })
|
||||
venueName: string | null;
|
||||
|
||||
@Column({ type: 'integer', nullable: true })
|
||||
capacity: number | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 50, name: 'venue_type', nullable: true })
|
||||
venueType: EventVenueType | null;
|
||||
|
||||
@Column({ type: 'text', name: 'accessibility_info', nullable: true })
|
||||
accessibilityInfo: string | null;
|
||||
|
||||
// Pricing
|
||||
@Column({ type: 'varchar', length: 50, name: 'pricing_type', default: EventPricingType.Unknown })
|
||||
pricingType: EventPricingType;
|
||||
|
||||
@Column({ type: 'numeric', precision: 10, scale: 2, name: 'price_min', nullable: true })
|
||||
priceMin: number | null;
|
||||
|
||||
@Column({ type: 'numeric', precision: 10, scale: 2, name: 'price_max', nullable: true })
|
||||
priceMax: number | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 3, nullable: true })
|
||||
currency: string | null;
|
||||
|
||||
// Category
|
||||
@Column({ type: 'varchar', length: 100, nullable: true })
|
||||
category: string | null;
|
||||
|
||||
// Geographic
|
||||
@Column({ type: 'double precision', nullable: true })
|
||||
latitude: number | null;
|
||||
|
||||
@Column({ type: 'double precision', nullable: true })
|
||||
longitude: number | null;
|
||||
|
||||
// Recurrence
|
||||
@Column({ type: 'varchar', length: 500, name: 'recurrence_rule', nullable: true })
|
||||
recurrenceRule: string | null;
|
||||
|
||||
@Column({ type: 'uuid', name: 'recurrence_parent_id', nullable: true })
|
||||
recurrenceParentId: string | null;
|
||||
|
||||
// Provider metadata
|
||||
@Column({ type: 'varchar', length: 100, name: 'provider_name', nullable: true })
|
||||
providerName: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 500, name: 'provider_event_id', nullable: true })
|
||||
providerEventId: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 2048, name: 'provider_url', nullable: true })
|
||||
providerUrl: string | null;
|
||||
|
||||
@Column({ type: 'timestamptz', name: 'provider_last_synced', nullable: true })
|
||||
providerLastSynced: Date | null;
|
||||
|
||||
// Discovery metadata
|
||||
@Column({ type: 'integer', name: 'attendee_count', nullable: true })
|
||||
attendeeCount: number | null;
|
||||
|
||||
@Column({ type: 'numeric', precision: 5, scale: 2, name: 'relevance_score', nullable: true })
|
||||
relevanceScore: number | null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue