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