2024-01-16 08:10:14 +00:00
|
|
|
import {
|
|
|
|
Entity,
|
|
|
|
Column,
|
|
|
|
CreateDateColumn,
|
|
|
|
UpdateDateColumn,
|
|
|
|
ManyToOne,
|
|
|
|
PrimaryGeneratedColumn,
|
2024-02-01 10:04:17 +00:00
|
|
|
JoinColumn,
|
|
|
|
DeleteDateColumn
|
2024-01-16 08:10:14 +00:00
|
|
|
} 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;
|
|
|
|
|
2024-02-01 10:04:17 +00:00
|
|
|
@ManyToOne(() => User)
|
2024-01-17 04:32:06 +00:00
|
|
|
@JoinColumn({ name: 'userId' })
|
2024-01-18 08:36:49 +00:00
|
|
|
member!: User;
|
2024-01-16 08:10:14 +00:00
|
|
|
|
2024-02-01 10:04:17 +00:00
|
|
|
@ManyToOne(() => Organization)
|
2024-01-17 04:32:06 +00:00
|
|
|
@JoinColumn({ name: 'organizationId' })
|
2024-01-16 08:10:14 +00:00
|
|
|
organization!: Organization;
|
|
|
|
|
|
|
|
@Column({
|
|
|
|
enum: Role
|
|
|
|
})
|
|
|
|
role!: Role;
|
|
|
|
|
|
|
|
@CreateDateColumn()
|
|
|
|
createdAt!: Date;
|
|
|
|
|
|
|
|
@UpdateDateColumn()
|
|
|
|
updatedAt!: Date;
|
2024-02-01 10:04:17 +00:00
|
|
|
|
|
|
|
@DeleteDateColumn()
|
2024-02-06 08:48:06 +00:00
|
|
|
deletedAt!: Date | null;
|
2024-01-16 08:10:14 +00:00
|
|
|
}
|