forked from cerc-io/snowballtools-base
* Publish record in laconic registry on creating project and deployment * Refactor publish record method * Set name for the published record * Publish application deployment request * Add README for publishing record * Add await in add project resolver method * Update meta data for deployment request record * Remove title field from deployment entity * Refactor service and registry class for publishing record * Add record data to project and deployment entity * Set record id and data as nullable in project entity --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
94 lines
1.6 KiB
TypeScript
94 lines
1.6 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
ManyToOne,
|
|
OneToOne,
|
|
JoinColumn
|
|
} from 'typeorm';
|
|
|
|
import { Project } from './Project';
|
|
import { Domain } from './Domain';
|
|
import { User } from './User';
|
|
|
|
export enum Environment {
|
|
Production = 'Production',
|
|
Preview = 'Preview',
|
|
Development = 'Development',
|
|
}
|
|
|
|
export enum DeploymentStatus {
|
|
Building = 'Building',
|
|
Ready = 'Ready',
|
|
Error = 'Error',
|
|
}
|
|
|
|
export interface ApplicationRecord {
|
|
type: string;
|
|
version:string
|
|
name: string
|
|
description: string
|
|
homepage: string
|
|
license: string
|
|
author: string
|
|
repository: string,
|
|
app_version: string
|
|
repository_ref: string
|
|
app_type: string
|
|
}
|
|
|
|
@Entity()
|
|
export class Deployment {
|
|
// TODO: set custom generated id
|
|
@PrimaryColumn('varchar')
|
|
id!: string;
|
|
|
|
@ManyToOne(() => Project, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'projectId' })
|
|
project!: Project;
|
|
|
|
@OneToOne(() => Domain)
|
|
@JoinColumn({ name: 'domainId' })
|
|
domain!: Domain | null;
|
|
|
|
@Column('varchar')
|
|
branch!: string;
|
|
|
|
@Column('varchar')
|
|
commitHash!: string;
|
|
|
|
@Column('varchar')
|
|
url!: string;
|
|
|
|
@Column('varchar')
|
|
recordId!: string;
|
|
|
|
@Column('simple-json')
|
|
recordData!: ApplicationRecord;
|
|
|
|
@Column({
|
|
enum: Environment
|
|
})
|
|
environment!: Environment;
|
|
|
|
@Column('boolean', { default: false })
|
|
isCurrent!: boolean;
|
|
|
|
@Column({
|
|
enum: DeploymentStatus
|
|
})
|
|
status!: DeploymentStatus;
|
|
|
|
@ManyToOne(() => User)
|
|
@JoinColumn({ name: 'createdBy' })
|
|
createdBy!: User;
|
|
|
|
@CreateDateColumn()
|
|
createdAt!: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt!: Date;
|
|
}
|