feat: Add max slot count to event type entity, migration, and admin form.

This commit is contained in:
Schneider Roland
2026-01-02 13:11:26 +01:00
parent df35b8991d
commit be029ee054
5 changed files with 48 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
import { Event } from './event.entity';
import { IsString, IsOptional } from 'class-validator';
import { IsString, IsOptional, IsNumber } from 'class-validator';
@Entity({ name: 'event_type' })
export class EventType {
@@ -23,6 +23,11 @@ export class EventType {
@IsString()
color: string | null;
@Column({ type: 'integer', nullable: true })
@IsOptional()
@IsNumber()
max_slot_count: number | null;
@OneToMany(() => Event, (event) => event.eventType)
events: Event[];
}

View File

@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddMaxSlotCountToEventType1763106308125 implements MigrationInterface {
name = 'AddMaxSlotCountToEventType1763106308125';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "event_type" ADD COLUMN "max_slot_count" integer NULL`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "event_type" DROP COLUMN "max_slot_count"`);
}
}