2024-01-16 08:10:14 +00:00
|
|
|
import {
|
|
|
|
Entity,
|
|
|
|
PrimaryGeneratedColumn,
|
|
|
|
Column,
|
|
|
|
CreateDateColumn,
|
|
|
|
UpdateDateColumn,
|
|
|
|
ManyToOne,
|
|
|
|
OneToOne,
|
|
|
|
JoinColumn
|
|
|
|
} from 'typeorm';
|
|
|
|
|
|
|
|
import { Project } from './Project';
|
|
|
|
import { Domain } from './Domain';
|
|
|
|
|
2024-01-25 05:47:44 +00:00
|
|
|
export enum Environment {
|
2024-01-16 08:10:14 +00:00
|
|
|
Production = 'Production',
|
|
|
|
Preview = 'Preview',
|
|
|
|
Development = 'Development',
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Status {
|
|
|
|
Building = 'Building',
|
|
|
|
Ready = 'Ready',
|
|
|
|
Error = 'Error',
|
|
|
|
}
|
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class Deployment {
|
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
id!: number;
|
|
|
|
|
|
|
|
@ManyToOne(() => Project, { onDelete: 'CASCADE' })
|
2024-01-17 04:32:06 +00:00
|
|
|
@JoinColumn({ name: 'projectId' })
|
2024-01-16 08:10:14 +00:00
|
|
|
project!: Project;
|
|
|
|
|
|
|
|
@OneToOne(() => Domain)
|
2024-01-17 04:32:06 +00:00
|
|
|
@JoinColumn({ name: 'domainId' })
|
2024-01-25 12:04:13 +00:00
|
|
|
domain!: Domain | null;
|
2024-01-16 08:10:14 +00:00
|
|
|
|
|
|
|
@Column('varchar')
|
|
|
|
branch!: string;
|
|
|
|
|
|
|
|
@Column('varchar')
|
|
|
|
commitHash!: string;
|
|
|
|
|
|
|
|
@Column('varchar')
|
|
|
|
title!: string;
|
|
|
|
|
|
|
|
@Column({
|
|
|
|
enum: Environment
|
|
|
|
})
|
|
|
|
environment!: Environment;
|
|
|
|
|
|
|
|
@Column('boolean', { default: false })
|
|
|
|
isCurrent!: boolean;
|
|
|
|
|
|
|
|
@Column({
|
|
|
|
enum: Status
|
|
|
|
})
|
|
|
|
status!: Status;
|
|
|
|
|
|
|
|
@CreateDateColumn()
|
|
|
|
createdAt!: Date;
|
|
|
|
|
|
|
|
@UpdateDateColumn()
|
|
|
|
updatedAt!: Date;
|
|
|
|
}
|