Spaces:
Sleeping
Sleeping
File size: 2,228 Bytes
990c0e8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn,
} from 'typeorm';
import { User } from '../../auth/entities/user.entity';
export enum IntegrationType {
LMS = 'lms',
SSO = 'sso',
PAYMENT = 'payment',
EMAIL = 'email',
SMS = 'sms',
AI = 'ai',
STORAGE = 'storage',
OTHER = 'other',
}
export enum HealthStatus {
HEALTHY = 'healthy',
DEGRADED = 'degraded',
DOWN = 'down',
}
@Entity('api_integrations')
export class ApiIntegration {
@PrimaryGeneratedColumn({ name: 'integration_id', type: 'bigint', unsigned: true })
integrationId: number;
@Column({ name: 'campus_id', type: 'bigint', unsigned: true })
campusId: number;
@Column({ name: 'integration_name', type: 'varchar', length: 100 })
integrationName: string;
@Column({
name: 'integration_type',
type: 'enum',
enum: IntegrationType,
})
integrationType: IntegrationType;
@Column({ name: 'api_endpoint', type: 'varchar', length: 500, nullable: true })
apiEndpoint: string;
@Column({ name: 'api_key_encrypted', type: 'varchar', length: 500, nullable: true })
apiKeyEncrypted: string;
@Column({ name: 'api_secret_encrypted', type: 'varchar', length: 500, nullable: true })
apiSecretEncrypted: string;
@Column({ name: 'configuration', type: 'longtext', nullable: true })
configuration: string;
@Column({ name: 'is_active', type: 'tinyint', default: 1 })
isActive: boolean;
@Column({
name: 'health_status',
type: 'enum',
enum: HealthStatus,
default: HealthStatus.HEALTHY,
})
healthStatus: HealthStatus;
@Column({ name: 'last_sync_at', type: 'timestamp', nullable: true })
lastSyncAt: Date;
@Column({ name: 'created_by', type: 'bigint', unsigned: true, nullable: true })
createdBy: number;
@Column({ name: 'updated_by', type: 'bigint', unsigned: true, nullable: true })
updatedBy: number;
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at' })
updatedAt: Date;
@ManyToOne(() => User)
@JoinColumn({ name: 'created_by' })
createdByUser: User;
@ManyToOne(() => User)
@JoinColumn({ name: 'updated_by' })
updatedByUser: User;
}
|