feat: add hazards
Some checks failed
TrafficCue Server CI / check (push) Failing after 27s
TrafficCue Server CD / build (push) Successful in 1m48s

This commit is contained in:
2025-09-18 11:48:37 +02:00
parent 7b8210ab7e
commit fb8e3ae8d5
4 changed files with 119 additions and 0 deletions

32
src/entities/Hazard.ts Normal file
View File

@ -0,0 +1,32 @@
import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import type { User } from "./User";
@Entity()
export class Hazard extends BaseEntity {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
type: "float"
})
latitude: number;
@Column({
type: "float"
})
longitude: number;
@Column()
type: string;
@Column()
votes: number;
@Column({
default: () => "NOW()",
})
created_at: Date;
@ManyToOne("User", (u: User) => u.hazards)
user: User;
}