zmiany
This commit is contained in:
29
web/src/app/core/services/recurring-expenses.service.ts
Normal file
29
web/src/app/core/services/recurring-expenses.service.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import type { RecurringExpense } from '../../shared/models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class RecurringExpensesService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
list() {
|
||||
return this.http.get<{ items: RecurringExpense[] }>(`${environment.apiBaseUrl}/recurring-expenses`);
|
||||
}
|
||||
|
||||
create(payload: Partial<RecurringExpense> & { categoryId: string }) {
|
||||
return this.http.post<{ item: RecurringExpense }>(`${environment.apiBaseUrl}/recurring-expenses`, payload);
|
||||
}
|
||||
|
||||
update(id: string, payload: Partial<RecurringExpense> & { categoryId: string }) {
|
||||
return this.http.put<{ item: RecurringExpense }>(`${environment.apiBaseUrl}/recurring-expenses/${id}`, payload);
|
||||
}
|
||||
|
||||
delete(id: string) {
|
||||
return this.http.delete<void>(`${environment.apiBaseUrl}/recurring-expenses/${id}`);
|
||||
}
|
||||
|
||||
runNow() {
|
||||
return this.http.post<{ message: string }>(`${environment.apiBaseUrl}/recurring-expenses/run`, {});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user