Skip to content

Commit

Permalink
fix types and validators
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap committed Dec 10, 2024
1 parent 88cc0fb commit 69db884
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Type } from 'class-transformer';
import { IsEnum, IsObject, IsOptional, IsString, ValidateNested } from 'class-validator';
import { SchulconnexGroupType } from './schulconnex-group-type';
import { IsObject, IsOptional, IsString, ValidateNested } from 'class-validator';
import { SchulconnexLaufzeitResponse } from './schulconnex-laufzeit-response';

export class SchulconnexGruppeResponse {
Expand All @@ -10,8 +9,8 @@ export class SchulconnexGruppeResponse {
@IsString()
bezeichnung!: string;

@IsEnum(SchulconnexGroupType)
typ!: SchulconnexGroupType;
@IsString()
typ!: string;

@IsOptional()
@IsObject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import { SchulconnexErreichbarkeitenResponse } from './schulconnex-erreichbarkei
import { SchulconnexGruppenResponse } from './schulconnex-gruppen-response';
import { SchulconnexOrganisationResponse } from './schulconnex-organisation-response';
import { SchulconnexResponseValidationGroups } from './schulconnex-response-validation-groups';
import { SchulconnexRole } from './schulconnex-role';

export class SchulconnexPersonenkontextResponse {
@IsString({ groups: [SchulconnexResponseValidationGroups.USER, SchulconnexResponseValidationGroups.GROUPS] })
id!: string;

@IsString({ groups: [SchulconnexResponseValidationGroups.USER] })
rolle!: SchulconnexRole;
rolle!: string;

@IsObject({ groups: [SchulconnexResponseValidationGroups.SCHOOL] })
@ValidateNested({ groups: [SchulconnexResponseValidationGroups.SCHOOL] })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { GroupRoleUnknownLoggable } from '../../loggable';
import { ProvisioningConfig } from '../../provisioning.config';

const RoleMapping: Partial<Record<SchulconnexRole, RoleName>> = {
const RoleMapping: Partial<Record<SchulconnexRole | string, RoleName>> = {
[SchulconnexRole.LEHR]: RoleName.TEACHER,
[SchulconnexRole.LERN]: RoleName.STUDENT,
[SchulconnexRole.LEIT]: RoleName.ADMINISTRATOR,
Expand All @@ -39,7 +39,7 @@ const GroupRoleMapping: Partial<Record<SchulconnexGroupRole | string, RoleName>>
[SchulconnexGroupRole.STUDENT]: RoleName.STUDENT,
};

const GroupTypeMapping: Partial<Record<SchulconnexGroupType, GroupTypes>> = {
const GroupTypeMapping: Partial<Record<SchulconnexGroupType | string, GroupTypes>> = {
[SchulconnexGroupType.CLASS]: GroupTypes.CLASS,
[SchulconnexGroupType.COURSE]: GroupTypes.COURSE,
[SchulconnexGroupType.OTHER]: GroupTypes.OTHER,
Expand Down

0 comments on commit 69db884

Please sign in to comment.