db

package
v1.218.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: BSD-3-Clause Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveSemester added in v1.179.0

type ActiveSemester struct {
	Semester string `bson:"semester"`
	Database string `bson:"database"`
}

ActiveSemester records the last activated semester (and the database it lived in), stored globally so the next start can resume it.

type CollectionName

type CollectionName string

type Conflict

type Conflict struct {
	AnCode     int
	Module     string
	MainExamer string
	Conflicts  map[int]int
}

type Count

type Count struct {
	AnCode int `bson:"AnCo"`
	Sum    int `bson:"Sum"`
}

type DB

type DB struct {
	Client *mongo.Client
	// contains filtered or unexported fields
}

func NewDB

func NewDB(uri, semester string, dbName *string) (*DB, error)

func (*DB) AddAncode

func (db *DB) AddAncode(ctx context.Context, zpaAncode int, program string, primussAncode int) error

func (*DB) AddConstraints added in v1.20.0

func (db *DB) AddConstraints(ctx context.Context, ancode int, constraints *model.Constraints) (*model.Constraints, error)

func (*DB) AddExamToSlot

func (db *DB) AddExamToSlot(ctx context.Context, planEntry *model.PlanEntry) (bool, error)

func (*DB) AddExternalExam

func (db *DB) AddExternalExam(ctx context.Context, exam *model.ZPAExam) error

func (*DB) AddInvigilation

func (db *DB) AddInvigilation(ctx context.Context, room string, day, slot, invigilatorID int) error

func (*DB) AddMutationLogEntry added in v1.168.0

func (db *DB) AddMutationLogEntry(ctx context.Context, entry *model.MutationLogEntry) error

AddMutationLogEntry appends one mutating-operation entry to the per-semester mutation_log collection.

func (*DB) AddNta

func (db *DB) AddNta(ctx context.Context, nta *model.NTA) (*model.NTA, error)

func (*DB) AddNtaRoomAloneWaiver added in v1.131.0

func (db *DB) AddNtaRoomAloneWaiver(ctx context.Context, waiver *model.NtaRoomAloneWaiver) error

AddNtaRoomAloneWaiver stores (or replaces) a waiver (key: mtknr/ancode).

func (*DB) AddPrePlannedInvigilation added in v1.84.0

func (db *DB) AddPrePlannedInvigilation(ctx context.Context, prePlannedInvigilation *model.PrePlannedInvigilation) (bool, error)

func (*DB) AddPrePlannedRoomToExam added in v1.33.0

func (db *DB) AddPrePlannedRoomToExam(ctx context.Context, prePlannedRoom *model.PrePlannedRoom) (bool, error)

func (*DB) AddRoom added in v1.113.0

func (db *DB) AddRoom(ctx context.Context, room *model.Room) (*model.Room, error)

AddRoom inserts a new room and returns it.

func (*DB) AddRoomRequest added in v1.117.0

func (db *DB) AddRoomRequest(ctx context.Context, request *model.RoomRequest) error

AddRoomRequest inserts a single room request.

func (*DB) AddStudentReg added in v1.36.0

func (db *DB) AddStudentReg(ctx context.Context, program string, ancode int, mtknr string) error

func (*DB) AddSyncLogEntry added in v1.156.0

func (db *DB) AddSyncLogEntry(ctx context.Context, entry *model.SyncLogEntry) error

AddSyncLogEntry appends one transfer event to the sync-log history.

func (*DB) AddZpaExamToPlan

func (db *DB) AddZpaExamToPlan(ctx context.Context, ancode int) (bool, error)

func (*DB) AdditionalExams

func (db *DB) AdditionalExams(ctx context.Context) ([]*model.AdditionalExam, error)

AdditionalExams returns all additional (publish-only) exams.

func (*DB) AllAnnyBookings added in v1.77.0

func (db *DB) AllAnnyBookings(ctx context.Context) ([]*model.AnnyBooking, error)

func (*DB) AllInvigilatorRequirements added in v1.152.0

func (db *DB) AllInvigilatorRequirements(ctx context.Context) ([]*zpa.SupervisorRequirements, error)

AllInvigilatorRequirements returns all stored ZPA invigilator requirements.

func (*DB) AllSemesterNames

func (db *DB) AllSemesterNames(ctx context.Context) ([]*model.Semester, error)

AllSemesterNames lists the plexams workspaces: every database carrying a semester config or meta. The id is the database name (the switch key); semester is the logical semester (for ZPA), which may differ from the database name.

func (*DB) AncodesInPlan

func (db *DB) AncodesInPlan(ctx context.Context) ([]int, error)

func (*DB) AnnyBookings added in v1.77.0

func (db *DB) AnnyBookings(ctx context.Context, room *string) ([]*model.AnnyBooking, error)

func (*DB) AnnyBookingsCollection added in v1.77.0

func (db *DB) AnnyBookingsCollection(ctx context.Context) *mongo.Collection

func (*DB) BackupPlan

func (db *DB) BackupPlan(ctx context.Context) error

func (*DB) BlockRoomForSlot added in v1.119.0

func (db *DB) BlockRoomForSlot(ctx context.Context, block *model.BlockedRoom) error

BlockRoomForSlot stores (or updates) a room-slot block (key: room/day/slot).

func (*DB) BlockedRooms added in v1.119.0

func (db *DB) BlockedRooms(ctx context.Context) ([]*model.BlockedRoom, error)

BlockedRooms returns all room-slot blocks of the semester, sorted by room/day/slot.

func (*DB) CacheAssembledExams added in v1.204.0

func (db *DB) CacheAssembledExams(ctx context.Context, exams []*model.AssembledExam) error

func (*DB) CacheInvigilatorTodos

func (db *DB) CacheInvigilatorTodos(ctx context.Context, todos *model.InvigilationTodos) error

func (*DB) CacheTeachers

func (db *DB) CacheTeachers(teachers []*model.Teacher, semester string) error

func (*DB) CacheZPAExams

func (db *DB) CacheZPAExams(exams []*model.ZPAExam) error

func (*DB) CanShareSlotPairs added in v1.207.0

func (db *DB) CanShareSlotPairs(ctx context.Context) ([][2]int, error)

CanShareSlotPairs returns the exam pairs declared as allowed to share a slot.

func (*DB) ChangeAncode

func (db *DB) ChangeAncode(ctx context.Context, program string, ancode, newAncode int) (*model.PrimussExam, error)

func (*DB) ChangeAncodeInConflicts

func (db *DB) ChangeAncodeInConflicts(ctx context.Context, program string, ancode, newAncode int) (*model.Conflicts, error)

func (*DB) ChangeAncodeInStudentRegs

func (db *DB) ChangeAncodeInStudentRegs(ctx context.Context, program string, ancode, newAncode int) ([]*model.StudentReg, error)

func (*DB) ChangeAncodeInStudentRegsCount

func (db *DB) ChangeAncodeInStudentRegsCount(ctx context.Context, program string, ancode, newAncode int) error

func (*DB) CheckStudentRegsCount

func (db *DB) CheckStudentRegsCount(ctx context.Context, program string, ancode, studentRegsCount int) bool

func (*DB) ClearAllPhaseFixed added in v1.207.0

func (db *DB) ClearAllPhaseFixed(ctx context.Context) error

ClearAllPhaseFixed clears the phaseFixed flag on all plan entries.

func (*DB) ClearEmailAttachments added in v1.102.0

func (db *DB) ClearEmailAttachments(ctx context.Context, kind string) (int, error)

ClearEmailAttachments deletes all attachments of a kind and returns how many were removed.

func (*DB) CountAssembledExams added in v1.204.0

func (db *DB) CountAssembledExams(ctx context.Context) (int64, error)

CountAssembledExams returns how many assembled exams are currently cached (0 before the first generation).

func (*DB) CountStudentRegsPlanned added in v1.190.0

func (db *DB) CountStudentRegsPlanned(ctx context.Context) (int64, error)

CountStudentRegsPlanned returns how many planned student registrations are currently prepared (0 before the first preparation).

func (*DB) DatabaseHasConfig added in v1.179.0

func (db *DB) DatabaseHasConfig(ctx context.Context, databaseName string) bool

DatabaseHasConfig reports whether a database carries a semester config (i.e. is usable with this code).

func (*DB) DatabaseName added in v1.180.0

func (db *DB) DatabaseName() string

DatabaseName returns the name of the database the client is currently pointed at.

func (*DB) DeleteAdditionalExam added in v1.173.0

func (db *DB) DeleteAdditionalExam(ctx context.Context, ancode int) (bool, error)

DeleteAdditionalExam removes one additional exam by ancode.

func (*DB) DeleteCanShareSlot added in v1.207.0

func (db *DB) DeleteCanShareSlot(ctx context.Context, ancode1, ancode2 int) (bool, error)

DeleteCanShareSlot removes a can-share-slot declaration.

func (*DB) DeleteDecision added in v1.207.0

func (db *DB) DeleteDecision(ctx context.Context, ancode1, ancode2 int, mtknr string) (bool, error)

DeleteDecision removes an explicit decision by (ancode1, ancode2, mtknr).

func (*DB) DeleteEmailTemplateOverride added in v1.213.0

func (db *DB) DeleteEmailTemplateOverride(ctx context.Context, name string) (bool, error)

DeleteEmailTemplateOverride removes a template's override (reset to default). Returns false when there was none.

func (*DB) DeleteExternalExam added in v1.204.0

func (db *DB) DeleteExternalExam(ctx context.Context, ancode int) error

DeleteExternalExam removes a non-ZPA exam by its ancode.

func (*DB) DeleteInvigilatorConstraints added in v1.139.0

func (db *DB) DeleteInvigilatorConstraints(ctx context.Context, teacherID int) (bool, error)

DeleteInvigilatorConstraints removes the constraints record of one invigilator. Returns false if there was none.

func (db *DB) DeleteMucDaiLink(ctx context.Context, program string, primussAncode int) error

func (*DB) DeletePermanentNonInvigilator added in v1.140.0

func (db *DB) DeletePermanentNonInvigilator(ctx context.Context, teacherID int) (bool, error)

DeletePermanentNonInvigilator removes one permanent non-invigilator. Returns false if there was none.

func (*DB) DeletePreplanExam added in v1.160.0

func (db *DB) DeletePreplanExam(ctx context.Context, id int) (bool, error)

DeletePreplanExam removes one pre-exam. Returns false if there was none.

func (*DB) DeleteSpecialInterest added in v1.173.0

func (db *DB) DeleteSpecialInterest(ctx context.Context, name string) (bool, error)

DeleteSpecialInterest removes one special-interest group by name.

func (*DB) DeleteStudyProgram added in v1.159.0

func (db *DB) DeleteStudyProgram(ctx context.Context, shortname string) (bool, error)

DeleteStudyProgram removes one study program. Returns false if there was none.

func (*DB) DropAndSave

func (db *DB) DropAndSave(ctx context.Context, objects []interface{}) error

func (*DB) EmailAttachmentInfos added in v1.102.0

func (db *DB) EmailAttachmentInfos(ctx context.Context, kind string) ([]*EmailAttachment, error)

EmailAttachmentInfos returns the attachments of a kind WITHOUT their binary data (for listing in the GUI), sorted by key.

func (*DB) EmailTemplateOverride added in v1.213.0

func (db *DB) EmailTemplateOverride(ctx context.Context, name string) (string, bool, error)

EmailTemplateOverride returns the stored Markdown override for one template and whether one exists.

func (*DB) EmailTemplateOverrides added in v1.213.0

func (db *DB) EmailTemplateOverrides(ctx context.Context) (map[string]string, error)

EmailTemplateOverrides returns all stored template overrides as name -> markdown.

func (*DB) EnsureMeta added in v1.179.1

func (db *DB) EnsureMeta(ctx context.Context, version int) error

EnsureMeta stamps the current database's schema version if it has none yet, preserving the read-only flag and semester. It does NOT write the semester, since a derived/guessed semester must not be persisted (only explicit ones are, via SetMetaSemester).

func (*DB) Exahm

func (db *DB) Exahm(ctx context.Context, ancode int) (bool, error)

func (*DB) ExamDurationOverrides added in v1.173.0

func (db *DB) ExamDurationOverrides(ctx context.Context) ([]*model.ExamDurationOverride, error)

ExamDurationOverrides returns all duration overrides.

func (*DB) ExamIsLocked

func (db *DB) ExamIsLocked(ctx context.Context, ancode int) bool

func (*DB) ExamerInPlan

func (db *DB) ExamerInPlan(ctx context.Context) ([]*model.ExamerInPlan, error)

func (*DB) ExamsInSlot

func (db *DB) ExamsInSlot(ctx context.Context, day int, time int) ([]*model.PlannedExam, error)

func (*DB) ExternalExam added in v1.204.0

func (db *DB) ExternalExam(ctx context.Context, ancode int) (*model.ZPAExam, error)

func (*DB) ExternalExams

func (db *DB) ExternalExams(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetActiveSemester added in v1.179.0

func (db *DB) GetActiveSemester(ctx context.Context) (*ActiveSemester, error)

GetActiveSemester returns the last active semester, or nil when none is stored.

func (*DB) GetAddedAncodes

func (db *DB) GetAddedAncodes(ctx context.Context) (map[int][]model.ZPAPrimussAncodes, error)

func (*DB) GetAddedAncodesForAncode

func (db *DB) GetAddedAncodesForAncode(ctx context.Context, ancode int) ([]model.ZPAPrimussAncodes, error)

func (*DB) GetAllInvigilations

func (db *DB) GetAllInvigilations(ctx context.Context) ([]*model.Invigilation, error)

func (*DB) GetAnnyConfig added in v1.181.0

func (db *DB) GetAnnyConfig(ctx context.Context) (*model.AnnyConfig, error)

GetAnnyConfig returns the global Anny config, or nil when none is stored yet.

func (*DB) GetAssembledExam added in v1.204.0

func (db *DB) GetAssembledExam(ctx context.Context, ancode int) (*model.AssembledExam, error)

func (*DB) GetAssembledExams added in v1.204.0

func (db *DB) GetAssembledExams(ctx context.Context) ([]*model.AssembledExam, error)

func (*DB) GetAssembledExamsForExamer added in v1.204.0

func (db *DB) GetAssembledExamsForExamer(ctx context.Context, examerID int) ([]*model.AssembledExam, error)

func (*DB) GetAssembledExamsState added in v1.204.0

func (db *DB) GetAssembledExamsState(ctx context.Context) (*model.AssembledExamsState, error)

GetAssembledExamsState returns the generated-exams state; a missing document means nothing has been generated yet and is reported as not dirty.

func (*DB) GetConstraints

func (db *DB) GetConstraints(ctx context.Context) ([]*model.Constraints, error)

func (*DB) GetConstraintsForAncode

func (db *DB) GetConstraintsForAncode(ctx context.Context, ancode int) (*model.Constraints, error)

func (*DB) GetEmailAttachment added in v1.102.0

func (db *DB) GetEmailAttachment(ctx context.Context, kind, key string) (*EmailAttachment, error)

GetEmailAttachment returns one attachment incl. its data, or nil if not found.

func (*DB) GetGenerationConfig added in v1.173.0

func (db *DB) GetGenerationConfig(ctx context.Context) (*model.GenerationConfig, error)

GetGenerationConfig returns the (single, global) generation config, or nil when none is stored yet.

func (*DB) GetInvigilationInSlot

func (db *DB) GetInvigilationInSlot(ctx context.Context, roomname string, day, slot int) ([]*model.Invigilation, error)

func (*DB) GetInvigilationTodos

func (db *DB) GetInvigilationTodos(ctx context.Context) (*model.InvigilationTodos, error)

func (*DB) GetInvigilatorForRoom

func (db *DB) GetInvigilatorForRoom(ctx context.Context, name string, day, time int) (*model.Teacher, error)

func (*DB) GetInvigilatorInSlot

func (db *DB) GetInvigilatorInSlot(ctx context.Context, roomname string, day, slot int) (*model.Teacher, error)

func (*DB) GetInvigilatorRequirements

func (db *DB) GetInvigilatorRequirements(ctx context.Context, teacherID int) (*zpa.SupervisorRequirements, error)

func (*DB) GetInvigilators

func (db *DB) GetInvigilators(ctx context.Context) ([]*model.Teacher, error)

func (*DB) GetOtherInvigilations

func (db *DB) GetOtherInvigilations(ctx context.Context) ([]*model.Invigilation, error)

func (*DB) GetPlanEntriesInSlot added in v1.23.0

func (db *DB) GetPlanEntriesInSlot(ctx context.Context, day int, time int) ([]*model.PlanEntry, error)

func (*DB) GetPlaner added in v1.164.0

func (db *DB) GetPlaner(ctx context.Context) (*model.Planer, error)

GetPlaner returns the planner (name/email), or nil when none is stored. The planner lives in the global "plexams" database (not a secret, carries over between semesters).

func (*DB) GetPrimussConflictsForAncode

func (db *DB) GetPrimussConflictsForAncode(ctx context.Context, program string, ancode int) (*model.Conflicts, error)

func (*DB) GetPrimussConflictsForAncodeOnlyPlanned

func (db *DB) GetPrimussConflictsForAncodeOnlyPlanned(ctx context.Context, program string, ancode int, zpaExamsToPlan []*model.ZPAExam) (*model.Conflicts, error)

func (*DB) GetPrimussConflictsPerAncode added in v1.171.0

func (db *DB) GetPrimussConflictsPerAncode(ctx context.Context, program string) (map[int]*model.Conflicts, error)

GetPrimussConflictsPerAncode returns all conflicts of a program at once, keyed by ancode. Used to compute assembled exams without a per-exam DB lookup.

func (*DB) GetPrimussExam

func (db *DB) GetPrimussExam(ctx context.Context, program string, ancode int) (*model.PrimussExam, error)

func (*DB) GetPrimussExams

func (db *DB) GetPrimussExams(ctx context.Context) ([]*model.PrimussExamByProgram, error)

func (*DB) GetPrimussExamsForAncode

func (db *DB) GetPrimussExamsForAncode(ctx context.Context, ancode int) ([]*model.PrimussExam, error)

func (*DB) GetPrimussStudentRegsForProgrammAncode

func (db *DB) GetPrimussStudentRegsForProgrammAncode(ctx context.Context, program string, ancode int) ([]*model.StudentReg, error)

func (*DB) GetPrimussStudentRegsPerAncode

func (db *DB) GetPrimussStudentRegsPerAncode(ctx context.Context, program string) (map[int][]*model.StudentReg, error)

func (*DB) GetPrimussStudentRegsPerStudent

func (db *DB) GetPrimussStudentRegsPerStudent(ctx context.Context, program string) (map[string][]*model.StudentReg, error)

func (*DB) GetPrograms

func (db *DB) GetPrograms(ctx context.Context) ([]string, error)

func (*DB) GetRegsWithErrors

func (db *DB) GetRegsWithErrors(ctx context.Context) ([]*model.RegWithError, error)

func (*DB) GetRoomRequest added in v1.115.0

func (db *DB) GetRoomRequest(ctx context.Context, room string, day, slot int) (*model.RoomRequest, error)

GetRoomRequest returns one room request (key: room/day/slot) or nil.

func (*DB) GetSelfInvigilations

func (db *DB) GetSelfInvigilations(ctx context.Context) ([]*model.Invigilation, error)

func (*DB) GetSemesterConfigInput added in v1.158.0

func (db *DB) GetSemesterConfigInput(ctx context.Context) (*model.SemesterConfigInput, error)

GetSemesterConfigInput returns the raw, editable per-semester config (the source of truth) or nil when none has been stored yet.

func (*DB) GetSemesterConfigInputForSemester added in v1.158.0

func (db *DB) GetSemesterConfigInputForSemester(ctx context.Context, semester string) (*model.SemesterConfigInput, error)

GetSemesterConfigInputForSemester returns the raw config of another semester (its own database), or nil when none is stored. Used to seed a new semester from a previous one and to guard createSemester against overwriting.

func (*DB) GetSemesterMeta added in v1.178.0

func (db *DB) GetSemesterMeta(ctx context.Context) (*SemesterMeta, error)

GetSemesterMeta returns the meta of the current database (nil when none).

func (*DB) GetStudentRegsCount

func (db *DB) GetStudentRegsCount(ctx context.Context, program string, ancode int) (int, error)

func (*DB) GetStudentRegsState added in v1.174.0

func (db *DB) GetStudentRegsState(ctx context.Context) (*model.StudentRegsState, error)

GetStudentRegsState returns the student-regs state; a missing document means nothing has been generated yet and is reported as not dirty.

func (*DB) GetTeacher

func (db *DB) GetTeacher(ctx context.Context, id int) (*model.Teacher, error)

func (*DB) GetTeacherIdByRegex added in v1.39.0

func (db *DB) GetTeacherIdByRegex(ctx context.Context, name string) (int, error)

func (*DB) GetTeachers

func (db *DB) GetTeachers(ctx context.Context) ([]*model.Teacher, error)

func (*DB) GetZPAExams

func (db *DB) GetZPAExams(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetZPAExamsNotToPlan

func (db *DB) GetZPAExamsNotToPlan(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetZPAExamsPlannedOrNotPlanned

func (db *DB) GetZPAExamsPlannedOrNotPlanned(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetZPAExamsToPlan

func (db *DB) GetZPAExamsToPlan(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetZPAStudentByMtknr added in v1.61.0

func (db *DB) GetZPAStudentByMtknr(ctx context.Context, mtknr string) (*model.ZPAStudent, error)

func (*DB) GetZPAStudents added in v1.62.0

func (db *DB) GetZPAStudents(ctx context.Context) ([]*model.ZPAStudent, error)

func (*DB) GetZpaAncodesNotPlanned

func (db *DB) GetZpaAncodesNotPlanned(ctx context.Context) (*set.Set[int], error)

func (*DB) GetZpaAncodesPlanned

func (db *DB) GetZpaAncodesPlanned(ctx context.Context) (*set.Set[int], error)

func (*DB) GetZpaAncodesPlannedOrNotPlanned

func (db *DB) GetZpaAncodesPlannedOrNotPlanned(ctx context.Context) (*set.Set[int], error)

func (*DB) GetZpaExamByAncode

func (db *DB) GetZpaExamByAncode(ctx context.Context, ancode int) (*model.ZPAExam, error)

func (*DB) HasRoom added in v1.113.0

func (db *DB) HasRoom(ctx context.Context, name string) (bool, error)

HasRoom reports whether a room with the given name exists.

func (*DB) InsertPreplanExam added in v1.160.0

func (db *DB) InsertPreplanExam(ctx context.Context, preplanExam *model.PreplanExam) (*model.PreplanExam, error)

InsertPreplanExam assigns the next id and inserts the pre-exam.

func (*DB) InvigilationsForInvigilator

func (db *DB) InvigilationsForInvigilator(ctx context.Context, invigilatorID int) ([]*model.Invigilation, error)

func (*DB) InvigilatorConstraints added in v1.139.0

func (db *DB) InvigilatorConstraints(ctx context.Context) ([]*model.InvigilatorConstraints, error)

InvigilatorConstraints returns all per-invigilator constraints stored in the DB (managed via the GUI), separate from the ZPA-sourced requirements.

func (*DB) InvigilatorConstraintsForTeacher added in v1.139.0

func (db *DB) InvigilatorConstraintsForTeacher(ctx context.Context, teacherID int) (*model.InvigilatorConstraints, error)

InvigilatorConstraintsForTeacher returns the constraints of one invigilator, or nil if none are stored.

func (*DB) Lab

func (db *DB) Lab(ctx context.Context, ancode int) (bool, error)

func (*DB) LockExam

func (db *DB) LockExam(ctx context.Context, ancode int) (*model.PlanEntry, error)

func (*DB) LockPlan

func (db *DB) LockPlan(ctx context.Context) error

func (*DB) MigrateLegacySemesterConfigInput added in v1.163.0

func (db *DB) MigrateLegacySemesterConfigInput(ctx context.Context) error

MigrateLegacySemesterConfigInput rewrites a stored config that still carries removed/renamed fields:

  • `from` becomes the former numbering anchor (from when dayNumberStart was "from", else fromFK07), so existing plan day numbers stay stable;
  • the former goSlots (offsets relative to goDay0) become absolute mucDaiSlots ([dayNumber, slotNumber]);
  • fromFK07 / dayNumberStart / goDay0 / goSlots are dropped.

No-op when none of these legacy fields are present.

func (*DB) MucDaiExam added in v1.3.0

func (db *DB) MucDaiExam(ctx context.Context, program string, ancode int) (*MucDaiExam, error)

func (*DB) MucDaiExamsForProgram

func (db *DB) MucDaiExamsForProgram(ctx context.Context, program string) ([]*MucDaiExam, error)
func (db *DB) MucDaiLink(ctx context.Context, program string, primussAncode int) (*MucDaiLink, error)
func (db *DB) MucDaiLinks(ctx context.Context) ([]*MucDaiLink, error)

func (*DB) MutationLog added in v1.168.0

func (db *DB) MutationLog(ctx context.Context, opType, name *string, ancode *int,
	argFilters []*model.ArgFilterInput, since, until *time.Time, limit int) ([]*model.MutationLogEntry, error)

MutationLog returns the mutation log, newest first, filtered by operation name, a referenced ancode, argument key/value pairs and/or a time range. limit <= 0 returns all.

func (*DB) MutationLogNames added in v1.168.0

func (db *DB) MutationLogNames(ctx context.Context) ([]string, error)

MutationLogNames returns the distinct operation names present in the log.

func (*DB) NotPlannedByMe

func (db *DB) NotPlannedByMe(ctx context.Context, ancode int, inFK *string) (bool, error)

func (*DB) Nta

func (db *DB) Nta(ctx context.Context, mtknr string) (*model.NTA, error)

func (*DB) NtaRoomAloneWaivers added in v1.131.0

func (db *DB) NtaRoomAloneWaivers(ctx context.Context) ([]*model.NtaRoomAloneWaiver, error)

NtaRoomAloneWaivers returns all accepted NTA room-alone waivers of the semester, sorted by mtknr/ancode.

func (*DB) NtaWithRegs

func (db *DB) NtaWithRegs(ctx context.Context, mtknr string) (*model.NTAWithRegs, error)

func (*DB) Ntas

func (db *DB) Ntas(ctx context.Context) ([]*model.NTA, error)

func (*DB) NtasWithRegs

func (db *DB) NtasWithRegs(ctx context.Context) ([]*model.Student, error)

func (*DB) Online

func (db *DB) Online(ctx context.Context, ancode int) (bool, error)

func (*DB) PermanentNonInvigilators added in v1.140.0

func (db *DB) PermanentNonInvigilators(ctx context.Context) ([]*model.PermanentNonInvigilator, error)

PermanentNonInvigilators returns the teachers who never do invigilation duty again. This list lives in the global "plexams" database and carries over between semesters.

func (*DB) PlanEntries

func (db *DB) PlanEntries(ctx context.Context) ([]*model.PlanEntry, error)

func (*DB) PlanEntry

func (db *DB) PlanEntry(ctx context.Context, ancode int) (*model.PlanEntry, error)

func (*DB) PlannedAncodes

func (db *DB) PlannedAncodes(ctx context.Context) ([]*model.PlanEntry, error)

func (*DB) PlannedRoomNames

func (db *DB) PlannedRoomNames(ctx context.Context) ([]string, error)

func (*DB) PlannedRoomNamesInSlot

func (db *DB) PlannedRoomNamesInSlot(ctx context.Context, day, slot int) ([]string, error)

func (*DB) PlannedRooms

func (db *DB) PlannedRooms(ctx context.Context) ([]*model.PlannedRoom, error)

func (*DB) PlannedRoomsForAncode

func (db *DB) PlannedRoomsForAncode(ctx context.Context, ancode int) ([]*model.PlannedRoom, error)

func (*DB) PlannedRoomsInSlot

func (db *DB) PlannedRoomsInSlot(ctx context.Context, day, slot int) ([]*model.PlannedRoom, error)

func (*DB) PlanningConditionsSet added in v1.121.0

func (db *DB) PlanningConditionsSet(ctx context.Context) ([]string, error)

PlanningConditionsSet returns the keys of all conditions that are currently set (done) for the semester.

func (*DB) PrePlannedInvigilations added in v1.84.0

func (db *DB) PrePlannedInvigilations(ctx context.Context) ([]*model.PrePlannedInvigilation, error)

func (*DB) PrePlannedInvigilationsForInvigilator added in v1.84.0

func (db *DB) PrePlannedInvigilationsForInvigilator(ctx context.Context, invigilatorID int) ([]*model.PrePlannedInvigilation, error)

func (*DB) PrePlannedRooms added in v1.33.0

func (db *DB) PrePlannedRooms(ctx context.Context) ([]*model.PrePlannedRoom, error)

func (*DB) PrePlannedRoomsForExam added in v1.50.0

func (db *DB) PrePlannedRoomsForExam(ctx context.Context, ancode int) ([]*model.PrePlannedRoom, error)

func (*DB) PreplanExam added in v1.160.0

func (db *DB) PreplanExam(ctx context.Context, id int) (*model.PreplanExam, error)

PreplanExam returns one pre-exam by id, or nil when none.

func (*DB) PreplanExams added in v1.160.0

func (db *DB) PreplanExams(ctx context.Context) ([]*model.PreplanExam, error)

PreplanExams returns all SEB/EXaHM pre-planning pseudo-exams of this semester, sorted by id.

func (*DB) PrimussExamExists

func (db *DB) PrimussExamExists(ctx context.Context, program string, ancode int) (bool, error)

func (*DB) PrimussExamsForProgram added in v1.166.0

func (db *DB) PrimussExamsForProgram(ctx context.Context, program string) ([]*model.PrimussExam, error)

PrimussExamsForProgram returns all Primuss exams of one program.

func (*DB) RawCollection added in v1.199.0

func (db *DB) RawCollection(ctx context.Context, name string) ([]bson.M, error)

RawCollection returns all documents of a collection as bson.M (empty if missing).

func (*DB) RemoveAddedAncode added in v1.167.0

func (db *DB) RemoveAddedAncode(ctx context.Context, zpaAncode int, program string) (bool, error)

RemoveAddedAncode removes a manually added Primuss ancode mapping (program) of a ZPA exam. Returns false when there was none. (Mappings that come from ZPA itself are not stored here and are not affected.)

func (*DB) RemoveExamDurationOverride added in v1.173.0

func (db *DB) RemoveExamDurationOverride(ctx context.Context, ancode int) (bool, error)

RemoveExamDurationOverride deletes the duration override for an ancode; returns false when there was none.

func (*DB) RemoveNtaRoomAloneWaiver added in v1.131.0

func (db *DB) RemoveNtaRoomAloneWaiver(ctx context.Context, mtknr string, ancode int) (bool, error)

RemoveNtaRoomAloneWaiver deletes a waiver (key: mtknr/ancode). It reports whether a document was removed.

func (*DB) RemovePlanEntry added in v1.176.0

func (db *DB) RemovePlanEntry(ctx context.Context, ancode int) error

RemovePlanEntry removes the plan entry (if any) of an ancode.

func (*DB) RemovePrePlannedInvigilation added in v1.125.0

func (db *DB) RemovePrePlannedInvigilation(ctx context.Context, day, slot int, roomName *string) (bool, error)

RemovePrePlannedInvigilation deletes a pre-planned invigilation (key: day/slot/roomName; roomName nil = the reserve). It reports whether a document was actually removed.

func (*DB) RemovePrePlannedRoomFromExam added in v1.119.0

func (db *DB) RemovePrePlannedRoomFromExam(ctx context.Context, ancode int, roomName string, mtknr *string) (bool, error)

RemovePrePlannedRoomFromExam deletes a pre-planned room from an exam (key: ancode/roomName/mtknr). It reports whether a document was actually removed.

func (*DB) RemoveStudentReg

func (db *DB) RemoveStudentReg(ctx context.Context, program string, ancode int, mtknr string) (int, error)

func (*DB) ReplaceAllRoomRequests added in v1.115.0

func (db *DB) ReplaceAllRoomRequests(ctx context.Context, requests []*model.RoomRequest) error

ReplaceAllRoomRequests drops the collection and inserts the given requests.

func (*DB) ReplaceMucDaiExamsForProgram added in v1.175.0

func (db *DB) ReplaceMucDaiExamsForProgram(ctx context.Context, program string, exams []*MucDaiExam) error

ReplaceMucDaiExamsForProgram drops and refills the mucdai_<program> collection.

func (*DB) ReplaceNta added in v1.111.0

func (db *DB) ReplaceNta(ctx context.Context, nta *model.NTA) (*model.NTA, error)

ReplaceNta replaces the NTA document identified by its mtknr. It does not upsert: if no document matches, nothing is changed.

func (*DB) ReplacePlannedRooms added in v1.34.0

func (db *DB) ReplacePlannedRooms(ctx context.Context, plannedRooms []*model.PlannedRoom) error

func (*DB) ReplacePreplanExam added in v1.160.0

func (db *DB) ReplacePreplanExam(ctx context.Context, preplanExam *model.PreplanExam) (bool, error)

ReplacePreplanExam replaces the pre-exam with the same id. Returns false if there was none.

func (*DB) ReplaceRawCollection added in v1.199.0

func (db *DB) ReplaceRawCollection(ctx context.Context, name string, docs []bson.M) (int, error)

ReplaceRawCollection drops the named collection and inserts the given documents (used for the Primuss XLSX imports: studentregs_/exams_/count_/conflicts_<program>). Returns the number of inserted documents.

func (*DB) ReplaceRoom added in v1.113.0

func (db *DB) ReplaceRoom(ctx context.Context, room *model.Room) (*model.Room, error)

ReplaceRoom replaces the room identified by its name (no upsert) and returns it. Errors if no room with that name exists.

func (*DB) ReplaceUnplacedExams added in v1.137.1

func (db *DB) ReplaceUnplacedExams(ctx context.Context, unplaced []*model.UnplacedExam) error

ReplaceUnplacedExams drops and rewrites the rooms_unplaced collection (the students that could not be assigned a real room in their slot during room generation).

func (*DB) ResetGeneratedInvigilations added in v1.126.0

func (db *DB) ResetGeneratedInvigilations(ctx context.Context) error

ResetGeneratedInvigilations drops the generated invigilations (invigilations_other). The pre-planning (invigilations_pre_planned) and the self-invigilations (invigilations_self) are not touched.

func (*DB) ResetGeneratedPlanEntries added in v1.207.0

func (db *DB) ResetGeneratedPlanEntries(ctx context.Context) (int, error)

ResetGeneratedPlanEntries removes the generated plan entries: everything that is neither manually locked, nor an external / not-planned-by-me entry (ExternalTime set), nor frozen by the EXaHM/SEB room phase (phaseFixed). Returns the number of entries removed.

func (*DB) ResetPlannedRooms added in v1.126.0

func (db *DB) ResetPlannedRooms(ctx context.Context) error

ResetPlannedRooms drops the generated planned rooms (planned_rooms). The pre-planning (rooms_pre_planned) is not touched.

func (*DB) ResetUnplacedExams added in v1.137.1

func (db *DB) ResetUnplacedExams(ctx context.Context) error

ResetUnplacedExams drops the rooms_unplaced collection.

func (*DB) ResolveStartSemester added in v1.179.0

func (db *DB) ResolveStartSemester(ctx context.Context) (semester, database string, ok bool)

ResolveStartSemester picks the semester to start with when none is pinned: the last active one if it still has a config, otherwise the newest compatible semester. The returned database is empty when it should be derived from the semester. ok is false when nothing usable exists.

func (*DB) RmConstraints added in v1.20.0

func (db *DB) RmConstraints(ctx context.Context, ancode int) (bool, error)

func (*DB) RmZpaExamFromPlan

func (db *DB) RmZpaExamFromPlan(ctx context.Context, ancode int) (bool, error)

func (*DB) RoomByName added in v1.33.0

func (db *DB) RoomByName(ctx context.Context, roomName string) (*model.Room, error)

func (*DB) RoomRequests added in v1.115.0

func (db *DB) RoomRequests(ctx context.Context) ([]*model.RoomRequest, error)

RoomRequests returns all building-management room requests of the semester, sorted by room, day, slot.

func (*DB) Rooms

func (db *DB) Rooms(ctx context.Context) ([]*model.Room, error)

func (*DB) SafeExamBrowser

func (db *DB) SafeExamBrowser(ctx context.Context, ancode int) (bool, error)

func (*DB) Save

func (db *DB) Save(ctx context.Context, objects []interface{}) error

func (*DB) SaveActiveSemester added in v1.179.0

func (db *DB) SaveActiveSemester(ctx context.Context) error

SaveActiveSemester remembers the current semester/database as the last active one.

func (*DB) SaveAnnyBookings added in v1.77.0

func (db *DB) SaveAnnyBookings(ctx context.Context, bookings []*model.AnnyBooking) error

func (*DB) SaveEmailAttachment added in v1.102.0

func (db *DB) SaveEmailAttachment(ctx context.Context, att *EmailAttachment) error

SaveEmailAttachment stores (upserts) one attachment, keyed by (kind, key).

func (*DB) SavePlanEntries

func (db *DB) SavePlanEntries(ctx context.Context, planEntries []*model.PlanEntry) error

func (*DB) SavePlanEntriesToBackup

func (db *DB) SavePlanEntriesToBackup(ctx context.Context, planEntries []*model.PlanEntry) error

func (*DB) SavePlaner added in v1.164.0

func (db *DB) SavePlaner(ctx context.Context, planer *model.Planer) error

SavePlaner stores the planner (single document, replaced on upsert).

func (*DB) SaveSemesterConfig

func (db *DB) SaveSemesterConfig(ctx context.Context, semesterConfig *model.SemesterConfig) error

func (*DB) SaveSemesterConfigInput added in v1.158.0

func (db *DB) SaveSemesterConfigInput(ctx context.Context, input *model.SemesterConfigInput) error

SaveSemesterConfigInput replaces the stored raw per-semester config.

func (*DB) SaveSemesterConfigInputForSemester added in v1.158.0

func (db *DB) SaveSemesterConfigInputForSemester(ctx context.Context, semester string, input *model.SemesterConfigInput) error

SaveSemesterConfigInputForSemester writes the raw config into another semester's database (used when creating a new semester).

func (*DB) SaveSemesterConfigInputToDatabase added in v1.180.0

func (db *DB) SaveSemesterConfigInputToDatabase(ctx context.Context, database string, input *model.SemesterConfigInput) error

SaveSemesterConfigInputToDatabase writes the raw config into a specific database (by exact name; used when creating a workspace with an arbitrary database name).

func (*DB) SaveStudentRegs

func (db *DB) SaveStudentRegs(ctx context.Context, studentRegs []interface{}) error

func (*DB) SemesterConfigInputForDatabase added in v1.180.0

func (db *DB) SemesterConfigInputForDatabase(ctx context.Context, database string) (*model.SemesterConfigInput, error)

SemesterConfigInputForDatabase returns the raw config stored in a specific database (by exact name), or nil when none.

func (*DB) SemesterForDatabase added in v1.180.0

func (db *DB) SemesterForDatabase(ctx context.Context, database string) string

SemesterForDatabase returns the logical semester of a database (its stored value, else derived from the name).

func (*DB) SetAnnyConfig added in v1.181.0

func (db *DB) SetAnnyConfig(ctx context.Context, cfg *model.AnnyConfig) error

SetAnnyConfig upserts the (single, global) Anny config.

func (*DB) SetAssembledExamsDirty added in v1.204.0

func (db *DB) SetAssembledExamsDirty(ctx context.Context, dirty bool, reason string, t time.Time) error

SetAssembledExamsDirty upserts the (single) generated-exams state document: dirty=true when an input changed, dirty=false right after a (re)generation.

func (*DB) SetEmailTemplateOverride added in v1.213.0

func (db *DB) SetEmailTemplateOverride(ctx context.Context, name, markdown string) error

SetEmailTemplateOverride stores (upserts) the Markdown override for a template.

func (*DB) SetExamDurationOverride added in v1.173.0

func (db *DB) SetExamDurationOverride(ctx context.Context, ancode, duration int) (*model.ExamDurationOverride, error)

SetExamDurationOverride upserts the duration override (minutes) for an ancode.

func (*DB) SetExternalExamFaculty added in v1.208.0

func (db *DB) SetExternalExamFaculty(ctx context.Context, ancode int, faculty string) error

SetExternalExamFaculty sets the faculty (Prüfungsplanung) on an external exam.

func (*DB) SetGenerationConfig added in v1.173.0

func (db *DB) SetGenerationConfig(ctx context.Context, cfg *model.GenerationConfig) error

SetGenerationConfig upserts the (single, global) generation config.

func (*DB) SetInvigilationPrePlanned added in v1.85.0

func (db *DB) SetInvigilationPrePlanned(ctx context.Context, day, slot int, roomName *string, prePlanned bool) error

SetInvigilationPrePlanned sets the prePlanned flag on the invigilation for a room (roomName != nil) or the reserve (roomName == nil) in a slot in the invigilations_other collection.

func (*DB) SetMetaSemester added in v1.179.1

func (db *DB) SetMetaSemester(ctx context.Context, semester string, version int) error

SetMetaSemester force-writes the logical semester of the current database (authoritative: an explicit pin/override/createSemester). Overwrites any previous value; creates the meta with the given schema version if missing.

func (*DB) SetMetaSemesterForDatabase added in v1.180.0

func (db *DB) SetMetaSemesterForDatabase(ctx context.Context, database, semester string, version int) error

SetMetaSemesterForDatabase force-writes the logical semester into a specific database (by exact name; used when creating a workspace).

func (*DB) SetMetaSemesterForSemester added in v1.179.1

func (db *DB) SetMetaSemesterForSemester(ctx context.Context, semester string, version int) error

SetMetaSemesterForSemester force-writes the logical semester into another semester's database (used when creating a new semester).

func (*DB) SetNtaDeactivated added in v1.111.0

func (db *DB) SetNtaDeactivated(ctx context.Context, mtknr string, deactivated bool) (*model.NTA, error)

SetNtaDeactivated sets the deactivated flag of the NTA identified by mtknr. Returns nil if no NTA with that mtknr exists.

func (*DB) SetPhaseFixed added in v1.207.0

func (db *DB) SetPhaseFixed(ctx context.Context, ancode int, fixed bool) error

SetPhaseFixed sets/clears the phaseFixed flag on a plan entry (the EXaHM/SEB room phase fix, distinct from the manual Locked).

func (*DB) SetPlanningCondition added in v1.121.0

func (db *DB) SetPlanningCondition(ctx context.Context, key string, set bool) error

SetPlanningCondition marks a condition as done (set=true, upsert) or removes it (set=false).

func (*DB) SetRegsWithErrors

func (db *DB) SetRegsWithErrors(ctx context.Context, regsWithErrors []*model.RegWithError) error

func (*DB) SetRoomDeactivated added in v1.112.0

func (db *DB) SetRoomDeactivated(ctx context.Context, name string, deactivated bool) (*model.Room, error)

SetRoomDeactivated sets the deactivated flag of the room identified by name. Returns an error if no room with that name exists.

func (*DB) SetRoomRequestActive added in v1.115.0

func (db *DB) SetRoomRequestActive(ctx context.Context, room string, day, slot int, active bool) (*model.RoomRequest, error)

SetRoomRequestActive sets the active flag (key: room/day/slot). Returns nil if no such request exists.

func (*DB) SetRoomRequestApproved added in v1.115.0

func (db *DB) SetRoomRequestApproved(ctx context.Context, room string, day, slot int, approved bool) (*model.RoomRequest, error)

SetRoomRequestApproved sets the approved flag (key: room/day/slot). Returns nil if no such request exists.

func (*DB) SetRoomRequestWith added in v1.114.0

func (db *DB) SetRoomRequestWith(ctx context.Context, name, requestWith string, needsRequest bool) error

SetRoomRequestWith sets the requestWith and (derived) needsRequest fields of the room identified by name.

func (*DB) SetSemesterOnNTAs

func (db *DB) SetSemesterOnNTAs(ctx context.Context, studentRegs []interface{}) error

func (*DB) SetSemesterReadOnly added in v1.178.0

func (db *DB) SetSemesterReadOnly(ctx context.Context, readOnly bool) error

SetSemesterReadOnly sets the read-only flag of the current database (upsert, preserving the schema version).

func (*DB) SetStudentRegsDirty added in v1.174.0

func (db *DB) SetStudentRegsDirty(ctx context.Context, dirty bool, reason string, t time.Time) error

SetStudentRegsDirty upserts the (single) student-regs state document: dirty=true when an input changed, dirty=false right after a (re)generation.

func (*DB) SetZPAExamsToPlan

func (db *DB) SetZPAExamsToPlan(ctx context.Context, examsToPlan, examsNotToPlan []*model.ZPAExam) error

func (*DB) SpecialInterests added in v1.173.0

func (db *DB) SpecialInterests(ctx context.Context) ([]*model.SpecialInterest, error)

SpecialInterests returns all special-interest groups.

func (*DB) StudentByMtknr

func (db *DB) StudentByMtknr(ctx context.Context, mtknr string) (*model.Student, error)

func (*DB) StudentConflictDecisions added in v1.207.0

func (db *DB) StudentConflictDecisions(ctx context.Context) ([]*model.StudentConflictDecision, error)

StudentConflictDecisions returns all stored explicit per-student decisions.

func (*DB) StudentRegsForProgram

func (db *DB) StudentRegsForProgram(ctx context.Context, program string) ([]*model.StudentReg, error)

func (*DB) StudentRegsPerStudentPlanned

func (db *DB) StudentRegsPerStudentPlanned(ctx context.Context) ([]*model.Student, error)

func (*DB) StudentsByName

func (db *DB) StudentsByName(ctx context.Context, regex string) ([]*model.Student, error)

func (*DB) StudyProgram added in v1.159.0

func (db *DB) StudyProgram(ctx context.Context, shortname string) (*model.StudyProgram, error)

StudyProgram returns one study program by its shortname, or nil when none.

func (*DB) StudyPrograms added in v1.159.0

func (db *DB) StudyPrograms(ctx context.Context) ([]*model.StudyProgram, error)

StudyPrograms returns all study programs (Studiengänge). This list lives in the global "plexams" database and carries over between semesters.

func (*DB) SwitchTo added in v1.179.1

func (db *DB) SwitchTo(ctx context.Context, database, override string) string

SwitchTo repoints the DB to the database named database (verbatim; an allSemesterNames id, e.g. "2026-SS" or "test-v2"). The logical semester is the override when given, else the database's own stored semester, else derived from the database name. Returns the resolved logical semester.

func (*DB) SyncLog added in v1.156.0

func (db *DB) SyncLog(ctx context.Context, limit int) ([]*model.SyncLogEntry, error)

SyncLog returns the transfer history, newest first. limit <= 0 returns all.

func (*DB) UnblockRoomForSlot added in v1.119.0

func (db *DB) UnblockRoomForSlot(ctx context.Context, room string, day, slot int) (bool, error)

UnblockRoomForSlot removes a room-slot block (key: room/day/slot). It reports whether a block was actually removed.

func (*DB) UnlockExam

func (db *DB) UnlockExam(ctx context.Context, ancode int) (*model.PlanEntry, error)

func (*DB) UnplacedExams added in v1.137.1

func (db *DB) UnplacedExams(ctx context.Context) ([]*model.UnplacedExam, error)

UnplacedExams returns the students that could not be assigned a real room in their slot during the last room generation.

func (*DB) UpdateRoomRequestTime added in v1.117.0

func (db *DB) UpdateRoomRequestTime(ctx context.Context, room string, day, slot int, from, until time.Time) (*model.RoomRequest, error)

UpdateRoomRequestTime changes the time range of a room request (key: room/day/slot). Returns nil if no such request exists.

func (*DB) UpsertAdditionalExam added in v1.173.0

func (db *DB) UpsertAdditionalExam(ctx context.Context, exam *model.AdditionalExam) error

UpsertAdditionalExam creates or updates one additional exam (key: ancode).

func (*DB) UpsertCanShareSlot added in v1.207.0

func (db *DB) UpsertCanShareSlot(ctx context.Context, ancode1, ancode2 int) error

UpsertCanShareSlot declares that two exams may share a slot (key: ancode1, ancode2).

func (*DB) UpsertDecision added in v1.207.0

func (db *DB) UpsertDecision(ctx context.Context, ancode1, ancode2 int, mtknr, decision string) error

UpsertDecision stores (or replaces) an explicit decision by (ancode1, ancode2, mtknr).

func (*DB) UpsertInvigilatorConstraints added in v1.139.0

func (db *DB) UpsertInvigilatorConstraints(ctx context.Context, constraints *model.InvigilatorConstraints) error

UpsertInvigilatorConstraints creates or replaces the whole constraints record of one invigilator (key: teacherID).

func (db *DB) UpsertMucDaiLink(ctx context.Context, link *MucDaiLink) error

func (*DB) UpsertPermanentNonInvigilator added in v1.140.0

func (db *DB) UpsertPermanentNonInvigilator(ctx context.Context, nonInvigilator *model.PermanentNonInvigilator) error

UpsertPermanentNonInvigilator creates or replaces one permanent non-invigilator (key: teacherID).

func (*DB) UpsertSpecialInterest added in v1.173.0

func (db *DB) UpsertSpecialInterest(ctx context.Context, si *model.SpecialInterest) error

UpsertSpecialInterest creates or updates one special-interest group (key: name).

func (*DB) UpsertStudyProgram added in v1.159.0

func (db *DB) UpsertStudyProgram(ctx context.Context, program *model.StudyProgram) error

UpsertStudyProgram creates or replaces one study program (key: shortname).

type EmailAttachment added in v1.102.0

type EmailAttachment struct {
	Kind        string    `bson:"kind"`
	Key         string    `bson:"key"`
	Filename    string    `bson:"filename"`
	ContentType string    `bson:"contentType"`
	Size        int       `bson:"size"`
	Data        []byte    `bson:"data,omitempty"`
	UploadedAt  time.Time `bson:"uploadedAt"`
}

EmailAttachment is a file uploaded by the GUI (or imported by the CLI) to be attached to an individual email later: cover-page PDFs (kind "cover-page", key = teacher ID) and per-invigilator PNGs (kind "invigilation-image", key = invigilator ID). One document per (kind, key); re-uploading replaces it.

type ExamToPlanType

type ExamToPlanType struct {
	Ancode int
	ToPlan bool
}

type MucDaiExam

type MucDaiExam struct {
	PrimussAncode  int    `bson:"Nr"`
	Module         string `bson:"Modulname"`
	ExamType       string `bson:"Prüfungsform"`
	Grading        string `bson:"Bewertung"`
	Duration       int    `bson:"Dauer"`
	MainExamer     string `bson:"Erstpruefender"`
	SecondExamer   string `bson:"Zweitpruefender"`
	IsRepeaterExam string `bson:"IstWiederholung"`
	Program        string `bson:"Studiengruppe"`
	Planer         string `bson:"Prüfungsplanung"`
}
type MucDaiLink struct {
	Program       string `bson:"program"`
	PrimussAncode int    `bson:"primussancode"`
	Kind          string `bson:"kind"`             // "external" | "zpa"
	Ancode        *int   `bson:"ancode,omitempty"` // linked external/ZPA ancode; nil if unresolved
	Status        string `bson:"status"`           // "linked" | "unresolved"
	Source        string `bson:"source"`           // "auto" | "manual"
	Module        string `bson:"module"`           // snapshot for display
	MainExamer    string `bson:"mainexamer"`       // snapshot for display
}

MucDaiLink is the explicit, stored link between a MUC.DAI exam (program + primussAncode) and the exam it maps to in our data: an auto-created external (non-ZPA) exam, or a ZPA exam (for FK07-planned ones). Stored explicitly so a later ZPA re-import cannot silently break it.

type PrimussType

type PrimussType string
const (
	StudentRegs PrimussType = "studentregs"
	Exams       PrimussType = "exams"
	Counts      PrimussType = "count"
	Conflicts   PrimussType = "conflicts"
)

type SemesterMeta added in v1.178.0

type SemesterMeta struct {
	SchemaVersion int    `bson:"schemaVersion"`
	ReadOnly      bool   `bson:"readOnly"`
	Semester      string `bson:"semester,omitempty"`
}

SemesterMeta is per-database metadata (not planning config): the data schema version (compatibility), the read-only flag and the logical semester (used against external systems like ZPA, so a clone keeps the real semester instead of its database name).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL