Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoBackendAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
Backend
DojoBackendAPI
Commits
0d74662d
Commit
0d74662d
authored
1 year ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
GitlabManager => Correct get user by id for the new gitlab api specs
parent
690cfff7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ExpressAPI/src/managers/GitlabManager.ts
+13
-8
13 additions, 8 deletions
ExpressAPI/src/managers/GitlabManager.ts
with
13 additions
and
8 deletions
ExpressAPI/src/managers/GitlabManager.ts
+
13
−
8
View file @
0d74662d
...
...
@@ -18,22 +18,27 @@ class GitlabManager {
return
`
${
Config
.
gitlab
.
apiURL
}${
route
}
`
;
}
p
rivate
async
get
GitlabUser
(
paramToSearch
:
string
|
number
,
paramName
:
string
):
Promise
<
GitlabUser
|
undefined
>
{
p
ublic
async
get
UserById
(
id
:
number
):
Promise
<
GitlabUser
|
undefined
>
{
try
{
const
params
:
any
=
{};
params
[
paramName
]
=
paramToSearch
;
return
(
await
axios
.
get
<
Array
<
GitlabUser
>>
(
this
.
getApiUrl
(
GitlabRoute
.
USERS_GET
),
{
params
:
params
})).
data
[
0
];
const
user
=
(
await
axios
.
get
<
GitlabUser
>
(
`
${
this
.
getApiUrl
(
GitlabRoute
.
USERS_GET
)
}
/
${
String
(
id
)
}
`
,
{
params
:
params
})).
data
;
return
user
.
id
===
id
?
user
:
undefined
;
}
catch
(
e
)
{
}
return
undefined
;
}
public
async
getUserById
(
id
:
number
):
Promise
<
GitlabUser
|
undefined
>
{
return
await
this
.
getGitlabUser
(
id
,
'
id
'
);
}
public
async
getUserByUsername
(
username
:
string
):
Promise
<
GitlabUser
|
undefined
>
{
return
await
this
.
getGitlabUser
(
username
,
'
search
'
);
try
{
const
params
:
any
=
{};
params
[
'
search
'
]
=
username
;
const
user
=
(
await
axios
.
get
<
Array
<
GitlabUser
>>
(
this
.
getApiUrl
(
GitlabRoute
.
USERS_GET
),
{
params
:
params
})).
data
[
0
];
return
user
.
username
===
username
?
user
:
undefined
;
}
catch
(
e
)
{
}
return
undefined
;
}
async
getRepository
(
idOrNamespace
:
string
):
Promise
<
GitlabRepository
>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment