add excused state to protocol presence

This commit is contained in:
Julian Krauser 2025-01-19 13:14:12 +01:00
parent a4b26013a7
commit 4dd6fa6d8a
5 changed files with 28 additions and 0 deletions

View file

@ -67,6 +67,7 @@ import { ProtocolAbsent1736072179716 } from "./migrations/1736072179716-protocol
import { Memberlist1736079005086 } from "./migrations/1736079005086-memberlist"; import { Memberlist1736079005086 } from "./migrations/1736079005086-memberlist";
import { ExtendViewValues1736084198860 } from "./migrations/1736084198860-extendViewValues"; import { ExtendViewValues1736084198860 } from "./migrations/1736084198860-extendViewValues";
import { FinishInternalIdTransfer1736505324488 } from "./migrations/1736505324488-finishInternalIdTransfer"; import { FinishInternalIdTransfer1736505324488 } from "./migrations/1736505324488-finishInternalIdTransfer";
import { ProtocolPresenceExcuse1737287798828 } from "./migrations/1737287798828-protocolPresenceExcuse";
const dataSource = new DataSource({ const dataSource = new DataSource({
type: DB_TYPE as any, type: DB_TYPE as any,
@ -144,6 +145,7 @@ const dataSource = new DataSource({
Memberlist1736079005086, Memberlist1736079005086,
ExtendViewValues1736084198860, ExtendViewValues1736084198860,
FinishInternalIdTransfer1736505324488, FinishInternalIdTransfer1736505324488,
ProtocolPresenceExcuse1737287798828,
], ],
migrationsRun: true, migrationsRun: true,
migrationsTransactionMode: "each", migrationsTransactionMode: "each",

View file

@ -13,6 +13,9 @@ export class protocolPresence {
@Column({ type: "boolean", default: false }) @Column({ type: "boolean", default: false })
absent: boolean; absent: boolean;
@Column({ type: "boolean", default: true })
excused: boolean;
@ManyToOne(() => member, { @ManyToOne(() => member, {
nullable: false, nullable: false,
onDelete: "CASCADE", onDelete: "CASCADE",

View file

@ -12,6 +12,7 @@ export default abstract class ProtocolPresenceFactory {
return { return {
memberId: record.member.id, memberId: record.member.id,
absent: record.absent, absent: record.absent,
excused: record.excused,
protocolId: record.protocolId, protocolId: record.protocolId,
}; };
} }

View file

@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
export class ProtocolPresenceExcuse1737287798828 implements MigrationInterface {
name = "ProtocolPresenceExcuse1737287798828";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn(
"protocol_presence",
new TableColumn({
name: "excused",
type: "tinyint",
default: "1",
isNullable: false,
})
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumn("protocol_presence", "excused");
}
}

View file

@ -3,5 +3,6 @@ import { MemberViewModel } from "../member/member.models";
export interface ProtocolPresenceViewModel { export interface ProtocolPresenceViewModel {
memberId: number; memberId: number;
absent: boolean; absent: boolean;
excused: boolean;
protocolId: number; protocolId: number;
} }