-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add studentCount * add classFilter
- Loading branch information
1 parent
a3fd43f
commit 84ececb
Showing
17 changed files
with
357 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
apps/server/src/modules/group/controller/dto/interface/class-sort-by.enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum ClassSortBy { | ||
NAME = 'name', | ||
EXTERNAL_SOURCE_NAME = 'externalSourceName', | ||
} |
2 changes: 2 additions & 0 deletions
2
apps/server/src/modules/group/controller/dto/interface/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './class-sort-by.enum'; | ||
export * from './school-year-query-type.enum'; |
5 changes: 5 additions & 0 deletions
5
apps/server/src/modules/group/controller/dto/interface/school-year-query-type.enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum SchoolYearQueryType { | ||
NEXT_YEAR = 'nextYear', | ||
CURRENT_YEAR = 'currentYear', | ||
PREVIOUS_YEARS = 'previousYears', | ||
} |
10 changes: 10 additions & 0 deletions
10
apps/server/src/modules/group/controller/dto/request/class-filter-params.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { IsEnum, IsOptional } from 'class-validator'; | ||
import { SchoolYearQueryType } from '../interface'; | ||
|
||
export class ClassFilterParams { | ||
@IsOptional() | ||
@IsEnum(SchoolYearQueryType) | ||
@ApiPropertyOptional({ enum: SchoolYearQueryType, enumName: 'SchoolYearQueryType' }) | ||
type?: SchoolYearQueryType; | ||
} |
6 changes: 1 addition & 5 deletions
6
apps/server/src/modules/group/controller/dto/request/class-sort-params.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './class-sort-params'; | ||
export * from './group-id-params'; | ||
export * from './class-filter-params'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './unknown-query-type-loggable-exception'; |
31 changes: 31 additions & 0 deletions
31
apps/server/src/modules/group/loggable/unknown-query-type-loggable-exception.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { UnknownQueryTypeLoggableException } from './unknown-query-type-loggable-exception'; | ||
|
||
describe('UnknownQueryTypeLoggableException', () => { | ||
describe('getLogMessage', () => { | ||
const setup = () => { | ||
const unknownQueryType = 'unknwon'; | ||
|
||
const exception = new UnknownQueryTypeLoggableException(unknownQueryType); | ||
|
||
return { | ||
exception, | ||
unknownQueryType, | ||
}; | ||
}; | ||
|
||
it('should log the correct message', () => { | ||
const { exception, unknownQueryType } = setup(); | ||
|
||
const result = exception.getLogMessage(); | ||
|
||
expect(result).toEqual({ | ||
type: 'INTERNAL_SERVER_ERROR', | ||
stack: expect.any(String), | ||
message: 'Unable to process unknown query type for class years.', | ||
data: { | ||
unknownQueryType, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
apps/server/src/modules/group/loggable/unknown-query-type-loggable-exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; | ||
import { InternalServerErrorException } from '@nestjs/common'; | ||
|
||
export class UnknownQueryTypeLoggableException extends InternalServerErrorException implements Loggable { | ||
constructor(private readonly unknownQueryType: string) { | ||
super(); | ||
} | ||
|
||
getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage { | ||
return { | ||
type: 'INTERNAL_SERVER_ERROR', | ||
stack: this.stack, | ||
message: 'Unable to process unknown query type for class years.', | ||
data: { | ||
unknownQueryType: this.unknownQueryType, | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.