base tables

This commit is contained in:
Julian Krauser 2024-10-26 15:08:05 +02:00
parent 72fb6fbc20
commit e7b8257336
4 changed files with 113 additions and 0 deletions

30
src/entity/calendar.ts Normal file
View file

@ -0,0 +1,30 @@
import { Column, Entity, ManyToOne, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
import { calendarType } from "./calendarType";
@Entity()
export class calendar {
@PrimaryGeneratedColumn("increment")
id: number;
@Column({ type: "date", nullable: false })
date: Date;
@Column({ type: "timestamp", nullable: true })
starttime: Date;
@Column({ type: "datetime", nullable: true })
endtime: Date;
@Column({ type: "varchar", length: 255, nullable: false })
title: string;
@Column({ type: "text", nullable: true })
content: string;
@ManyToOne(() => calendarType, (t) => t.calendar, {
nullable: false,
onDelete: "RESTRICT",
onUpdate: "RESTRICT",
})
type: calendarType;
}

View file

@ -0,0 +1,21 @@
import { Column, Entity, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
import { calendar } from "./calendar";
@Entity()
export class calendarType {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
type: string;
@Column({ type: "boolean" }) // none specified cal dav request
nscdr: boolean;
@OneToMany(() => calendar, (c) => c.type, {
nullable: false,
onDelete: "RESTRICT",
onUpdate: "RESTRICT",
})
calendar: calendar[];
}