Skip to content

Commit

Permalink
EW-1081: Make ptscListKlasseId optional in TspJwtPayload.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkreuzkam-cap committed Dec 5, 2024
1 parent 60c0702 commit 69f45e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class TspProvisioningService {
return email.toLowerCase();
}

private createTspConsent(user: UserDO) {
private createTspConsent(user: UserDO): void {
const userConsent = new UserConsent({
form: 'digital',
privacyConsent: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export class TspJwtPayload implements JwtPayload {
public ptscSchuleNummer!: string;

@IsString()
@IsNotEmpty()
public ptscListKlasseId!: string;
@IsOptional()
public ptscListKlasseId?: string;

constructor(data: Partial<TspJwtPayload>) {
Object.assign(this, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export class TspProvisioningStrategy extends ProvisioningStrategy {
super();
}

getType(): SystemProvisioningStrategy {
public getType(): SystemProvisioningStrategy {
return SystemProvisioningStrategy.TSP;
}

override async getData(input: OauthDataStrategyInputDto): Promise<OauthDataDto> {
public override async getData(input: OauthDataStrategyInputDto): Promise<OauthDataDto> {
const decodedAccessToken: JwtPayload | null = jwt.decode(input.accessToken, { json: true });

if (!decodedAccessToken) {
Expand Down Expand Up @@ -60,8 +60,8 @@ export class TspProvisioningStrategy extends ProvisioningStrategy {
});

const externalClassDtoList = payload.ptscListKlasseId
.split(',')
.map((externalId) => new ExternalClassDto({ externalId }));
? payload.ptscListKlasseId.split(',').map((externalId) => new ExternalClassDto({ externalId }))
: [];

const oauthDataDto = new OauthDataDto({
system: input.system,
Expand All @@ -73,7 +73,7 @@ export class TspProvisioningStrategy extends ProvisioningStrategy {
return oauthDataDto;
}

override async apply(data: OauthDataDto): Promise<ProvisioningDto> {
public override async apply(data: OauthDataDto): Promise<ProvisioningDto> {
if (!data.externalSchool) {
throw new BadDataLoggableException('External school is missing for user', {
externalId: data.externalUser.externalId,
Expand Down

0 comments on commit 69f45e3

Please sign in to comment.