Skip to content
Snippets Groups Projects
Commit ca14979e authored by vincent.steinman's avatar vincent.steinman Committed by michael.minelli
Browse files

fixed start tag

parent 1ef8b8e8
No related branches found
No related tags found
No related merge requests found
...@@ -33,21 +33,15 @@ class TagRoutes implements RoutesManager { ...@@ -33,21 +33,15 @@ class TagRoutes implements RoutesManager {
name: { name: {
trim: true, trim: true,
notEmpty: true notEmpty: true
},
type: {
custom: {
options: (value: string) => Object.values(TagType).includes(value),
errorMessage: 'Invalid tag type'
}
} }
}; };
registerOnBackend(backend: Express) { registerOnBackend(backend: Express) {
backend.post('/tags', SecurityMiddleware.check(true, SecurityCheckType.TEACHING_STAFF), ParamsValidatorMiddleware.validate(this.tagsValidator), this.addTag.bind(this)); backend.post('/tags', SecurityMiddleware.check(true, SecurityCheckType.TEACHING_STAFF), ParamsValidatorMiddleware.validate(this.tagsValidator), this.addTag.bind(this));
backend.delete('/tags', SecurityMiddleware.check(true, SecurityCheckType.TEACHING_STAFF), ParamsValidatorMiddleware.validate(this.tagsValidator), this.deleteTag.bind(this)); backend.delete('/tags/:tagid', SecurityMiddleware.check(true, SecurityCheckType.ADMIN), ParamsValidatorMiddleware.validate(this.tagsValidator), this.deleteTag.bind(this));
backend.get('/tags/proposals', SecurityMiddleware.check(true, SecurityCheckType.TEACHING_STAFF), ParamsValidatorMiddleware.validate(this.tagsValidator), this.getSubmittedTag.bind(this)); backend.get('/tags/proposals', SecurityMiddleware.check(true, SecurityCheckType.ADMIN), ParamsValidatorMiddleware.validate(this.tagsValidator), this.getSubmittedTag.bind(this));
backend.post('/tags/proposals', SecurityMiddleware.check(true, SecurityCheckType.TEACHING_STAFF), ParamsValidatorMiddleware.validate(this.tagsValidator), this.SubmitTag.bind(this)); backend.post('/tags/proposals', SecurityMiddleware.check(true, SecurityCheckType.TEACHING_STAFF), ParamsValidatorMiddleware.validate(this.tagsValidator), this.SubmitTag.bind(this));
backend.patch('/tags/proposals/{tagProposalName}', SecurityMiddleware.check(true, SecurityCheckType.TEACHING_STAFF), ParamsValidatorMiddleware.validate(this.tagsValidator), this.validateTag.bind(this)); backend.patch('/tags/proposals/:tagProposalName', SecurityMiddleware.check(true, SecurityCheckType.ADMIN), ParamsValidatorMiddleware.validate(this.tagsValidator), this.validateTag.bind(this));
} }
private async addTag(req: express.Request, res: express.Response) { private async addTag(req: express.Request, res: express.Response) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment