Zahlung and Forderung
This commit is contained in:
16
hv-ui/src/app/zahlung-forderung.service.spec.ts
Normal file
16
hv-ui/src/app/zahlung-forderung.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ZahlungForderungService } from './zahlung-forderung.service';
|
||||||
|
|
||||||
|
describe('ZahlungForderungService', () => {
|
||||||
|
let service: ZahlungForderungService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(ZahlungForderungService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
25
hv-ui/src/app/zahlung-forderung.service.ts
Normal file
25
hv-ui/src/app/zahlung-forderung.service.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { Injectable } from '@angular/core'
|
||||||
|
import { Observable, of } from 'rxjs'
|
||||||
|
import { HttpClient, HttpHeaders } from '@angular/common/http'
|
||||||
|
|
||||||
|
import { ZahlungForderung } from './zahlung-forderung'
|
||||||
|
import { Forderung } from './forderung'
|
||||||
|
import { MessageService } from './message.service'
|
||||||
|
import { serviceBaseUrl } from './config'
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ZahlungForderungService {
|
||||||
|
constructor(private messageService: MessageService, private http: HttpClient) { }
|
||||||
|
|
||||||
|
getZahlungenForderungenByMieterAndYear(mieterId: number, year: number): Promise<ZahlungForderung[]> {
|
||||||
|
this.messageService.add(`ZahlungForderungService: fetched zahlungen and forderungen by mieter ${mieterId} and year ${year}`)
|
||||||
|
return this.http.get<ZahlungForderung[]>(`${serviceBaseUrl}/hv/mieter/${mieterId}/zahlungforderung${year}`).toPromise()
|
||||||
|
}
|
||||||
|
|
||||||
|
getForderung(id: number): Promise<Forderung> {
|
||||||
|
this.messageService.add(`ZahlungForderungService: fetch forderung id=${id}`)
|
||||||
|
return this.http.get<Forderung>(`${serviceBaseUrl}/hv/forderung/${id}`).toPromise()
|
||||||
|
}
|
||||||
|
}
|
10
hv-ui/src/app/zahlung-forderung.ts
Normal file
10
hv-ui/src/app/zahlung-forderung.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export interface ZahlungForderung {
|
||||||
|
id: number
|
||||||
|
zf_type: string
|
||||||
|
mieter: number
|
||||||
|
datum_soll: string
|
||||||
|
datum_ist: string
|
||||||
|
betrag_zahlung: number
|
||||||
|
betrag_forderung: number
|
||||||
|
kommentar: string
|
||||||
|
}
|
Reference in New Issue
Block a user