Skip to content
Snippets Groups Projects
Commit a3d21732 authored by michael.minelli's avatar michael.minelli
Browse files

UserManager => Add get by id functions

parent dc9e2e93
Branches
Tags
No related merge requests found
...@@ -34,6 +34,16 @@ class UserManager { ...@@ -34,6 +34,16 @@ class UserManager {
async getByIds(ids: Array<number>): Promise<Array<User>> { async getByIds(ids: Array<number>): Promise<Array<User>> {
return Promise.all(ids.map(userId => this.getById(userId))); return Promise.all(ids.map(userId => this.getById(userId)));
} }
async getByGitlabId(gitlabId: number): Promise<User | undefined> {
const raw = await db<User>(User.tableName).where('userGitlabId', gitlabId).first();
return raw ? this.createObjectFromRawSql(raw) : undefined;
}
async getByGitlabIds(gitlabIds: Array<number>): Promise<Array<User>> {
return Promise.all(gitlabIds.map(gitlabId => this.getByGitlabId(gitlabId)));
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment