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
3 changes: 3 additions & 0 deletions graphql/authorizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ export const authorizationModelEnhanceMap: ModelsEnhanceMap = {
referredById: adminOrOwner,
descriptionForScreening: onlyAdminOrScreener,
isAdult: adminOrOwnerOrScreener,
jobStatus: adminOrOwnerOrScreener,
formalEducation: adminOrOwnerOrScreener,
specialTeachingExperience: adminOrOwnerOrScreener,
}),
},

Expand Down
16 changes: 16 additions & 0 deletions graphql/student/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { ForbiddenError } from '../error';
import { CalendarPreferences } from '../types/calendarPreferences';
import redactUsers from '../../common/user/redaction';
import { getStateFromZip } from '../../common/util/stateMappings';
import { student_jobstatus_enum as JobStatus } from '../generated';

const log = getLogger(`StudentMutation`);

Expand Down Expand Up @@ -178,6 +179,15 @@ export class StudentUpdateInput {

@Field((type) => CalendarPreferences, { nullable: true })
calendarPreferences?: CalendarPreferences;

@Field((type) => JobStatus, { nullable: true })
jobStatus?: JobStatus;

@Field((type) => String, { nullable: true })
formalEducation?: string;

@Field((type) => [String], { nullable: true })
specialTeachingExperience?: string[];
}

const logger = getLogger('Student Mutations');
Expand Down Expand Up @@ -207,6 +217,9 @@ export async function updateStudent(
descriptionForMatch,
descriptionForScreening,
calendarPreferences,
jobStatus,
formalEducation,
specialTeachingExperience,
} = update;

if (registrationSource != undefined && !isElevated(context)) {
Expand Down Expand Up @@ -255,6 +268,9 @@ export async function updateStudent(
descriptionForMatch,
descriptionForScreening,
calendarPreferences: ensureNoNull(calendarPreferences as Record<string, any>),
jobStatus: ensureNoNull(jobStatus),
formalEducation: ensureNoNull(formalEducation),
specialTeachingExperience: ensureNoNull(specialTeachingExperience),
},
where: { id: student.id },
});
Expand Down
2 changes: 2 additions & 0 deletions graphql/types/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
school_schooltype_enum,
pupil_email_owner_enum as PupilEmailOwner,
student_screening_status_enum as StudentScreeningStatus,
student_jobstatus_enum as JobStatus,
} from '@prisma/client';
import { LoginOption } from '../../common/secret';
import { StudentScreeningType } from '../../common/student/screening';
Expand Down Expand Up @@ -88,3 +89,4 @@ registerEnumType(school_schooltype_enum, {
registerEnumType(StudentScreeningStatus, { name: 'StudentScreeningStatus' });
registerEnumType(StudentScreeningType, { name: 'StudentScreeningType' });
registerEnumType(AppointmentRole, { name: 'AppointmentRole' });
registerEnumType(JobStatus, { name: 'StudentJobStatus' });
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- CreateEnum
CREATE TYPE "student_jobstatus_enum" AS ENUM ('Student', 'Pupil', 'Employee', 'Retiree', 'Misc', 'Azubi');

-- AlterTable
ALTER TABLE "student" ADD COLUMN "formalEducation" TEXT,
ADD COLUMN "jobStatus" "student_jobstatus_enum",
ADD COLUMN "specialTeachingExperience" TEXT[] DEFAULT ARRAY[]::TEXT[];
18 changes: 15 additions & 3 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,9 @@ model student {
// Stores a structure like { weeklyAvailability: { monday: [{ from: 600 (minutes of the day), to: 660 }, ...], friday: [{ from: 780, to: 840 }], ... } }
calendarPreferences Json? @db.Json
subcourse_mentors_student subcourse_mentors_student[]
jobStatus student_jobstatus_enum?
formalEducation String?
specialTeachingExperience String[] @default([])
}

// A concrete course with participants, each course might have multiple subcourses with different instructors
Expand Down Expand Up @@ -1179,7 +1182,7 @@ enum pupil_schooltype_enum {
hauptschule
realschule
gymnasium
f_rderschule @map("förderschule")
f_rderschule @map("förderschule")
berufsschule
mittelschule
oberschule
Expand Down Expand Up @@ -1227,7 +1230,7 @@ enum school_schooltype_enum {
hauptschule
realschule
gymnasium
f_rderschule @map("förderschule")
f_rderschule @map("förderschule")
berufsschule
mittelschule
oberschule
Expand Down Expand Up @@ -1393,7 +1396,7 @@ enum course_schooltype_enum {
hauptschule
realschule
gymnasium
f_rderschule @map("förderschule")
f_rderschule @map("förderschule")
berufsschule
mittelschule
oberschule
Expand Down Expand Up @@ -1564,3 +1567,12 @@ enum student_screening_status_enum {
rejection @map("2")
missed @map("3")
}

enum student_jobstatus_enum {
Student
Pupil
Employee
Retiree
Misc
Azubi
}