Updated some nameing to fit with the rest of the models
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
ref #37
This commit is contained in:
parent
ca142376b3
commit
4a21c1fb5c
@ -67,7 +67,7 @@ export class CreateUser {
|
|||||||
* Optional.
|
* Optional.
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
group?: number[] | number
|
groups?: number[] | number
|
||||||
|
|
||||||
//TODO: ProfilePics
|
//TODO: ProfilePics
|
||||||
|
|
||||||
@ -95,13 +95,16 @@ export class CreateUser {
|
|||||||
return newUser;
|
return newUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get's all groups for this user by their id's;
|
||||||
|
*/
|
||||||
public async getGroups() {
|
public async getGroups() {
|
||||||
if (!this.group) { return null; }
|
if (!this.groups) { return null; }
|
||||||
let groups = new Array<UserGroup>();
|
let groups = new Array<UserGroup>();
|
||||||
if (!Array.isArray(this.group)) {
|
if (!Array.isArray(this.groups)) {
|
||||||
this.group = [this.group]
|
this.groups = [this.groups]
|
||||||
}
|
}
|
||||||
for (let group of this.group) {
|
for (let group of this.groups) {
|
||||||
let found = await getConnectionManager().get().getRepository(UserGroup).findOne({ id: group });
|
let found = await getConnectionManager().get().getRepository(UserGroup).findOne({ id: group });
|
||||||
if (!found) { throw new UserGroupNotFoundError(); }
|
if (!found) { throw new UserGroupNotFoundError(); }
|
||||||
groups.push(found);
|
groups.push(found);
|
||||||
|
@ -29,7 +29,7 @@ export default class SeedUsers implements Seeder {
|
|||||||
initialUser.lastname = "demo";
|
initialUser.lastname = "demo";
|
||||||
initialUser.username = "demo";
|
initialUser.username = "demo";
|
||||||
initialUser.password = "demo";
|
initialUser.password = "demo";
|
||||||
initialUser.group = group;
|
initialUser.groups = group;
|
||||||
return await connection.getRepository(User).save(await initialUser.toUser());
|
return await connection.getRepository(User).save(await initialUser.toUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user