Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/api/project-result/projectResult.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ export class ProjectResultController {
}

@Get('/projectResult')
@Roles(UserRole.Reviewer, UserRole.Copilot, UserRole.Submitter)
@Roles(
UserRole.Reviewer,
UserRole.Copilot,
UserRole.Submitter,
UserRole.Admin,
)
@Scopes(Scope.ReadProjectResult)
@ApiOperation({
summary: 'Get project results',
Expand Down
15 changes: 4 additions & 11 deletions src/api/review-type/review-type.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from 'src/dto/reviewType.dto';
import { PrismaService } from '../../shared/modules/global/prisma.service';
import { LoggerService } from '../../shared/modules/global/logger.service';
import { PaginatedResponse, PaginationDto } from '../../dto/pagination.dto';
import { PaginationDto } from '../../dto/pagination.dto';
import { SortDto } from '../../dto/sort.dto';
import { PrismaErrorService } from '../../shared/modules/global/prisma-error.service';

Expand Down Expand Up @@ -171,6 +171,7 @@ export class ReviewTypeController {
UserRole.Admin,
UserRole.Submitter,
UserRole.Reviewer,
UserRole.Talent,
)
@Scopes(Scope.ReadReviewType)
@ApiOperation({
Expand All @@ -187,7 +188,7 @@ export class ReviewTypeController {
@Query() queryDto: ReviewTypeQueryDto,
@Query() paginationDto?: PaginationDto,
@Query() sortDto?: SortDto,
): Promise<PaginatedResponse<ReviewTypeResponseDto>> {
): Promise<ReviewTypeResponseDto[]> {
this.logger.log(
`Getting review types with filters - ${JSON.stringify(queryDto)}`,
);
Expand Down Expand Up @@ -234,15 +235,7 @@ export class ReviewTypeController {
`Found ${reviewTypes.length} review types (page ${page} of ${Math.ceil(totalCount / perPage)})`,
);

return {
data: reviewTypes as ReviewTypeResponseDto[],
meta: {
page,
perPage,
totalCount,
totalPages: Math.ceil(totalCount / perPage),
},
};
return reviewTypes as ReviewTypeResponseDto[];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the meta object from the return statement changes the structure of the response. If the meta information is required by the client or other parts of the application, consider whether this change might break existing functionality or if additional adjustments are needed elsewhere in the codebase to accommodate this change.

} catch (error) {
const errorResponse = this.prismaErrorService.handleError(
error,
Expand Down
12 changes: 9 additions & 3 deletions src/api/submission/submission.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
ArtifactsListResponseDto,
} from 'src/dto/artifacts.dto';
import { LoggerService } from '../../shared/modules/global/logger.service';
import { PaginatedResponse, PaginationDto } from '../../dto/pagination.dto';
import { PaginationDto } from '../../dto/pagination.dto';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PaginatedResponse import has been removed. Ensure that this type is no longer used in the code. If it is still needed, it should be re-imported.

import { SortDto } from '../../dto/sort.dto';
import { SubmissionService } from './submission.service';
import { JwtUser } from 'src/shared/modules/global/jwt.service';
Expand Down Expand Up @@ -150,6 +150,7 @@ export class SubmissionController {
UserRole.Admin,
UserRole.Submitter,
UserRole.Reviewer,
UserRole.Talent,
)
@Scopes(Scope.ReadSubmission)
@ApiOperation({
Expand All @@ -166,11 +167,16 @@ export class SubmissionController {
@Query() queryDto: SubmissionQueryDto,
@Query() paginationDto?: PaginationDto,
@Query() sortDto?: SortDto,
): Promise<PaginatedResponse<SubmissionResponseDto>> {
): Promise<SubmissionResponseDto[]> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type of the function has been changed from Promise<PaginatedResponse<SubmissionResponseDto>> to Promise<SubmissionResponseDto[]>. Ensure that this change is intentional and that all parts of the codebase that depend on this method are updated accordingly to handle the new return type.

this.logger.log(
`Getting submissions with filters - ${JSON.stringify(queryDto)}`,
);
return this.service.listSubmission(queryDto, paginationDto, sortDto);
const paginatedData = await this.service.listSubmission(
queryDto,
paginationDto,
sortDto,
);
return paginatedData.data;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method now returns paginatedData.data. Verify that paginatedData.data is always an array of SubmissionResponseDto and that it handles cases where paginatedData.data might be undefined or null.

}

@Get('/:submissionId')
Expand Down