feat: move to typeorm
Some checks failed
TrafficCue Server CI / check (push) Failing after 23s

This commit is contained in:
Cfp
2025-08-21 12:18:56 +02:00
parent b8549c6deb
commit 03e602c814
9 changed files with 380 additions and 64 deletions

28
src/entities/User.ts Normal file
View File

@ -0,0 +1,28 @@
import { BaseEntity, Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { type Review } from "./Review";
import { type Saved } from "./Saved";
@Entity()
export class User extends BaseEntity {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column()
username: string;
@OneToMany("Review", (r: Review) => r.user)
reviews: Review[];
@OneToMany("Saved", (s: Saved) => s.user)
saved: Saved[];
@Column({
default: () => "NOW()"
})
updated_at: Date;
@Column({
default: () => "NOW()"
})
created_at: Date;
}