From f66a9fa7f132f41b2e40029f0fb535521c3fb716 Mon Sep 17 00:00:00 2001 From: jw255 Date: Sat, 24 Feb 2018 17:13:43 +0000 Subject: restructuring of tests + yarn install script --- coverage/project-code/src/db/model/User.ts.html | 299 ++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 coverage/project-code/src/db/model/User.ts.html (limited to 'coverage/project-code/src/db/model/User.ts.html') diff --git a/coverage/project-code/src/db/model/User.ts.html b/coverage/project-code/src/db/model/User.ts.html new file mode 100644 index 0000000..ffec619 --- /dev/null +++ b/coverage/project-code/src/db/model/User.ts.html @@ -0,0 +1,299 @@ + + + + Code coverage report for project-code/src/db/model/User.ts + + + + + + + +
+
+

+ All files / project-code/src/db/model User.ts +

+
+
+ 46.67% + Statements + 14/30 +
+
+ 100% + Branches + 0/0 +
+
+ 0% + Functions + 0/10 +
+
+ 61.9% + Lines + 13/21 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +791x +1x +1x +  +1x +1x +  +  +1x +  +  +1x +  +  +1x +  +  +  +1x +  +  +1x +  +  +1x +  +  +1x +  +  +  +1x +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
import { default as File } from './File';
+import { default as Project } from './Project';
+import { BelongsTo, BelongsToMany, Column, CreatedAt, ForeignKey, HasMany,
+		Model, PrimaryKey, Table } from 'sequelize-typescript';
+import { default as UserGroup } from './UserGroup';
+import { default as UserJoinsProject } from './UserJoinsProject';
+ 
+@Table
+export default class User extends Model<User> {
+	@PrimaryKey
+	@Column
+	public username: string = '';
+ 
+	@Column
+	public password: string = '';
+ 
+	@ForeignKey(() => UserGroup)
+	@Column
+	public userGroupId: number = 0;
+ 
+	@BelongsTo(() => UserGroup)
+	public userGroup: UserGroup = new UserGroup();
+ 
+	@BelongsToMany(() => Project, () => UserJoinsProject)
+	public projects: Project[] = [];
+ 
+	@HasMany(() => File)
+	public createdFiles: File[] = [];
+ 
+	@CreatedAt
+	@Column
+	public creationDate: Date = new Date();
+ 
+	// TODO implement
+	public getAccessLevel(project: Project): string {
+		throw new Error(`unimplemented, ${this}`);
+	}
+ 
+	public getProjectInfo(project: Project): ProjectInfo {
+		return {
+			project_name: project.name,
+			access_level: this.getAccessLevel(project)
+		};
+	}
+ 
+	public getUserFullInfo(): UserFullInfo {
+		return {
+			username : this.username,
+			privileges: [`${this.userGroup.name}`],
+			projects : this.projects.map<ProjectInfo>(
+				(p: Project) => this.getProjectInfo(p)
+			),
+			// TODO: Check if we have anything to use these for yet?
+			public_user_metadata: {},
+			private_user_metadata: {},
+			public_admin_metadata: {},
+			private_admin_metadata: {}
+		};
+	}
+}
+ 
+// TODO MAKE PRETTY below
+interface Metadata {}
+ 
+interface ProjectInfo {
+	project_name: string;
+	access_level: string;
+}
+ 
+export interface UserFullInfo {
+	username: string;
+	privileges: string[];
+	projects: ProjectInfo[];
+	public_user_metadata: Metadata;
+	private_user_metadata: Metadata;
+	public_admin_metadata: Metadata;
+	private_admin_metadata: Metadata;
+}
+ 
+
+
+ + + + + + + -- cgit v1.2.1