diff options
| author | Tom Harley | 2018-02-22 18:47:08 +0000 |
|---|---|---|
| committer | Tom Harley | 2018-02-22 18:47:08 +0000 |
| commit | 5dafe924bbbd5cc09901186ff74e4b68a6dcd52f (patch) | |
| tree | ff4a76d6eaed5773d89d0da6a02d788ffe210abb /src/db/model/ContributorGroup.ts | |
| parent | Merge branch 'master' into trh/payload-checker (diff) | |
| download | medicine-5dafe924bbbd5cc09901186ff74e4b68a6dcd52f.tar.gz medicine-5dafe924bbbd5cc09901186ff74e4b68a6dcd52f.zip | |
Revert “Revert”Merge branch ‘trh/error-middleware’ into ‘master’""
This reverts commit 3198c6c2474101623e3b95bd038effe210c176a8.
Diffstat (limited to 'src/db/model/ContributorGroup.ts')
| -rw-r--r-- | src/db/model/ContributorGroup.ts | 54 |
1 files changed, 54 insertions, 0 deletions
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<ContributorGroup> { + @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; +} |
