Initial commit

This commit is contained in:
Kevin Harlay
2026-09-07 12:18:17 +02:00
commit a15811ed32
47 changed files with 16823 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Entry, CreateEntryDto, UpdateEntryDto, ImportResult } from '../models';
@Injectable({ providedIn: 'root' })
export class EntryService {
constructor(private http: HttpClient) {}
getEntries(monthId: string): Observable<Entry[]> {
return this.http.get<Entry[]>(`/api/months/${monthId}/entries`);
}
createEntry(monthId: string, dto: CreateEntryDto): Observable<Entry> {
return this.http.post<Entry>(`/api/months/${monthId}/entries`, dto);
}
updateEntry(id: string, dto: UpdateEntryDto): Observable<Entry> {
return this.http.put<Entry>(`/api/entries/${id}`, dto);
}
deleteEntry(id: string): Observable<void> {
return this.http.delete<void>(`/api/entries/${id}`);
}
importCsv(monthId: string, file: File): Observable<ImportResult> {
const formData = new FormData();
formData.append('file', file);
return this.http.post<ImportResult>(`/api/months/${monthId}/entries/import`, formData);
}
exportExcel(monthId: string, fileName: string): Observable<Blob> {
return this.http.get(`/api/months/${monthId}/entries/export?fileName=${encodeURIComponent(fileName)}`, {
responseType: 'blob',
});
}
}