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
18 changes: 9 additions & 9 deletions src/modules/curriculum/curriculum.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { CurriculumService } from './services/curriculum.service';
import { ListDepartmentsQueryDto } from './dto/requests/list-departments-query.dto';
import { ListProgramsQueryDto } from './dto/requests/list-programs-query.dto';
import { ListCoursesQueryDto } from './dto/requests/list-courses-query.dto';
import { DepartmentItemResponseDto } from './dto/responses/department-item.response.dto';
import { ProgramItemResponseDto } from './dto/responses/program-item.response.dto';
import { CourseItemResponseDto } from './dto/responses/course-item.response.dto';
import { DepartmentListResponseDto } from './dto/responses/department-list.response.dto';
import { ProgramListResponseDto } from './dto/responses/program-list.response.dto';
import { CourseListResponseDto } from './dto/responses/course-list.response.dto';

@ApiTags('Curriculum')
@Controller('curriculum')
Expand All @@ -20,28 +20,28 @@ export class CurriculumController {

@Get('departments')
@ApiOperation({ summary: 'List departments scoped to caller role' })
@ApiResponse({ status: 200, type: [DepartmentItemResponseDto] })
@ApiResponse({ status: 200, type: DepartmentListResponseDto })
async ListDepartments(
@Query() query: ListDepartmentsQueryDto,
): Promise<DepartmentItemResponseDto[]> {
): Promise<DepartmentListResponseDto> {
return this.curriculumService.ListDepartments(query);
}

@Get('programs')
@ApiOperation({ summary: 'List programs scoped to caller role' })
@ApiResponse({ status: 200, type: [ProgramItemResponseDto] })
@ApiResponse({ status: 200, type: ProgramListResponseDto })
async ListPrograms(
@Query() query: ListProgramsQueryDto,
): Promise<ProgramItemResponseDto[]> {
): Promise<ProgramListResponseDto> {
return this.curriculumService.ListPrograms(query);
}

@Get('courses')
@ApiOperation({ summary: 'List courses scoped to caller role' })
@ApiResponse({ status: 200, type: [CourseItemResponseDto] })
@ApiResponse({ status: 200, type: CourseListResponseDto })
async ListCourses(
@Query() query: ListCoursesQueryDto,
): Promise<CourseItemResponseDto[]> {
): Promise<CourseListResponseDto> {
return this.curriculumService.ListCourses(query);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {
MaxLength,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PaginationQueryDto } from 'src/modules/common/dto/pagination-query.dto';

export class ListCoursesQueryDto {
export class ListCoursesQueryDto extends PaginationQueryDto {
@ApiProperty({ description: 'Semester UUID to scope course list' })
@IsUUID()
@IsNotEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {
MaxLength,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PaginationQueryDto } from 'src/modules/common/dto/pagination-query.dto';

export class ListDepartmentsQueryDto {
export class ListDepartmentsQueryDto extends PaginationQueryDto {
@ApiProperty({ description: 'Semester UUID to scope department list' })
@IsUUID()
@IsNotEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {
MaxLength,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PaginationQueryDto } from 'src/modules/common/dto/pagination-query.dto';

export class ListProgramsQueryDto {
export class ListProgramsQueryDto extends PaginationQueryDto {
@ApiProperty({ description: 'Semester UUID to scope program list' })
@IsUUID()
@IsNotEmpty()
Expand Down
11 changes: 11 additions & 0 deletions src/modules/curriculum/dto/responses/course-list.response.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ApiProperty } from '@nestjs/swagger';
import { PaginationMeta } from 'src/modules/common/dto/pagination.dto';
import { CourseItemResponseDto } from './course-item.response.dto';

export class CourseListResponseDto {
@ApiProperty({ type: [CourseItemResponseDto] })
data: CourseItemResponseDto[];

@ApiProperty({ type: PaginationMeta })
meta: PaginationMeta;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ApiProperty } from '@nestjs/swagger';
import { PaginationMeta } from 'src/modules/common/dto/pagination.dto';
import { DepartmentItemResponseDto } from './department-item.response.dto';

export class DepartmentListResponseDto {
@ApiProperty({ type: [DepartmentItemResponseDto] })
data: DepartmentItemResponseDto[];

@ApiProperty({ type: PaginationMeta })
meta: PaginationMeta;
}
11 changes: 11 additions & 0 deletions src/modules/curriculum/dto/responses/program-list.response.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ApiProperty } from '@nestjs/swagger';
import { PaginationMeta } from 'src/modules/common/dto/pagination.dto';
import { ProgramItemResponseDto } from './program-item.response.dto';

export class ProgramListResponseDto {
@ApiProperty({ type: [ProgramItemResponseDto] })
data: ProgramItemResponseDto[];

@ApiProperty({ type: PaginationMeta })
meta: PaginationMeta;
}
Loading
Loading