feat: Add max slot count to event type entity, migration, and admin form.
This commit is contained in:
@@ -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[];
|
||||
}
|
||||
|
||||
@@ -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"`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user