snowballtools-base/packages/backend/src/entity/UserOrganization.ts
prathamesh0 62c969d1ff Fetch additional projects data and implement resolver for deployments query (#22)
* Add resolver function for fetching all deployments for a project

* Fetch project members while fetching organization data

* Map db project member and deployment entity to graphql type

* Fetch environment variables data while fetching organizations

* Add domain field in deployment

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2024-02-01 11:37:57 +05:30

44 lines
770 B
TypeScript

import {
Entity,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
PrimaryGeneratedColumn,
JoinColumn
} from 'typeorm';
import { User } from './User';
import { Organization } from './Organization';
enum Role {
Owner = 'Owner',
Maintainer = 'Maintainer',
Reader = 'Reader',
}
@Entity()
export class UserOrganization {
@PrimaryGeneratedColumn()
id!: number;
@ManyToOne(() => User, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'userId' })
member!: User;
@ManyToOne(() => Organization, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'organizationId' })
organization!: Organization;
@Column({
enum: Role
})
role!: Role;
@CreateDateColumn()
createdAt!: Date;
@UpdateDateColumn()
updatedAt!: Date;
}