fix relations
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||
import type { Relation } from 'typeorm';
|
||||
import { Category } from './Category.js';
|
||||
import { Proof } from './Proof.js';
|
||||
import { User } from './User.js';
|
||||
@@ -61,11 +62,11 @@ export class Expense {
|
||||
updatedAt!: Date;
|
||||
|
||||
@ManyToOne(() => User, (user) => user.expenses, { onDelete: 'CASCADE' })
|
||||
user!: User;
|
||||
user!: Relation<User>;
|
||||
|
||||
@ManyToOne(() => Category, (category) => category.expenses, { eager: true, onDelete: 'RESTRICT' })
|
||||
category!: Category;
|
||||
category!: Relation<Category>;
|
||||
|
||||
@OneToMany(() => Proof, (proof) => proof.expense, { eager: true, cascade: true })
|
||||
proofs!: Proof[];
|
||||
proofs!: Relation<Proof[]>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user