Files
outline/server/models/GroupUser.ts
Tom Moor ac07724f21 chore: Synchronizing refactor and small fixes from enterprise codebase (#3634)
* chore: Syncronizing refactor and small fixes from enterprise codebase

* fix
2022-06-05 00:59:41 -07:00

47 lines
862 B
TypeScript

import {
DefaultScope,
BelongsTo,
ForeignKey,
Column,
Table,
DataType,
} from "sequelize-typescript";
import Group from "./Group";
import User from "./User";
import BaseModel from "./base/BaseModel";
import Fix from "./decorators/Fix";
@DefaultScope(() => ({
include: [
{
association: "user",
},
],
}))
@Table({ tableName: "group_users", modelName: "group_user", paranoid: true })
@Fix
class GroupUser extends BaseModel {
@BelongsTo(() => User, "userId")
user: User;
@ForeignKey(() => User)
@Column(DataType.UUID)
userId: string;
@BelongsTo(() => Group, "groupId")
group: Group;
@ForeignKey(() => Group)
@Column(DataType.UUID)
groupId: string;
@BelongsTo(() => User, "createdById")
createdBy: User;
@ForeignKey(() => User)
@Column(DataType.UUID)
createdById: string;
}
export default GroupUser;