forked from cerc-io/snowballtools-base
62c969d1ff
* 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>
44 lines
770 B
TypeScript
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;
|
|
}
|