fix admn controller

This commit is contained in:
Mateusz Gruszczyński
2026-04-06 16:29:58 +02:00
parent 78a0b21e48
commit 723e3441df
10 changed files with 43 additions and 46 deletions

View File

@@ -1,9 +1,9 @@
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';
import { decimalTransformer } from '../utils/decimal.js';
import { dateTimeColumnType } from '../utils/db-column-types.js';
export type ExpenseStatus = 'DRAFT' | 'PENDING' | 'APPROVED' | 'REJECTED';
export type DuplicateReviewStatus = 'OPEN' | 'CONFIRMED' | 'DISMISSED';
@@ -49,24 +49,24 @@ export class Expense {
@Column({ type: 'varchar', length: 20, nullable: true })
duplicateStatus!: DuplicateReviewStatus | null;
@Column({ type: 'datetime', nullable: true })
@Column({ type: dateTimeColumnType, nullable: true })
duplicateReviewedAt!: Date | null;
@Column({ type: 'varchar', length: 36, nullable: true })
recurringSourceId!: string | null;
@CreateDateColumn({ type: 'datetime' })
@CreateDateColumn({ type: dateTimeColumnType })
createdAt!: Date;
@UpdateDateColumn({ type: 'datetime' })
@UpdateDateColumn({ type: dateTimeColumnType })
updatedAt!: Date;
@ManyToOne(() => User, (user) => user.expenses, { onDelete: 'CASCADE' })
user!: Relation<User>;
user!: User;
@ManyToOne(() => Category, (category) => category.expenses, { eager: true, onDelete: 'RESTRICT' })
category!: Relation<Category>;
category!: Category;
@OneToMany(() => Proof, (proof) => proof.expense, { eager: true, cascade: true })
proofs!: Relation<Proof[]>;
proofs!: Proof[];
}