Rework Expenses resource (#3)

Co-authored-by: Joe Arndt <jmarndt@users.noreply.github.com>
Reviewed-on: #3
This commit is contained in:
Joe 2026-02-09 20:26:34 +00:00
parent c6434de89d
commit 6600745072
28 changed files with 317 additions and 89 deletions

View file

@ -0,0 +1,39 @@
import { Column, Entity, JoinTable, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Tag } from '../../tags/entities/tag.entity';
import { SubCategory } from '../../sub-categories/entities/sub-category.entity';
import { Category } from '../../categories/entities/category.entity';
import { Merchant } from '../../merchants/entities/merchant.entity';
@Entity()
export class Expense {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
year: string;
@Column()
month: string;
@Column()
day: string;
@Column()
cents: number;
@Column({ nullable: true })
description: string;
@ManyToOne(() => Category, { eager: true })
category: Category;
@ManyToOne(() => SubCategory, { nullable: true, eager: true })
subCategory: SubCategory;
@ManyToOne(() => Merchant, { nullable: true, eager: true })
merchant: Merchant;
@ManyToMany(() => Tag, { nullable: true, eager: true })
@JoinTable()
tags: Tag[];
}