From 407a5a3c6c1d6d4c170d7646f921bb6f2fb2f380 Mon Sep 17 00:00:00 2001 From: jw255 Date: Sat, 3 Mar 2018 16:18:01 +0000 Subject: now compiles. also added stubs for database testing --- coverage/project-code/src/db/index.html | 106 -------- .../project-code/src/db/initPostgresDB.ts.html | 110 -------- .../src/db/model/ContributorGroup.ts.html | 227 ---------------- coverage/project-code/src/db/model/File.ts.html | 206 -------------- coverage/project-code/src/db/model/Project.ts.html | 290 -------------------- coverage/project-code/src/db/model/User.ts.html | 299 --------------------- .../project-code/src/db/model/UserGroup.ts.html | 221 --------------- .../src/db/model/UserJoinsProject.ts.html | 146 ---------- coverage/project-code/src/db/model/index.html | 158 ----------- coverage/project-code/src/db/orm.ts.html | 101 ------- 10 files changed, 1864 deletions(-) delete mode 100644 coverage/project-code/src/db/index.html delete mode 100644 coverage/project-code/src/db/initPostgresDB.ts.html delete mode 100644 coverage/project-code/src/db/model/ContributorGroup.ts.html delete mode 100644 coverage/project-code/src/db/model/File.ts.html delete mode 100644 coverage/project-code/src/db/model/Project.ts.html delete mode 100644 coverage/project-code/src/db/model/User.ts.html delete mode 100644 coverage/project-code/src/db/model/UserGroup.ts.html delete mode 100644 coverage/project-code/src/db/model/UserJoinsProject.ts.html delete mode 100644 coverage/project-code/src/db/model/index.html delete mode 100644 coverage/project-code/src/db/orm.ts.html (limited to 'coverage/project-code/src/db') diff --git a/coverage/project-code/src/db/index.html b/coverage/project-code/src/db/index.html deleted file mode 100644 index a7d063a..0000000 --- a/coverage/project-code/src/db/index.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - Code coverage report for project-code/src/db - - - - - - - -
-
-

- All files project-code/src/db -

-
-
- 0% - Statements - 0/3 -
-
- 100% - Branches - 0/0 -
-
- 0% - Functions - 0/2 -
-
- 0% - Lines - 0/3 -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
initPostgresDB.ts
0%0/2100%0/00%0/20%0/2
orm.ts
0%0/1100%0/0100%0/00%0/1
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/initPostgresDB.ts.html b/coverage/project-code/src/db/initPostgresDB.ts.html deleted file mode 100644 index 35036ff..0000000 --- a/coverage/project-code/src/db/initPostgresDB.ts.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - Code coverage report for project-code/src/db/initPostgresDB.ts - - - - - - - -
-
-

- All files / project-code/src/db initPostgresDB.ts -

-
-
- 0% - Statements - 0/2 -
-
- 100% - Branches - 0/0 -
-
- 0% - Functions - 0/2 -
-
- 0% - Lines - 0/2 -
-
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
import * as Sequelize from 'sequelize';
-const gres: Sequelize.Sequelize = new Sequelize(
-	'postgres://admin:eprprJacR0hBpmWvs5IDJZTnjRAY2gM3tSm0b1af@localhost:5432/be4',
-	{
-		operatorsAliases : false
-	}
-);
- 
-gres.authenticate()
-	.then(() => {
-		// Connection has been established successfully.
-	})
-	.catch((err: Error) => {
-		// Unable to connect to the database.
-	});
- 
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/model/ContributorGroup.ts.html b/coverage/project-code/src/db/model/ContributorGroup.ts.html deleted file mode 100644 index e8e3ce2..0000000 --- a/coverage/project-code/src/db/model/ContributorGroup.ts.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - Code coverage report for project-code/src/db/model/ContributorGroup.ts - - - - - - - -
-
-

- All files / project-code/src/db/model ContributorGroup.ts -

-
-
- 53.85% - Statements - 14/26 -
-
- 100% - Branches - 0/0 -
-
- 0% - Functions - 0/3 -
-
- 86.67% - Lines - 13/15 -
-
-
-
-

-
-
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 -551x -  -1x -  -  -1x -  -  -1x -  -  -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -  -1x -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
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;
-}
- 
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/model/File.ts.html b/coverage/project-code/src/db/model/File.ts.html deleted file mode 100644 index f552af3..0000000 --- a/coverage/project-code/src/db/model/File.ts.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - Code coverage report for project-code/src/db/model/File.ts - - - - - - - -
-
-

- All files / project-code/src/db/model File.ts -

-
-
- 48.48% - Statements - 16/33 -
-
- 100% - Branches - 0/0 -
-
- 0% - Functions - 0/7 -
-
- 71.43% - Lines - 15/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 -481x -1x -  -1x -  -  -1x -  -1x -  -  -  -1x -  -  -1x -  -  -  -  -1x -  -  -1x -  -  -1x -  -  -  -  -1x -  -  -1x -  -  -1x -  -  -  -1x -  -  -  -1x -  - 
import { default as Project } from './Project';
-import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, HasMany,
-		HasOne, Model, PrimaryKey, Table, UpdatedAt } from 'sequelize-typescript';
-import { default as User } from './User';
- 
-@Table
-export default class File extends Model<File> {
-	@Column
-	public name: string = '';
- 
-	@PrimaryKey
-	@Column
-	public uuid: string = '';
- 
-	@Column
-	public mimetype: string = '';
- 
-	@ForeignKey(() => File)
-	@AllowNull
-	@Column(DataType.TEXT)
-	public parentFolderId: string | null = null;
- 
-	@BelongsTo(() => File)
-	public parentFolder: File = new File();
- 
-	@HasMany(() => File)
-	public containedFiles: File[] = [];
- 
-	@ForeignKey(() => User)
-	@AllowNull
-	@Column(DataType.TEXT)
-	public creatorName: string | null = null;
- 
-	@BelongsTo(() => User)
-	public creator: User = new User();
- 
-	@HasOne(() => Project)
-	public rootFolderOf: Project = new Project();
- 
-	@CreatedAt
-	@Column
-	public uploadDate: Date = new Date();
- 
-	@UpdatedAt
-	@Column
-	public modifyDate: Date = new Date();
-}
- 
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/model/Project.ts.html b/coverage/project-code/src/db/model/Project.ts.html deleted file mode 100644 index b6270dc..0000000 --- a/coverage/project-code/src/db/model/Project.ts.html +++ /dev/null @@ -1,290 +0,0 @@ - - - - Code coverage report for project-code/src/db/model/Project.ts - - - - - - - -
-
-

- All files / project-code/src/db/model Project.ts -

-
-
- 46.15% - Statements - 12/26 -
-
- 100% - Branches - 0/0 -
-
- 0% - Functions - 0/9 -
-
- 61.11% - Lines - 11/18 -
-
-
-
-

-
-
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  -1x -1x -  -1x -1x -  -  -1x -  -  -  -1x -  -  -1x -  -  -  -1x -  -  -1x -  -  -  -1x -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
import { default as ContributorGroup } from './ContributorGroup';
-import { default as File } from './File';
-import { BelongsTo, BelongsToMany, Column, CreatedAt, ForeignKey,
-		Model, PrimaryKey, Table, UpdatedAt } from 'sequelize-typescript';
-import { default as User } from './User';
-import { default as UserJoinsProject } from './UserJoinsProject';
- 
-@Table
-export default class Project extends Model<Project> {
- 
-	@PrimaryKey
-	@Column
-	public name: string = '';
- 
-	@BelongsToMany(() => User, () => UserJoinsProject)
-	public contributors: User[] = [];
- 
-	@ForeignKey(() => File)
-	@Column
-	public rootFolderId: string = '';
- 
-	@BelongsTo(() => File)
-	public rootFolder: File = new File();
- 
-	@CreatedAt
-	@Column
-	public creationDate: Date = new Date();
- 
-	@UpdatedAt
-	@Column
-	public lastActivity: Date = new Date();
- 
-	public getAccessLevel(user: User): ContributorGroup {
-		throw new Error(`unimplemented, ${this}`);
-	}
- 
-	public getUserInfo(user: User): UserInfo {
-		return {
-			username: user.username,
-			access_level: this.getAccessLevel(user)
-				.toString()
-		};
-	}
- 
-	public getProjectFullInfo(): ProjectFullInfo {
-		return {
-			project_name: this.name,
-			users: this.contributors
-			.map<UserInfo>(
-				(u: User) => this.getUserInfo(u)
-			),
-			public_metadata: {
-				creation_date: this.creationDate
-			},
-			// TODO: Check if we have anything to use these for yet?
-			private_metadata: {},
-			admin_metadata: {}
-		};
-	}
-}
- 
-interface Metadata {}
- 
-interface UserInfo {
-	username: string;
-	access_level: string;
-}
- 
-export interface ProjectFullInfo {
-	project_name: string;
-	users: UserInfo[];
-	public_metadata: Metadata;
-	private_metadata?: Metadata;
-	admin_metadata?: Metadata;
-}
- 
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/model/User.ts.html b/coverage/project-code/src/db/model/User.ts.html deleted file mode 100644 index ffec619..0000000 --- a/coverage/project-code/src/db/model/User.ts.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - 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;
-}
- 
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/model/UserGroup.ts.html b/coverage/project-code/src/db/model/UserGroup.ts.html deleted file mode 100644 index 75f5fbf..0000000 --- a/coverage/project-code/src/db/model/UserGroup.ts.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - Code coverage report for project-code/src/db/model/UserGroup.ts - - - - - - - -
-
-

- All files / project-code/src/db/model UserGroup.ts -

-
-
- 53.85% - Statements - 14/26 -
-
- 100% - Branches - 0/0 -
-
- 0% - Functions - 0/3 -
-
- 86.67% - Lines - 13/15 -
-
-
-
-

-
-
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 -531x -  -1x -  -  -  -  -  -  -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -1x -  -  -  -1x -  -  -  -  -  -  -  -  -  - 
import { AllowNull, Column, DataType, HasMany, Model, Table
-	} from 'sequelize-typescript';
-import { default as User } from './User';
- 
-interface UserPrivilege {
-	privilege: string;
-	description: string;
-	internal: boolean;
-}
- 
-@Table
-export default class UserGroup extends Model<UserGroup> {
-	@AllowNull
-	@Column(DataType.TEXT)
-	public name: string | null = null;
- 
-	@HasMany(() => User)
-	public users: User[] = [];
- 
-	@Column
-	public canCreateUsers: boolean = false;
- 
-	@Column
-	public canDeleteUsers: boolean = false;
- 
-	@Column
-	public canEditUsers: boolean = false;
- 
-	@Column
-	public canCreateProjects: boolean = false;
- 
-	@Column
-	public canDeleteProjects: boolean = false;
- 
-	@Column
-	public canEditProjects: boolean = false;
- 
-	@Column
-	public isInternal: boolean = true;
- 
-	@AllowNull
-	@Column(DataType.TEXT)
-	public description: string | null = null;
- 
-	public getPrivelege(): UserPrivilege {
-		return {
-			privilege : `${this.name}`,
-			description : `${this.description}`,
-			internal : this.isInternal
-		};
-	}
-}
- 
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/model/UserJoinsProject.ts.html b/coverage/project-code/src/db/model/UserJoinsProject.ts.html deleted file mode 100644 index 0783bbd..0000000 --- a/coverage/project-code/src/db/model/UserJoinsProject.ts.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - Code coverage report for project-code/src/db/model/UserJoinsProject.ts - - - - - - - -
-
-

- All files / project-code/src/db/model UserJoinsProject.ts -

-
-
- 55% - Statements - 11/20 -
-
- 100% - Branches - 0/0 -
-
- 0% - Functions - 0/5 -
-
- 71.43% - Lines - 10/14 -
-
-
-
-

-
-
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 -281x -1x -  -1x -1x -  -  -1x -  -  -1x -  -  -  -1x -  -  -  -1x -  -  -  -1x -  -  -1x -  - 
import { default as Project } from './Project';
-import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table
-	} from 'sequelize-typescript';
-import { default as User } from './User';
-import { default as ContributorGroup } from './UserGroup';
- 
-@Table
-export default class UserJoinsProject extends Model<UserJoinsProject> {
-	@ForeignKey(() => User)
-	@Column
-	public username: string = '';
- 
-	@ForeignKey(() => Project)
-	@Column
-	public projectName: string = '';
- 
-	@CreatedAt
-	@Column
-	public joinDate: Date = new Date();
- 
-	@ForeignKey(() => ContributorGroup)
-	@Column
-	public contributorGroupId: number = 0;
- 
-	@BelongsTo(() => ContributorGroup)
-	public contributorGroup: ContributorGroup = new ContributorGroup();
-}
- 
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/model/index.html b/coverage/project-code/src/db/model/index.html deleted file mode 100644 index 0a79060..0000000 --- a/coverage/project-code/src/db/model/index.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - Code coverage report for project-code/src/db/model - - - - - - - -
-
-

- All files project-code/src/db/model -

-
-
- 50.31% - Statements - 81/161 -
-
- 100% - Branches - 0/0 -
-
- 0% - Functions - 0/37 -
-
- 72.12% - Lines - 75/104 -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
ContributorGroup.ts
53.85%14/26100%0/00%0/386.67%13/15
File.ts
48.48%16/33100%0/00%0/771.43%15/21
Project.ts
46.15%12/26100%0/00%0/961.11%11/18
User.ts
46.67%14/30100%0/00%0/1061.9%13/21
UserGroup.ts
53.85%14/26100%0/00%0/386.67%13/15
UserJoinsProject.ts
55%11/20100%0/00%0/571.43%10/14
-
-
- - - - - - - diff --git a/coverage/project-code/src/db/orm.ts.html b/coverage/project-code/src/db/orm.ts.html deleted file mode 100644 index e8b90ab..0000000 --- a/coverage/project-code/src/db/orm.ts.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - Code coverage report for project-code/src/db/orm.ts - - - - - - - -
-
-

- All files / project-code/src/db orm.ts -

-
-
- 0% - Statements - 0/1 -
-
- 100% - Branches - 0/0 -
-
- 100% - Functions - 0/0 -
-
- 0% - Lines - 0/1 -
-
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13  -  -  -  -  -  -  -  -  -  -  -  - 
import { Sequelize } from 'sequelize-typescript';
- 
-const seq: Sequelize = new Sequelize({
-  database: 'be4',
-  dialect: 'postgres',
-  username: 'admin',
-  password: '',
-  operatorsAliases: false,
-  modelPaths: [`${__dirname}/model`]
-});
- 
-export default seq;
- 
-
-
- - - - - - - -- cgit v1.2.1