diff options
Diffstat (limited to 'util/src/entities/Relationship.ts')
-rw-r--r-- | util/src/entities/Relationship.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/util/src/entities/Relationship.ts b/util/src/entities/Relationship.ts new file mode 100644 index 00000000..bd5861f0 --- /dev/null +++ b/util/src/entities/Relationship.ts @@ -0,0 +1,26 @@ +import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from "typeorm"; +import { BaseClass } from "./BaseClass"; +import { User } from "./User"; + +export enum RelationshipType { + outgoing = 4, + incoming = 3, + blocked = 2, + friends = 1, +} + +@Entity("relationships") +export class Relationship extends BaseClass { + @Column() + user_id: string; + + @JoinColumn({ name: "user_id" }) + @ManyToOne(() => User, (user: User) => user.id) + user: User; + + @Column() + nickname?: string; + + @Column({ type: "simple-enum", enum: RelationshipType }) + type: RelationshipType; +} |