common-cents-web/src/app/services/expense.service.ts
2026-02-12 23:41:54 -06:00

32 lines
840 B
TypeScript

import { Injectable } from '@angular/core';
import { SubCategory } from './sub-category.service';
import { Category } from './category.service';
import { Merchant } from './merchant.service';
import { Tag } from './tag.service';
import { HttpService } from './http.service';
@Injectable({
providedIn: 'root',
})
export class ExpenseService {
public static readonly EXPENSE_PATH = 'http://localhost:3000/common-cents/expenses';
public constructor(private readonly http: HttpService) { }
public async getExpenses(): Promise<Expense[]> {
return this.http.get<Expense[]>(ExpenseService.EXPENSE_PATH);
}
}
export interface Expense {
id: string;
year: string;
month: string;
day: string;
cents: number;
description?: string;
category: Category;
subCategory?: SubCategory;
merchant?: Merchant;
tags: Tag[];
}