2021-03-04 17:02:07 +08:00
|
|
|
import { AppBaseEntity } from './../commons/entities/app-base-entity';
|
2021-03-01 18:14:13 +08:00
|
|
|
import { ObjectType } from '@nestjs/graphql';
|
|
|
|
import { Column, Entity, ManyToOne } from 'typeorm';
|
|
|
|
import { Pipeline } from '../pipelines/pipeline.entity';
|
|
|
|
import { PipelineTaskLogs } from './models/pipeline-task-logs.model';
|
|
|
|
import { TaskStatuses } from './enums/task-statuses.enum';
|
|
|
|
import { PipelineUnits } from './enums/pipeline-units.enum';
|
|
|
|
|
|
|
|
@ObjectType()
|
|
|
|
@Entity()
|
2021-03-04 17:02:07 +08:00
|
|
|
export class PipelineTask extends AppBaseEntity {
|
2021-03-01 18:14:13 +08:00
|
|
|
@ManyToOne(() => Pipeline)
|
|
|
|
pipeline: Pipeline;
|
|
|
|
@Column()
|
|
|
|
pipelineId: string;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
commit: string;
|
|
|
|
|
|
|
|
@Column({ type: 'enum', enum: PipelineUnits, array: true })
|
|
|
|
units: PipelineUnits[];
|
|
|
|
|
|
|
|
@Column({ type: 'jsonb', default: '[]' })
|
|
|
|
logs: PipelineTaskLogs[];
|
|
|
|
|
|
|
|
@Column({ type: 'enum', enum: TaskStatuses, default: TaskStatuses.pending })
|
|
|
|
status: TaskStatuses;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
startedAt: Date;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
endedAt: Date;
|
|
|
|
}
|