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
b6fb2df8
Commit
b6fb2df8
authored
1 year ago
by
vincent.steinman
Committed by
michael.minelli
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fixed answer to submission but removed URL param
parent
2200cfae
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#32714
failed
11 months ago
Stage: code_quality
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ExpressAPI/src/managers/TagSubmitManager.ts
+1
-1
1 addition, 1 deletion
ExpressAPI/src/managers/TagSubmitManager.ts
ExpressAPI/src/routes/TagsRoutes.ts
+5
-13
5 additions, 13 deletions
ExpressAPI/src/routes/TagsRoutes.ts
with
6 additions
and
14 deletions
ExpressAPI/src/managers/TagSubmitManager.ts
+
1
−
1
View file @
b6fb2df8
import
{
Prisma
,
SubmissionTag
}
from
'
@prisma/client
'
;
import
{
SubmissionTag
}
from
'
@prisma/client
'
;
import
db
from
'
../helpers/DatabaseHelper
'
;
import
db
from
'
../helpers/DatabaseHelper
'
;
class
TagSubmitManager
{
class
TagSubmitManager
{
...
...
This diff is collapsed.
Click to expand it.
ExpressAPI/src/routes/TagsRoutes.ts
+
5
−
13
View file @
b6fb2df8
...
@@ -9,13 +9,6 @@ import SecurityCheckType from '../types/SecurityCheckType';
...
@@ -9,13 +9,6 @@ import SecurityCheckType from '../types/SecurityCheckType';
import
SecurityMiddleware
from
'
../middlewares/SecurityMiddleware
'
;
import
SecurityMiddleware
from
'
../middlewares/SecurityMiddleware
'
;
import
ParamsValidatorMiddleware
from
'
../middlewares/ParamsValidatorMiddleware
'
;
import
ParamsValidatorMiddleware
from
'
../middlewares/ParamsValidatorMiddleware
'
;
enum
SubmitStatus
{
PendingApproval
,
Declined
,
Approved
}
class
TagRoutes
implements
RoutesManager
{
class
TagRoutes
implements
RoutesManager
{
private
readonly
tagsValidatorNameType
:
ExpressValidator
.
Schema
=
{
private
readonly
tagsValidatorNameType
:
ExpressValidator
.
Schema
=
{
name
:
{
name
:
{
...
@@ -47,7 +40,7 @@ class TagRoutes implements RoutesManager {
...
@@ -47,7 +40,7 @@ class TagRoutes implements RoutesManager {
backend
.
delete
(
'
/tags/:tageName
'
,
SecurityMiddleware
.
check
(
true
,
SecurityCheckType
.
ADMIN
),
this
.
deleteTag
.
bind
(
this
));
backend
.
delete
(
'
/tags/:tageName
'
,
SecurityMiddleware
.
check
(
true
,
SecurityCheckType
.
ADMIN
),
this
.
deleteTag
.
bind
(
this
));
backend
.
get
(
'
/tags/proposals/:state
'
,
SecurityMiddleware
.
check
(
true
,
SecurityCheckType
.
ADMIN
),
this
.
getSubmittedTag
.
bind
(
this
));
backend
.
get
(
'
/tags/proposals/:state
'
,
SecurityMiddleware
.
check
(
true
,
SecurityCheckType
.
ADMIN
),
this
.
getSubmittedTag
.
bind
(
this
));
backend
.
post
(
'
/tags/proposals
'
,
SecurityMiddleware
.
check
(
true
,
SecurityCheckType
.
TEACHING_STAFF
),
ParamsValidatorMiddleware
.
validate
(
this
.
tagsValidatorNameType
),
this
.
SubmitTag
.
bind
(
this
));
backend
.
post
(
'
/tags/proposals
'
,
SecurityMiddleware
.
check
(
true
,
SecurityCheckType
.
TEACHING_STAFF
),
ParamsValidatorMiddleware
.
validate
(
this
.
tagsValidatorNameType
),
this
.
SubmitTag
.
bind
(
this
));
backend
.
patch
(
'
/tags/proposals
/:tagProposalName
'
,
SecurityMiddleware
.
check
(
true
,
SecurityCheckType
.
ADMIN
),
ParamsValidatorMiddleware
.
validate
(
this
.
tagsValidatorName
),
this
.
validateTag
.
bind
(
this
));
backend
.
patch
(
'
/tags/proposals
'
,
SecurityMiddleware
.
check
(
true
,
SecurityCheckType
.
ADMIN
),
ParamsValidatorMiddleware
.
validate
(
this
.
tagsValidatorName
),
this
.
validateTag
.
bind
(
this
));
}
}
private
async
addTag
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
private
async
addTag
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
...
@@ -92,7 +85,6 @@ class TagRoutes implements RoutesManager {
...
@@ -92,7 +85,6 @@ class TagRoutes implements RoutesManager {
private
async
SubmitTag
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
private
async
SubmitTag
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
const
tagName
=
req
.
body
.
name
const
tagName
=
req
.
body
.
name
const
tagType
=
req
.
body
.
type
const
tagType
=
req
.
body
.
type
const
tagState
=
req
.
body
.
state
db
.
submissionTag
.
upsert
({
db
.
submissionTag
.
upsert
({
where
:
{
name
:
tagName
},
where
:
{
name
:
tagName
},
...
@@ -100,7 +92,7 @@ class TagRoutes implements RoutesManager {
...
@@ -100,7 +92,7 @@ class TagRoutes implements RoutesManager {
create
:
{
create
:
{
name
:
tagName
,
name
:
tagName
,
type
:
tagType
,
type
:
tagType
,
state
:
tagState
state
:
"
PendingApproval
"
}
}
})
})
...
@@ -112,13 +104,13 @@ class TagRoutes implements RoutesManager {
...
@@ -112,13 +104,13 @@ class TagRoutes implements RoutesManager {
private
async
validateTag
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
private
async
validateTag
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
const
state
=
req
.
body
.
state
const
state
=
req
.
body
.
state
if
(
state
==
SubmitStatus
.
PendingApproval
){
if
(
state
==
"
PendingApproval
"
){
return
req
.
session
.
sendResponse
(
res
,
StatusCodes
.
OK
,
"
Approbation toujours en attente
"
);
return
req
.
session
.
sendResponse
(
res
,
StatusCodes
.
OK
,
"
Approbation toujours en attente
"
);
}
else
if
(
state
==
SubmitStatus
.
Declined
){
}
else
if
(
state
==
"
Declined
"
){
const
detail
=
req
.
body
.
details
const
detail
=
req
.
body
.
details
return
req
.
session
.
sendResponse
(
res
,
StatusCodes
.
OK
,
detail
);
return
req
.
session
.
sendResponse
(
res
,
StatusCodes
.
OK
,
detail
);
}
else
{
}
else
{
const
tagName
=
req
.
params
.
tagProposalName
const
tagName
=
req
.
body
.
tagProposalName
const
tagType
=
req
.
body
.
type
const
tagType
=
req
.
body
.
type
db
.
tag
.
upsert
({
db
.
tag
.
upsert
({
where
:
{
name
:
tagName
},
where
:
{
name
:
tagName
},
...
...
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