scaffold expense list
This commit is contained in:
parent
7bb21f8796
commit
0bf8bd6c9c
22 changed files with 258 additions and 133 deletions
32
src/app/services/expense.service.ts
Normal file
32
src/app/services/expense.service.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
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[];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue