- MAI-018 Bidding module: entities, services, controllers, DTOs - Opportunity, Tender, Proposal, Vendor management - Bid calendar, documents, analytics - Earned Value Management: Curva S, SPI/CPI reports - earned-value.service.ts with EV, PV, AC calculations - earned-value.controller.ts with 9 endpoints - DTOs for modules: assets, contracts, documents, purchase, quality - 28 new DTO files with class-validator decorators - Storage module: service and controller implementation - Multi-provider support (local, S3, GCS, Azure) - File management, upload/download URLs - Multiple entity and service fixes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
111 lines
2.7 KiB
TypeScript
111 lines
2.7 KiB
TypeScript
/**
|
|
* BidCalendar Entity - Fechas Clave de Licitación
|
|
* Eventos y fechas importantes del proceso de licitación.
|
|
*
|
|
* @module Bidding (MAI-018)
|
|
* @table bidding.bid_calendar
|
|
* @ddl schemas/XX-bidding-schema-ddl.sql
|
|
*/
|
|
|
|
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
Index,
|
|
} from 'typeorm';
|
|
import { Tenant } from '../../core/entities/tenant.entity';
|
|
import { User } from '../../core/entities/user.entity';
|
|
import { Tender } from './tender.entity';
|
|
|
|
/** Type of calendar event */
|
|
export type CalendarEventType =
|
|
| 'site_visit'
|
|
| 'clarification_meeting'
|
|
| 'submission_deadline'
|
|
| 'technical_opening'
|
|
| 'economic_opening'
|
|
| 'award_date'
|
|
| 'other';
|
|
|
|
@Entity({ schema: 'bidding', name: 'bid_calendar' })
|
|
@Index(['tenantId'])
|
|
@Index(['tenantId', 'tenderId'])
|
|
@Index(['tenantId', 'eventType'])
|
|
@Index(['eventDate'])
|
|
@Index(['alertSent'])
|
|
export class BidCalendar {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ name: 'tenant_id', type: 'uuid' })
|
|
tenantId: string;
|
|
|
|
/** Reference to the tender */
|
|
@Column({ name: 'tender_id', type: 'uuid' })
|
|
tenderId: string;
|
|
|
|
@Column({
|
|
name: 'event_type',
|
|
type: 'varchar',
|
|
length: 50,
|
|
})
|
|
eventType: CalendarEventType;
|
|
|
|
/** Date and time of the event */
|
|
@Column({ name: 'event_date', type: 'timestamptz' })
|
|
eventDate: Date;
|
|
|
|
/** Description of the event */
|
|
@Column({ type: 'varchar', length: 255 })
|
|
description: string;
|
|
|
|
/** Days before the event to send alert */
|
|
@Column({ name: 'alert_days_before', type: 'int', default: 3 })
|
|
alertDaysBefore: number;
|
|
|
|
/** Whether alert has been sent */
|
|
@Column({ name: 'alert_sent', type: 'boolean', default: false })
|
|
alertSent: boolean;
|
|
|
|
/** Additional notes */
|
|
@Column({ type: 'text', nullable: true })
|
|
notes: string;
|
|
|
|
// Relations
|
|
@ManyToOne(() => Tenant)
|
|
@JoinColumn({ name: 'tenant_id' })
|
|
tenant: Tenant;
|
|
|
|
@ManyToOne(() => Tender, (tender) => tender.calendarEvents)
|
|
@JoinColumn({ name: 'tender_id' })
|
|
tender: Tender;
|
|
|
|
// Audit fields
|
|
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@Column({ name: 'created_by', type: 'uuid', nullable: true })
|
|
createdById: string;
|
|
|
|
@ManyToOne(() => User, { nullable: true })
|
|
@JoinColumn({ name: 'created_by' })
|
|
createdBy: User;
|
|
|
|
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
|
|
@Column({ name: 'updated_by', type: 'uuid', nullable: true })
|
|
updatedById: string;
|
|
|
|
@ManyToOne(() => User, { nullable: true })
|
|
@JoinColumn({ name: 'updated_by' })
|
|
updatedBy: User;
|
|
|
|
@Column({ name: 'deleted_at', type: 'timestamptz', nullable: true })
|
|
deletedAt: Date;
|
|
}
|