refactor: update user identification to pass userId directly to services instead of JWT tokens.
Some checks failed
Build and Deploy Backend / Build Backend Docker Image (push) Successful in 48s
Build and Deploy Backend / Deploy E-learning Backend to Dev Server (push) Successful in 9s
Build and Deploy Backend / Notify Deployment Status (push) Successful in 2s
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Failing after 33s
Build and Deploy Frontend Learner / Deploy E-learning Frontend Learner to Dev Server (push) Has been skipped
Build and Deploy Frontend Learner / Notify Deployment Status (push) Failing after 1s
Some checks failed
Build and Deploy Backend / Build Backend Docker Image (push) Successful in 48s
Build and Deploy Backend / Deploy E-learning Backend to Dev Server (push) Successful in 9s
Build and Deploy Backend / Notify Deployment Status (push) Successful in 2s
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Failing after 33s
Build and Deploy Frontend Learner / Deploy E-learning Frontend Learner to Dev Server (push) Has been skipped
Build and Deploy Frontend Learner / Notify Deployment Status (push) Failing after 1s
This commit is contained in:
parent
b6c1aebe30
commit
522a0eec8a
28 changed files with 558 additions and 952 deletions
|
|
@ -27,13 +27,11 @@ export class CategoriesAdminController {
|
|||
@SuccessResponse('200', 'Category created successfully')
|
||||
@Response('401', 'Invalid or expired token')
|
||||
public async createCategory(@Request() request: any, @Body() body: createCategory): Promise<createCategoryResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '') || '';
|
||||
|
||||
// Validate body
|
||||
const { error } = CreateCategoryValidator.validate(body);
|
||||
if (error) throw new ValidationError(error.details[0].message);
|
||||
|
||||
return await this.categoryService.createCategory(token, body);
|
||||
return await this.categoryService.createCategory(request.user.id, body);
|
||||
}
|
||||
|
||||
@Put('{id}')
|
||||
|
|
@ -41,13 +39,11 @@ export class CategoriesAdminController {
|
|||
@SuccessResponse('200', 'Category updated successfully')
|
||||
@Response('401', 'Invalid or expired token')
|
||||
public async updateCategory(@Request() request: any, @Body() body: updateCategory): Promise<updateCategoryResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '') || '';
|
||||
|
||||
// Validate body
|
||||
const { error } = UpdateCategoryValidator.validate(body);
|
||||
if (error) throw new ValidationError(error.details[0].message);
|
||||
|
||||
return await this.categoryService.updateCategory(token, body.id, body);
|
||||
return await this.categoryService.updateCategory(request.user.id, body.id, body);
|
||||
}
|
||||
|
||||
@Delete('{id}')
|
||||
|
|
@ -55,7 +51,6 @@ export class CategoriesAdminController {
|
|||
@SuccessResponse('200', 'Category deleted successfully')
|
||||
@Response('401', 'Invalid or expired token')
|
||||
public async deleteCategory(@Request() request: any, @Path() id: number): Promise<deleteCategoryResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '') || '';
|
||||
return await this.categoryService.deleteCategory(token, id);
|
||||
return await this.categoryService.deleteCategory(request.user.id, id);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue