-
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
- Loading branch information
1 parent
dded4fe
commit 873e20c
Showing
15 changed files
with
316 additions
and
14 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
2 changes: 1 addition & 1 deletion
2
apps/server/src/modules/provisioning/dto/external-school.dto.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
File renamed without changes.
File renamed without changes.
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,5 +1,7 @@ | ||
export * from './user-for-group-not-found.loggable'; | ||
export * from './school-for-group-not-found.loggable'; | ||
export * from './bad-data.loggable-exception'; | ||
export * from './school-name-required-loggable-exception'; | ||
export * from './group-role-unknown.loggable'; | ||
export { SchoolExternalToolCreatedLoggable } from './school-external-tool-created.loggable'; | ||
export { FetchingPoliciesInfoFailedLoggable } from './fetching-policies-info-failed.loggable'; |
28 changes: 28 additions & 0 deletions
28
.../server/src/modules/provisioning/loggable/school-name-required-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,28 @@ | ||
import { SchoolNameRequiredLoggableException } from './school-name-required-loggable-exception'; | ||
|
||
describe(SchoolNameRequiredLoggableException.name, () => { | ||
describe('getLogMessage', () => { | ||
const setup = () => { | ||
const fieldName = 'id_token'; | ||
|
||
const exception = new SchoolNameRequiredLoggableException(fieldName); | ||
|
||
return { exception, fieldName }; | ||
}; | ||
|
||
it('should return a LogMessage', () => { | ||
const { exception, fieldName } = setup(); | ||
|
||
const logMessage = exception.getLogMessage(); | ||
|
||
expect(logMessage).toEqual({ | ||
type: 'SCHOOL_NAME_REQUIRED', | ||
message: 'External school name is required', | ||
stack: exception.stack, | ||
data: { | ||
fieldName, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
apps/server/src/modules/provisioning/loggable/school-name-required-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,27 @@ | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { BusinessError } from '@shared/common'; | ||
import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; | ||
|
||
export class SchoolNameRequiredLoggableException extends BusinessError implements Loggable { | ||
constructor(private readonly fieldName: string) { | ||
super( | ||
{ | ||
type: 'SCHOOL_NAME_REQUIRED', | ||
title: 'School name is required', | ||
defaultMessage: 'External school name is required', | ||
}, | ||
HttpStatus.INTERNAL_SERVER_ERROR | ||
); | ||
} | ||
|
||
getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage { | ||
return { | ||
type: this.type, | ||
message: this.message, | ||
stack: this.stack, | ||
data: { | ||
fieldName: this.fieldName, | ||
}, | ||
}; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
apps/server/src/modules/provisioning/strategy/loggable/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 |
---|---|---|
@@ -1 +1 @@ | ||
export * from './bad-data.loggable-exception'; | ||
export * from '../../loggable/bad-data.loggable-exception'; |
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
35 changes: 35 additions & 0 deletions
35
apps/server/src/modules/provisioning/strategy/tsp/tsp.jwt.payload.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,35 @@ | ||
import { IsString, IsOptional, IsArray } from 'class-validator'; | ||
import { JwtPayload } from 'jsonwebtoken'; | ||
|
||
export class TspJwtPayload implements JwtPayload { | ||
@IsString() | ||
public sub!: string; | ||
|
||
@IsOptional() | ||
@IsString() | ||
public sid: string | undefined; | ||
|
||
@IsOptional() | ||
@IsString() | ||
public ptscListRolle: string | undefined; | ||
|
||
@IsOptional() | ||
@IsString() | ||
public personVorname: string | undefined; | ||
|
||
@IsOptional() | ||
@IsString() | ||
public personNachname: string | undefined; | ||
|
||
@IsOptional() | ||
@IsString() | ||
public ptscSchuleNummer: string | undefined; | ||
|
||
@IsOptional() | ||
@IsArray() | ||
public ptscListKlasseId: [] | undefined; | ||
|
||
constructor(data: Partial<TspJwtPayload>) { | ||
Object.assign(this, data); | ||
} | ||
} |
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.