snowballtools-base/packages/backend/src/entity/Project.ts
nabarun ef26f9b39e Implement functionality to release funds after deployment (#7)
Part of [Service provider auctions for web deployments](https://www.notion.so/Service-provider-auctions-for-web-deployments-104a6b22d47280dbad51d28aa3a91d75)

- Implement functionality to release funds after first successful deployment

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: cerc-io/snowballtools-base#7
2024-10-21 14:25:49 +00:00

93 lines
2.0 KiB
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn,
OneToMany,
DeleteDateColumn
} from 'typeorm';
import { User } from './User';
import { Organization } from './Organization';
import { ProjectMember } from './ProjectMember';
import { Deployment } from './Deployment';
@Entity()
export class Project {
@PrimaryGeneratedColumn('uuid')
id!: string;
@ManyToOne(() => User)
@JoinColumn({ name: 'ownerId' })
owner!: User;
@Column({ nullable: false })
ownerId!: string;
@ManyToOne(() => Organization, { nullable: true })
@JoinColumn({ name: 'organizationId' })
organization!: Organization | null;
@Column('varchar')
organizationId!: string;
@Column('varchar')
name!: string;
@Column('varchar')
repository!: string;
@Column('varchar', { length: 255, default: 'main' })
prodBranch!: string;
@Column('text', { default: '' })
description!: string;
@Column('varchar', { nullable: true })
auctionId!: string | null;
@Column({ type: 'simple-array', nullable: true })
deployerLrns!: string[] | null;
@Column('boolean', { default: false, nullable: true })
fundsReleased!: boolean;
// TODO: Compute template & framework in import repository
@Column('varchar', { nullable: true })
template!: string | null;
@Column('varchar', { nullable: true })
framework!: string | null;
@Column({
type: 'simple-array'
})
webhooks!: string[];
@Column('varchar')
icon!: string;
@Column({ type: 'simple-array', nullable: true })
baseDomains!: string[] | null;
@CreateDateColumn()
createdAt!: Date;
@UpdateDateColumn()
updatedAt!: Date;
@DeleteDateColumn()
deletedAt!: Date | null;
@OneToMany(() => Deployment, (deployment) => deployment.project)
deployments!: Deployment[];
@OneToMany(() => ProjectMember, (projectMember) => projectMember.project, {
cascade: ['soft-remove']
})
projectMembers!: ProjectMember[];
}