erp-transportistas-backend-v2/src/modules/storage/entities/bucket.entity.ts
Adrian Flores Cortes ec59053bbe feat: Propagate entities from erp-construccion
Modules added (entities only):
- biometrics (4 entities)
- feature-flags (3 entities)
- hr (8 entities)
- invoices (4 entities)
- products (7 entities)
- profiles (5 entities)
- projects (1 entity)
- purchase (11 entities)
- reports (13 entities)
- sales (4 entities)
- settings (4 entities)
- storage (7 entities)
- warehouses (3 entities)
- webhooks (6 entities)
- whatsapp (10 entities)

Total: 90 new entity files
Source: erp-construccion (validated, build clean)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 09:06:31 -06:00

75 lines
2.1 KiB
TypeScript

/**
* StorageBucket Entity
* Storage bucket configuration with provider and quota settings
* Compatible with erp-core bucket.entity
*
* @module Storage
*/
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
Index,
} from 'typeorm';
export type BucketType = 'public' | 'private' | 'protected';
export type StorageProvider = 'local' | 's3' | 'gcs' | 'azure';
@Entity({ name: 'buckets', schema: 'storage' })
export class StorageBucket {
@PrimaryGeneratedColumn('uuid')
id: string;
@Index({ unique: true })
@Column({ name: 'name', type: 'varchar', length: 100 })
name: string;
@Column({ name: 'description', type: 'text', nullable: true })
description: string;
@Column({ name: 'bucket_type', type: 'varchar', length: 30, default: 'private' })
bucketType: BucketType;
@Column({ name: 'max_file_size_mb', type: 'int', default: 50 })
maxFileSizeMb: number;
@Column({ name: 'allowed_mime_types', type: 'text', array: true, default: [] })
allowedMimeTypes: string[];
@Column({ name: 'allowed_extensions', type: 'text', array: true, default: [] })
allowedExtensions: string[];
@Column({ name: 'auto_delete_days', type: 'int', nullable: true })
autoDeleteDays: number;
@Column({ name: 'versioning_enabled', type: 'boolean', default: false })
versioningEnabled: boolean;
@Column({ name: 'max_versions', type: 'int', default: 5 })
maxVersions: number;
@Column({ name: 'storage_provider', type: 'varchar', length: 30, default: 'local' })
storageProvider: StorageProvider;
@Column({ name: 'storage_config', type: 'jsonb', default: {} })
storageConfig: Record<string, any>;
@Column({ name: 'quota_per_tenant_gb', type: 'int', nullable: true })
quotaPerTenantGb: number;
@Column({ name: 'is_active', type: 'boolean', default: true })
isActive: boolean;
@Column({ name: 'is_system', type: 'boolean', default: false })
isSystem: boolean;
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
updatedAt: Date;
}