diff options
| author | THarley | 2018-02-22 17:18:34 +0000 |
|---|---|---|
| committer | THarley | 2018-02-22 17:18:34 +0000 |
| commit | 0c0d700c93886ba8d585fe0a6495d35bddb67807 (patch) | |
| tree | b2dbed468410c5f1f7905775ed627c4b4aa4851b /src/db/model/ContributorGroup.ts | |
| parent | Merge branch 'trh/yarn' into 'master' (diff) | |
| parent | Include error-handling in middleware stack (diff) | |
| download | medicine-0c0d700c93886ba8d585fe0a6495d35bddb67807.tar.gz medicine-0c0d700c93886ba8d585fe0a6495d35bddb67807.zip | |
Merge branch ‘trh/error-middleware’ into ‘master’
Error-handling Middleware
See merge request cs3099group-be-4/project-code!13
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; +} |
