Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoCLI
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
UI
DojoCLI
Commits
3a139939
Commit
3a139939
authored
1 month ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
DojoBackendManager => Fix get user by type functions
parent
a5606133
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
NodeApp/src/managers/DojoBackendManager.ts
+10
-19
10 additions, 19 deletions
NodeApp/src/managers/DojoBackendManager.ts
with
10 additions
and
19 deletions
NodeApp/src/managers/DojoBackendManager.ts
+
10
−
19
View file @
3a139939
...
...
@@ -17,6 +17,8 @@ import ClientsSharedConfig from '../sharedByClients/config/ClientsSharedConfig
import
inquirer
from
'
inquirer
'
;
import
SharedConfig
from
'
../shared/config/SharedConfig
'
;
import
ConfigFiles
from
'
../config/ConfigFiles
'
;
import
SessionManager
from
'
./SessionManager
'
;
import
UserRole
from
'
../sharedByClients/models/UserRole
'
;
class
DojoBackendManager
{
...
...
@@ -478,7 +480,7 @@ class DojoBackendManager {
public
async
getUserExercises
():
Promise
<
Array
<
Exercise
>
|
undefined
>
{
try
{
const
response
=
await
axios
.
get
<
DojoBackendResponse
<
Array
<
Exercise
>>>
(
DojoBackendHelper
.
getApiUrl
(
ApiRoute
.
EXERCISE_LIST
));
const
response
=
await
axios
.
get
<
DojoBackendResponse
<
Array
<
Exercise
>>>
(
DojoBackendHelper
.
getApiUrl
(
ApiRoute
.
USER_
EXERCISE
S
_LIST
,
{
userId
:
SessionManager
.
profile
?.
id
}
));
return
response
.
data
.
data
;
}
catch
(
error
)
{
console
.
error
(
'
Error fetching user exercises:
'
,
error
);
...
...
@@ -486,13 +488,13 @@ class DojoBackendManager {
}
}
public
async
getExercise
Details
(
exerciseIdOrUrl
:
string
):
Promise
<
Exercise
|
undefined
>
{
public
async
getExercise
(
exerciseIdOrUrl
:
string
):
Promise
<
Exercise
|
undefined
>
{
try
{
const
response
=
await
axios
.
get
<
Exercise
>
(
DojoBackendHelper
.
getApiUrl
(
ApiRoute
.
EXERCISE_
D
ET
AILS_G
ET
,
{
const
response
=
await
axios
.
get
<
DojoBackendResponse
<
Exercise
>
>
(
DojoBackendHelper
.
getApiUrl
(
ApiRoute
.
EXERCISE_
G
ET
_DEL
ET
E
,
{
exerciseIdOrUrl
:
exerciseIdOrUrl
}));
return
response
.
data
;
return
response
.
data
.
data
;
}
catch
(
error
)
{
console
.
error
(
'
Error fetching exercise details:
'
,
error
);
return
undefined
;
...
...
@@ -540,30 +542,19 @@ class DojoBackendManager {
}
}
public
async
getUsers
(
role
Filter
?:
string
):
Promise
<
Array
<
User
>
|
undefined
>
{
public
async
getUsers
(
role
?:
string
):
Promise
<
Array
<
User
>
|
undefined
>
{
try
{
const
response
=
await
axios
.
get
<
DojoBackendResponse
<
Array
<
User
>>>
(
DojoBackendHelper
.
getApiUrl
(
ApiRoute
.
USER_LIST
),
{
params
:
role
Filter
?
{
role
Filter
:
roleFilter
}
:
{}
});
const
response
=
await
axios
.
get
<
DojoBackendResponse
<
Array
<
User
>>>
(
DojoBackendHelper
.
getApiUrl
(
ApiRoute
.
USER_LIST
),
{
params
:
role
?
{
role
:
role
}
:
{}
});
return
response
.
data
.
data
;
}
catch
(
error
)
{
console
.
error
(
'
Error fetching
professo
rs:
'
,
error
);
console
.
error
(
'
Error fetching
use
rs:
'
,
error
);
return
undefined
;
}
}
public
async
getTeachers
():
Promise
<
Array
<
User
>
|
undefined
>
{
return
this
.
getUsers
(
'
teacher
'
);
}
public
async
getExerciseDetail
(
exerciseId
:
string
):
Promise
<
Exercise
|
undefined
>
{
try
{
const
response
=
await
axios
.
get
<
Exercise
>
(
DojoBackendHelper
.
getApiUrl
(
ApiRoute
.
EXERCISE_DETAIL
).
replace
(
'
{{exerciseId}}
'
,
String
(
exerciseId
)));
return
response
.
data
;
}
catch
(
error
)
{
console
.
error
(
'
Error fetching exercise details:
'
,
error
);
return
undefined
;
}
return
this
.
getUsers
(
UserRole
.
TEACHING_STAFF
);
}
}
...
...
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