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
93ce4f1c
Commit
93ce4f1c
authored
1 year ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
AssignmentRoutes => Correct code to suppress ts-ignore need
parent
1c9957c9
No related branches found
No related tags found
No related merge requests found
Pipeline
#29610
passed
1 year ago
Stage: code_quality
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ExpressAPI/src/routes/AssignmentRoutes.ts
+4
-17
4 additions, 17 deletions
ExpressAPI/src/routes/AssignmentRoutes.ts
with
4 additions
and
17 deletions
ExpressAPI/src/routes/AssignmentRoutes.ts
+
4
−
17
View file @
93ce4f1c
...
...
@@ -25,6 +25,7 @@ import path from 'path';
import
SharedAssignmentHelper
from
'
../shared/helpers/Dojo/SharedAssignmentHelper
'
;
import
GlobalHelper
from
'
../helpers/GlobalHelper
'
;
import
DojoStatusCode
from
'
../shared/types/Dojo/DojoStatusCode
'
;
import
DojoModelsHelper
from
'
../helpers/DojoModelsHelper
'
;
class
AssignmentRoutes
implements
RoutesManager
{
...
...
@@ -66,33 +67,19 @@ class AssignmentRoutes implements RoutesManager {
// Get an assignment by its name or gitlab url
private
async
getAssignment
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
const
assignment
:
Assignment
|
undefined
=
req
.
boundParams
.
assignment
;
const
assignment
:
Partial
<
Assignment
>
|
undefined
=
req
.
boundParams
.
assignment
;
if
(
assignment
&&
!
assignment
.
published
&&
!
await
AssignmentManager
.
isUserAllowedToAccessAssignment
(
assignment
,
req
.
session
.
profile
)
)
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if
(
assignment
&&
!
assignment
.
published
&&
!
await
AssignmentManager
.
isUserAllowedToAccessAssignment
(
assignment
as
Assignment
,
req
.
session
.
profile
)
)
{
delete
assignment
.
gitlabId
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete
assignment
.
gitlabLink
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete
assignment
.
gitlabCreationInfo
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete
assignment
.
gitlabLastInfo
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete
assignment
.
gitlabLastInfoDate
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete
assignment
.
staff
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete
assignment
.
exercises
;
}
return
assignment
?
req
.
session
.
sendResponse
(
res
,
StatusCodes
.
OK
,
assignment
)
:
res
.
status
(
StatusCodes
.
NOT_FOUND
).
send
();
return
assignment
?
req
.
session
.
sendResponse
(
res
,
StatusCodes
.
OK
,
DojoModelsHelper
.
getFullSerializableObject
(
assignment
)
)
:
res
.
status
(
StatusCodes
.
NOT_FOUND
).
send
();
}
private
async
createAssignment
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
...
...
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