snowballtools-base/packages/backend/src/entity/Project.ts
Ashwin Phatak ea3addfd61
Backend package with db models (#43)
* Setup backend package with express server (#11)

* Setup backend package with express server

* Rename ts.config.json to tsconfig.json

* Update lint setup in backend package

* Add a dummy typeorm entity

* Remove dummy entity

---------

Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>

* Setup database connection (#13)

* Setup database connection

* Refactor database initialization into separate function

* Rename index.ts to server.ts

* Use debug package for logging

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>

* Create entities for ER models (#14)

* Add entity for domain

* Add entity for environment variable

* Add entity for project

* Add entity for deployment

* git ignore db directory

* Add entity for organization

* Add entity for user organization and project member

* Add foreign key user and organization to project

---------

Co-authored-by: neerajvijay1997 <111040298+neerajvijay1997@users.noreply.github.com>
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2024-01-16 13:40:14 +05:30

56 lines
983 B
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn
} from 'typeorm';
import { User } from './User';
import { Organization } from './Organization';
@Entity()
export class Project {
@PrimaryGeneratedColumn('uuid')
id!: string;
@ManyToOne(() => User)
@JoinColumn({ name: 'ownerID' })
owner!: User;
@ManyToOne(() => Organization, { nullable: true })
@JoinColumn({ name: 'organizationID' })
organization!: Organization | null;
@Column('varchar')
name!: string;
@Column('varchar')
repository!: string;
@Column('varchar', { length: 255, default: 'main' })
prodBranch!: string;
@Column('text')
description!: string;
@Column('varchar')
template!: string;
@Column('varchar')
framework!: string;
@Column({
type: 'simple-array'
})
webhooks!: string[];
@CreateDateColumn()
createdAt!: Date;
@UpdateDateColumn()
updatedAt!: Date;
}