diff --git a/api/methods.py b/api/methods.py new file mode 100644 index 0000000..747395b --- /dev/null +++ b/api/methods.py @@ -0,0 +1,364 @@ +from db import dbGetMany, dbGetOne + +def get_accounts(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + FROM account_t + """, + "params": () + } + ) + +def get_account(user, token_info, accountId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + FROM account_t + WHERE id = %s + """, + "params": (accountId, ) + } + ) +def get_tenants(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,salutation + ,firstname + ,lastname + ,address1 + ,address2 + ,address3 + ,zip + ,city + ,phone1 + ,phone2 + ,iban + ,account + FROM tenant_t + """, + "params": () + } + ) + +def get_tenant(user, token_info, tenantId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,salutation + ,firstname + ,lastname + ,address1 + ,address2 + ,address3 + ,zip + ,city + ,phone1 + ,phone2 + ,iban + ,account + FROM tenant_t + WHERE id = %s + """, + "params": (tenantId, ) + } + ) +def get_premises(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + ,street + ,zip + ,city + FROM premise_t + """, + "params": () + } + ) + +def get_premise(user, token_info, premiseId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + ,street + ,zip + ,city + FROM premise_t + WHERE id = %s + """, + "params": (premiseId, ) + } + ) +def get_flats(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + ,premise + ,area + ,flat_no + FROM flat_t + """, + "params": () + } + ) + +def get_flat(user, token_info, flatId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + ,premise + ,area + ,flat_no + FROM flat_t + WHERE id = %s + """, + "params": (flatId, ) + } + ) +def get_overhead_advances(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + ,amount + ,startdate + ,enddate + FROM overhead_advance_t + """, + "params": () + } + ) + +def get_overhead_advance(user, token_info, overhead_advanceId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + ,amount + ,startdate + ,enddate + FROM overhead_advance_t + WHERE id = %s + """, + "params": (overhead_advanceId, ) + } + ) +def get_overhead_advance_flat_mappings(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,overhead_advance + ,flat + FROM overhead_advance_flat_mapping_t + """, + "params": () + } + ) + +def get_overhead_advance_flat_mapping(user, token_info, overhead_advance_flat_mappingId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,overhead_advance + ,flat + FROM overhead_advance_flat_mapping_t + WHERE id = %s + """, + "params": (overhead_advance_flat_mappingId, ) + } + ) +def get_parkings(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + ,premise + FROM parking_t + """, + "params": () + } + ) + +def get_parking(user, token_info, parkingId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + ,premise + FROM parking_t + WHERE id = %s + """, + "params": (parkingId, ) + } + ) +def get_commercial_premises(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + ,premise + FROM commercial_premise_t + """, + "params": () + } + ) + +def get_commercial_premise(user, token_info, commercial_premiseId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + ,premise + FROM commercial_premise_t + WHERE id = %s + """, + "params": (commercial_premiseId, ) + } + ) +def get_tenancys(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + ,tenant + ,flat + ,parking + ,commercial_premise + ,startdate + ,enddate + FROM tenancy_t + """, + "params": () + } + ) + +def get_tenancy(user, token_info, tenancyId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + ,tenant + ,flat + ,parking + ,commercial_premise + ,startdate + ,enddate + FROM tenancy_t + WHERE id = %s + """, + "params": (tenancyId, ) + } + ) +def get_fees(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + ,amount + ,fee_type + ,startdate + ,enddate + FROM fee_t + """, + "params": () + } + ) + +def get_fee(user, token_info, feeId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + ,amount + ,fee_type + ,startdate + ,enddate + FROM fee_t + WHERE id = %s + """, + "params": (feeId, ) + } + ) +def get_tenancy_fee_mappings(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,tenancy + ,fee + FROM tenancy_fee_mapping_t + """, + "params": () + } + ) + +def get_tenancy_fee_mapping(user, token_info, tenancy_fee_mappingId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,tenancy + ,fee + FROM tenancy_fee_mapping_t + WHERE id = %s + """, + "params": (tenancy_fee_mappingId, ) + } + ) +def get_account_entrys(user, token_info): + return dbGetMany(user, token_info, { + "statement": """ +SELECT + id + ,description + ,account + ,created_at + ,amount + FROM account_entry_t + """, + "params": () + } + ) + +def get_account_entry(user, token_info, account_entryId=None): + return dbGetOne(user, token_info, { + "statement": """ +SELECT + id + ,description + ,account + ,created_at + ,amount + FROM account_entry_t + WHERE id = %s + """, + "params": (account_entryId, ) + } + ) diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 0000000..0e0e54e --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,649 @@ +openapi: 3.0.0 +info: + title: hv2-api + version: "1" + description: "REST-API for the Nober Grundbesitz GbR Hausverwaltungs-Software" + termsOfService: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:termsofuse" + contact: + name: "Wolfgang Hottgenroth" + email: "wolfgang.hottgenroth@icloud.com" +externalDocs: + description: "Find more details here" + url: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:externaldocs" + +paths: + /v1/accounts: + get: + tags: [ "account" ] + summary: Return all normalized accounts + operationId: methods.get_accounts + responses: + '200': + description: accounts response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/account' + security: + - jwt: ['secret'] + /v1/accounts/{accountId}: + get: + tags: [ "account" ] + summary: Return the normalized account with given id + operationId: methods.get_account + parameters: + - name: accountId + in: path + required: true + schema: + type: integer + responses: + '200': + description: account response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/account' + security: + - jwt: ['secret'] + /v1/tenants: + get: + tags: [ "tenant" ] + summary: Return all normalized tenants + operationId: methods.get_tenants + responses: + '200': + description: tenants response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/tenant' + security: + - jwt: ['secret'] + /v1/tenants/{tenantId}: + get: + tags: [ "tenant" ] + summary: Return the normalized tenant with given id + operationId: methods.get_tenant + parameters: + - name: tenantId + in: path + required: true + schema: + type: integer + responses: + '200': + description: tenant response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/tenant' + security: + - jwt: ['secret'] + /v1/premises: + get: + tags: [ "premise" ] + summary: Return all normalized premises + operationId: methods.get_premises + responses: + '200': + description: premises response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/premise' + security: + - jwt: ['secret'] + /v1/premises/{premiseId}: + get: + tags: [ "premise" ] + summary: Return the normalized premise with given id + operationId: methods.get_premise + parameters: + - name: premiseId + in: path + required: true + schema: + type: integer + responses: + '200': + description: premise response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/premise' + security: + - jwt: ['secret'] + /v1/flats: + get: + tags: [ "flat" ] + summary: Return all normalized flats + operationId: methods.get_flats + responses: + '200': + description: flats response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/flat' + security: + - jwt: ['secret'] + /v1/flats/{flatId}: + get: + tags: [ "flat" ] + summary: Return the normalized flat with given id + operationId: methods.get_flat + parameters: + - name: flatId + in: path + required: true + schema: + type: integer + responses: + '200': + description: flat response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/flat' + security: + - jwt: ['secret'] + /v1/overhead_advances: + get: + tags: [ "overhead_advance" ] + summary: Return all normalized overhead_advances + operationId: methods.get_overhead_advances + responses: + '200': + description: overhead_advances response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/overhead_advance' + security: + - jwt: ['secret'] + /v1/overhead_advances/{overhead_advanceId}: + get: + tags: [ "overhead_advance" ] + summary: Return the normalized overhead_advance with given id + operationId: methods.get_overhead_advance + parameters: + - name: overhead_advanceId + in: path + required: true + schema: + type: integer + responses: + '200': + description: overhead_advance response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/overhead_advance' + security: + - jwt: ['secret'] + /v1/overhead_advance_flat_mappings: + get: + tags: [ "overhead_advance_flat_mapping" ] + summary: Return all normalized overhead_advance_flat_mappings + operationId: methods.get_overhead_advance_flat_mappings + responses: + '200': + description: overhead_advance_flat_mappings response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/overhead_advance_flat_mapping' + security: + - jwt: ['secret'] + /v1/overhead_advance_flat_mappings/{overhead_advance_flat_mappingId}: + get: + tags: [ "overhead_advance_flat_mapping" ] + summary: Return the normalized overhead_advance_flat_mapping with given id + operationId: methods.get_overhead_advance_flat_mapping + parameters: + - name: overhead_advance_flat_mappingId + in: path + required: true + schema: + type: integer + responses: + '200': + description: overhead_advance_flat_mapping response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/overhead_advance_flat_mapping' + security: + - jwt: ['secret'] + /v1/parkings: + get: + tags: [ "parking" ] + summary: Return all normalized parkings + operationId: methods.get_parkings + responses: + '200': + description: parkings response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/parking' + security: + - jwt: ['secret'] + /v1/parkings/{parkingId}: + get: + tags: [ "parking" ] + summary: Return the normalized parking with given id + operationId: methods.get_parking + parameters: + - name: parkingId + in: path + required: true + schema: + type: integer + responses: + '200': + description: parking response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/parking' + security: + - jwt: ['secret'] + /v1/commercial_premises: + get: + tags: [ "commercial_premise" ] + summary: Return all normalized commercial_premises + operationId: methods.get_commercial_premises + responses: + '200': + description: commercial_premises response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/commercial_premise' + security: + - jwt: ['secret'] + /v1/commercial_premises/{commercial_premiseId}: + get: + tags: [ "commercial_premise" ] + summary: Return the normalized commercial_premise with given id + operationId: methods.get_commercial_premise + parameters: + - name: commercial_premiseId + in: path + required: true + schema: + type: integer + responses: + '200': + description: commercial_premise response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/commercial_premise' + security: + - jwt: ['secret'] + /v1/tenancys: + get: + tags: [ "tenancy" ] + summary: Return all normalized tenancys + operationId: methods.get_tenancys + responses: + '200': + description: tenancys response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/tenancy' + security: + - jwt: ['secret'] + /v1/tenancys/{tenancyId}: + get: + tags: [ "tenancy" ] + summary: Return the normalized tenancy with given id + operationId: methods.get_tenancy + parameters: + - name: tenancyId + in: path + required: true + schema: + type: integer + responses: + '200': + description: tenancy response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/tenancy' + security: + - jwt: ['secret'] + /v1/fees: + get: + tags: [ "fee" ] + summary: Return all normalized fees + operationId: methods.get_fees + responses: + '200': + description: fees response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/fee' + security: + - jwt: ['secret'] + /v1/fees/{feeId}: + get: + tags: [ "fee" ] + summary: Return the normalized fee with given id + operationId: methods.get_fee + parameters: + - name: feeId + in: path + required: true + schema: + type: integer + responses: + '200': + description: fee response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/fee' + security: + - jwt: ['secret'] + /v1/tenancy_fee_mappings: + get: + tags: [ "tenancy_fee_mapping" ] + summary: Return all normalized tenancy_fee_mappings + operationId: methods.get_tenancy_fee_mappings + responses: + '200': + description: tenancy_fee_mappings response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/tenancy_fee_mapping' + security: + - jwt: ['secret'] + /v1/tenancy_fee_mappings/{tenancy_fee_mappingId}: + get: + tags: [ "tenancy_fee_mapping" ] + summary: Return the normalized tenancy_fee_mapping with given id + operationId: methods.get_tenancy_fee_mapping + parameters: + - name: tenancy_fee_mappingId + in: path + required: true + schema: + type: integer + responses: + '200': + description: tenancy_fee_mapping response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/tenancy_fee_mapping' + security: + - jwt: ['secret'] + /v1/account_entrys: + get: + tags: [ "account_entry" ] + summary: Return all normalized account_entrys + operationId: methods.get_account_entrys + responses: + '200': + description: account_entrys response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/account_entry' + security: + - jwt: ['secret'] + /v1/account_entrys/{account_entryId}: + get: + tags: [ "account_entry" ] + summary: Return the normalized account_entry with given id + operationId: methods.get_account_entry + parameters: + - name: account_entryId + in: path + required: true + schema: + type: integer + responses: + '200': + description: account_entry response + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/account_entry' + security: + - jwt: ['secret'] + +components: + securitySchemes: + jwt: + type: http + scheme: bearer + bearerFormat: JWT + x-bearerInfoFunc: auth.decodeToken + schemas: + account: + description: account + type: object + properties: + id: + type: integer + description: + type: string + tenant: + description: tenant + type: object + properties: + id: + type: integer + salutation: + type: string + firstname: + type: string + lastname: + type: string + address1: + type: string + address2: + type: string + address3: + type: string + zip: + type: string + city: + type: string + phone1: + type: string + phone2: + type: string + iban: + type: string + account: + type: integer + premise: + description: premise + type: object + properties: + id: + type: integer + description: + type: string + street: + type: string + zip: + type: string + city: + type: string + flat: + description: flat + type: object + properties: + id: + type: integer + description: + type: string + premise: + type: integer + area: + type: number + flat_no: + type: integer + overhead_advance: + description: overhead_advance + type: object + properties: + id: + type: integer + description: + type: string + amount: + type: number + startdate: + type: string + enddate: + type: string + overhead_advance_flat_mapping: + description: overhead_advance_flat_mapping + type: object + properties: + id: + type: integer + overhead_advance: + type: integer + flat: + type: integer + parking: + description: parking + type: object + properties: + id: + type: integer + description: + type: string + premise: + type: integer + commercial_premise: + description: commercial_premise + type: object + properties: + id: + type: integer + description: + type: string + premise: + type: integer + tenancy: + description: tenancy + type: object + properties: + id: + type: integer + description: + type: string + tenant: + type: integer + flat: + type: integer + parking: + type: integer + commercial_premise: + type: integer + startdate: + type: string + enddate: + type: string + fee: + description: fee + type: object + properties: + id: + type: integer + description: + type: string + amount: + type: number + fee_type: + type: string + startdate: + type: string + enddate: + type: string + tenancy_fee_mapping: + description: tenancy_fee_mapping + type: object + properties: + id: + type: integer + tenancy: + type: integer + fee: + type: integer + account_entry: + description: account_entry + type: object + properties: + id: + type: integer + description: + type: string + account: + type: integer + created_at: + type: string + amount: + type: number diff --git a/generate.sh b/generate.sh new file mode 100755 index 0000000..1296133 --- /dev/null +++ b/generate.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +find . -name \*.tmpl -exec python generate.py --schema schema.json --template {} \; + + diff --git a/schema/create.sql b/schema/create.sql new file mode 100644 index 0000000..38ab6d5 --- /dev/null +++ b/schema/create.sql @@ -0,0 +1,101 @@ +CREATE TABLE account_t ( + id serial not null primary key + ,description varchar(128) not null +); + +CREATE TABLE tenant_t ( + id serial not null primary key + ,salutation varchar(128) + ,firstname varchar(128) + ,lastname varchar(128) + ,address1 varchar(128) + ,address2 varchar(128) + ,address3 varchar(128) + ,zip varchar(10) + ,city varchar(128) + ,phone1 varchar(64) + ,phone2 varchar(64) + ,iban varchar(64) + ,account integer not null references account_t (id) +); + +CREATE TABLE premise_t ( + id serial not null primary key + ,description varchar(128) + ,street varchar(128) not null + ,zip varchar(10) not null + ,city varchar(128) not null +); + +CREATE TABLE flat_t ( + id serial not null primary key + ,description varchar(128) + ,premise integer references premise_t (id) + ,area numeric(10,2) not null + ,flat_no integer +); + +CREATE TABLE overhead_advance_t ( + id serial not null primary key + ,description varchar(128) + ,amount numeric(10,4) not null + ,startdate date + ,enddate date +); + +CREATE TABLE overhead_advance_flat_mapping_t ( + id serial not null primary key + ,overhead_advance integer not null references overhead_advance_t (id) + ,flat integer not null references flat_t (id) +); + +CREATE TABLE parking_t ( + id serial not null primary key + ,description varchar(128) + ,premise integer references premise_t (id) +); + +CREATE TABLE commercial_premise_t ( + id serial not null primary key + ,description varchar(128) + ,premise integer references premise_t (id) +); + +CREATE TABLE tenancy_t ( + id serial not null primary key + ,description varchar(128) + ,tenant integer not null references tenant_t (id) + ,flat integer references flat_t (id) + ,parking integer references parking_t (id) + ,commercial_premise integer references commercial_premise_t (id) + ,startdate date not null + ,enddate date + ,constraint tenancy_only_one_object check ((flat is not null and parking is null and commercial_premise is null) or (flat is null and parking is not null and commercial_premise is null) or (flat is null and parking is null and commercial_premise is not null)) +); + +CREATE TABLE fee_t ( + id serial not null primary key + ,description varchar(128) + ,amount numeric(10,2) not null + ,fee_type varchar(10) not null + ,startdate date + ,enddate date + ,constraint fee_fee_type check (fee_type = 'per_area' or fee_type = 'total') +); + +CREATE TABLE tenancy_fee_mapping_t ( + id serial not null primary key + ,tenancy integer not null references tenancy_t (id) + ,fee integer not null references fee_t (id) +); + +CREATE TABLE account_entry_t ( + id serial not null primary key + ,description varchar(128) not null + ,account integer not null references account_t (id) + ,created_at timestamp not null default now() + ,amount numeric(10,2) not null +); + + + diff --git a/ui/hv2-ui/src/app/data-object-service.ts b/ui/hv2-ui/src/app/data-object-service.ts new file mode 100644 index 0000000..1bf5f14 --- /dev/null +++ b/ui/hv2-ui/src/app/data-object-service.ts @@ -0,0 +1,140 @@ +import { Injectable } from '@angular/core'; +import { Observable, of } from 'rxjs'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; + +import { MessageService } from './message.service'; +import { serviceBaseUrl } from './config'; + + +import { Account } from './data-objects'; +import { Tenant } from './data-objects'; +import { Premise } from './data-objects'; +import { Flat } from './data-objects'; +import { OverheadAdvance } from './data-objects'; +import { OverheadAdvanceFlatMapping } from './data-objects'; +import { Parking } from './data-objects'; +import { CommercialPremise } from './data-objects'; +import { Tenancy } from './data-objects'; +import { Fee } from './data-objects'; +import { TenancyFeeMapping } from './data-objects'; +import { AccountEntry } from './data-objects'; + + +@Injectable({ + providedIn: 'root' +}) + + + + + + +export class AccountService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getAccount(): Promise { + this.messageService.add(`AccountService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/account`).toPromise() + } +} + +export class TenantService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getTenant(): Promise { + this.messageService.add(`TenantService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/tenant`).toPromise() + } +} + +export class PremiseService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getPremise(): Promise { + this.messageService.add(`PremiseService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/premise`).toPromise() + } +} + +export class FlatService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getFlat(): Promise { + this.messageService.add(`FlatService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/flat`).toPromise() + } +} + +export class OverheadAdvanceService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getOverheadAdvance(): Promise { + this.messageService.add(`OverheadAdvanceService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/overhead_advance`).toPromise() + } +} + +export class OverheadAdvanceFlatMappingService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getOverheadAdvanceFlatMapping(): Promise { + this.messageService.add(`OverheadAdvanceFlatMappingService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/overhead_advance_flat_mapping`).toPromise() + } +} + +export class ParkingService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getParking(): Promise { + this.messageService.add(`ParkingService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/parking`).toPromise() + } +} + +export class CommercialPremiseService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getCommercialPremise(): Promise { + this.messageService.add(`CommercialPremiseService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/commercial_premise`).toPromise() + } +} + +export class TenancyService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getTenancy(): Promise { + this.messageService.add(`TenancyService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/tenancy`).toPromise() + } +} + +export class FeeService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getFee(): Promise { + this.messageService.add(`FeeService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/fee`).toPromise() + } +} + +export class TenancyFeeMappingService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getTenancyFeeMapping(): Promise { + this.messageService.add(`TenancyFeeMappingService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/tenancy_fee_mapping`).toPromise() + } +} + +export class AccountEntryService { + constructor(private messageService: MessageService, private http: HttpClient) { } + + async getAccountEntry(): Promise { + this.messageService.add(`AccountEntryService: fetch data`); + return this.http.get(`${serviceBaseUrl}/v1/account_entry`).toPromise() + } +} + + diff --git a/ui/hv2-ui/src/app/data-objects.ts b/ui/hv2-ui/src/app/data-objects.ts new file mode 100644 index 0000000..3d1a28d --- /dev/null +++ b/ui/hv2-ui/src/app/data-objects.ts @@ -0,0 +1,87 @@ + +export interface Account { + description: string +} + +export interface Tenant { + salutation: string + firstname: string + lastname: string + address1: string + address2: string + address3: string + zip: string + city: string + phone1: string + phone2: string + iban: string + account: number +} + +export interface Premise { + description: string + street: string + zip: string + city: string +} + +export interface Flat { + description: string + premise: number + area: number + flat_no: number +} + +export interface OverheadAdvance { + description: string + amount: number + startdate: string + enddate: string +} + +export interface OverheadAdvanceFlatMapping { + overhead_advance: number + flat: number +} + +export interface Parking { + description: string + premise: number +} + +export interface CommercialPremise { + description: string + premise: number +} + +export interface Tenancy { + description: string + tenant: number + flat: number + parking: number + commercial_premise: number + startdate: string + enddate: string +} + +export interface Fee { + description: string + amount: number + fee_type: string + startdate: string + enddate: string +} + +export interface TenancyFeeMapping { + tenancy: number + fee: number +} + +export interface AccountEntry { + description: string + account: number + created_at: string + amount: number +} + +