From 5dafe924bbbd5cc09901186ff74e4b68a6dcd52f Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Thu, 22 Feb 2018 18:47:08 +0000 Subject: Revert "Revert "Merge branch 'trh/error-middleware' into 'master'"" This reverts commit 3198c6c2474101623e3b95bd038effe210c176a8. --- src/db/model/ContributorGroup.ts | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/db/model/ContributorGroup.ts (limited to 'src/db/model/ContributorGroup.ts') diff --git a/src/db/model/ContributorGroup.ts b/src/db/model/ContributorGroup.ts new file mode 100644 index 0000000..6bbcf4a --- /dev/null +++ b/src/db/model/ContributorGroup.ts @@ -0,0 +1,54 @@ +import { AllowNull, Column, DataType, HasMany, Model, Table + } from 'sequelize-typescript'; +import { default as UserJoinsProject } from './UserJoinsProject'; + +@Table +export default class ContributorGroup extends Model { + @AllowNull + @Column(DataType.TEXT) + public name: string | null = null; + + /* "Error: Foreign key for "ContributorGroup" + * is missing on "UserJoinsProject"." */ + @HasMany(() => UserJoinsProject, 'contributorGroupId') + public uses: UserJoinsProject[] = []; + + @Column + public canCreateFiles: boolean = false; + + @Column + public canDeleteFiles: boolean = false; + + @Column + public canViewFiles: boolean = false; + + @Column + public canAddUsers: boolean = false; + + @Column + public canRemoveUsers: boolean = false; + + @Column + public canEditUserPermissions: boolean = false; + + @AllowNull + @Column(DataType.TEXT) + public description: string | null = null; + + @Column + public isInternal: boolean = true; + + public getContributorGroupFullInfo(): ContributorGroupFullInfo { + return { + role: `${this.name}`, + description: `${this.description}`, + internal: this.isInternal + }; + } +} + +export interface ContributorGroupFullInfo { + role: string; + description: string; + internal: boolean; +} -- cgit v1.2.1