metadata-management #10

Merged
joe merged 18 commits from metadata-management into master 2026-02-26 18:35:33 +00:00
5 changed files with 11 additions and 10 deletions
Showing only changes of commit 248ded53c0 - Show all commits

View file

@ -47,6 +47,7 @@ export class ExpenseComponent {
const snackId = this.snackBar.staticBar('Tracking new expense...');
try {
await this.expenseService.postExpense(postExpense);
await this.expenseService.fetchExpenses();
this.resetForm();
this.snackBar.dismiss(snackId);
this.snackBar.autoBar('Expense tracked!');

View file

@ -18,7 +18,8 @@ export class CategoriesComponent {
public constructor(private readonly categoryService: CategoryService) { }
public async createCategory(name: string): Promise<void> {
console.log('Creating new category', name);
await this.categoryService.createCategory({ name });
await this.categoryService.fetchCategories();
}
public async updateCategory(category: Category): Promise<void> {

View file

@ -15,11 +15,9 @@
</mat-form-field>
<div class="metadata-edit-buttons">
@if (metadata()) {
<button matIconButton (click)="reset()">
<mat-icon>undo</mat-icon>
</button>
}
<button matIconButton (click)="reset()">
<mat-icon>undo</mat-icon>
</button>
<button matIconButton (click)="saveMetaData()" [disabled]="!nameValid()">
<mat-icon>save</mat-icon>

View file

@ -17,6 +17,10 @@ export class CategoryService {
this.internalCategories.set(await this.http.get<Category[]>(this.categoryPath));
}
public async createCategory(category: CreateCategory): Promise<Category> {
return await this.http.post<Category>(this.categoryPath, category);
}
public async updateCategory(category: Category): Promise<Category> {
return await this.http.put<Category>(this.categoryPath, category);
}

View file

@ -22,10 +22,7 @@ export class ExpenseService {
}
public async postExpense(createExpense: CreateExpense): Promise<Expense> {
const createdExpense = await this.http.post<Expense>(this.expensePath, createExpense);
await this.fetchExpenses();
return createdExpense;
return await this.http.post<Expense>(this.expensePath, createExpense);
}
public async updateExpense(updateExpense: UpdateExpense): Promise<Expense> {