diff --git a/api/additional_endpoints.yaml b/api/additional_endpoints.yaml
index 6775990..8b20cad 100644
--- a/api/additional_endpoints.yaml
+++ b/api/additional_endpoints.yaml
@@ -88,4 +88,26 @@
$ref: '#/components/schemas/tenant_with_saldo'
security:
- jwt: ['secret']
+ /v1/accounts/bydescription/{description}:
+ get:
+ tags: [ "account" ]
+ summary: Return the normalized account with given description
+ operationId: additional_methods.get_account_by_description
+ parameters:
+ - name: description
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: account response
+ content:
+ 'application/json':
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/account'
+ security:
+ - jwt: ['secret']
diff --git a/api/additional_methods.py b/api/additional_methods.py
index 65169d7..0fde45c 100644
--- a/api/additional_methods.py
+++ b/api/additional_methods.py
@@ -43,3 +43,14 @@ def get_tenant_with_saldo(user, token_info):
"params": ()
}
)
+
+def get_account_by_description(user, token_info, description=None):
+ return dbGetOne(user, token_info, {
+ "statement": """
+SELECT a.id ,a.description
+ FROM account_t a
+ WHERE a.description = %s""",
+ "params": (description, )
+ }
+ )
+
diff --git a/api/openapi.yaml b/api/openapi.yaml
index af89473..ee4c3cd 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -1509,6 +1509,28 @@ paths:
$ref: '#/components/schemas/tenant_with_saldo'
security:
- jwt: ['secret']
+ /v1/accounts/bydescription/{description}:
+ get:
+ tags: [ "account" ]
+ summary: Return the normalized account with given description
+ operationId: additional_methods.get_account_by_description
+ parameters:
+ - name: description
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: account response
+ content:
+ 'application/json':
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/account'
+ security:
+ - jwt: ['secret']
components:
diff --git a/schema/create.sql b/schema/create.sql
index d40ad07..d6392fd 100644
--- a/schema/create.sql
+++ b/schema/create.sql
@@ -145,7 +145,7 @@ GRANT SELECT, UPDATE ON account_entry_category_t_id_seq TO hv2;
CREATE TABLE account_entry_t (
id serial not null primary key
- ,description varchar(128) not null
+ ,description varchar(1024) 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/account/account.component.html b/ui/hv2-ui/src/app/account/account.component.html
index faf0122..1914aff 100644
--- a/ui/hv2-ui/src/app/account/account.component.html
+++ b/ui/hv2-ui/src/app/account/account.component.html
@@ -8,7 +8,7 @@
Kategorie
-
+
{{p.description}}
diff --git a/ui/hv2-ui/src/app/config.ts b/ui/hv2-ui/src/app/config.ts
index 7cdcad6..3b143eb 100644
--- a/ui/hv2-ui/src/app/config.ts
+++ b/ui/hv2-ui/src/app/config.ts
@@ -1,5 +1,5 @@
-export const serviceBaseUrl = "https://api.hv.nober.de";
+// export const serviceBaseUrl = "https://api.hv.nober.de";
// export const serviceBaseUrl = "http://172.16.10.38:5000";
-// export const serviceBaseUrl = "http://localhost:8080"
+export const serviceBaseUrl = "http://localhost:8080"
export const authserviceBaseUrl = "https://authservice.hottis.de"
export const applicationId = "hv2"
diff --git a/ui/hv2-ui/src/app/ext-data-object-service.ts b/ui/hv2-ui/src/app/ext-data-object-service.ts
index 5caf12d..5e1d869 100644
--- a/ui/hv2-ui/src/app/ext-data-object-service.ts
+++ b/ui/hv2-ui/src/app/ext-data-object-service.ts
@@ -6,7 +6,7 @@ import { MessageService } from './message.service';
import { serviceBaseUrl } from './config';
-import { Fee, OverheadAdvance } from './data-objects';
+import { Account, Fee, OverheadAdvance } from './data-objects';
import { Saldo, Tenant_with_Saldo } from './ext-data-objects';
@@ -19,6 +19,11 @@ export class ExtApiService {
return this.http.get(`${serviceBaseUrl}/v1/overhead_advances/flat/${id}`).toPromise()
}
+ async getAccountByDescription(description: string): Promise {
+ this.messageService.add(`ExtApiService: get account by description ${description}`);
+ return this.http.get(`${serviceBaseUrl}/v1/accounts/bydescription/${description}`).toPromise()
+ }
+
async getFeeByTenancies(id: number): Promise {
this.messageService.add(`ExtApiService: get fees by flat ${id}`);
return this.http.get(`${serviceBaseUrl}/v1/fees/tenancy/${id}`).toPromise()
diff --git a/ui/hv2-ui/src/app/ledger/ledger.component.html b/ui/hv2-ui/src/app/ledger/ledger.component.html
index 21c80e7..a9bc044 100644
--- a/ui/hv2-ui/src/app/ledger/ledger.component.html
+++ b/ui/hv2-ui/src/app/ledger/ledger.component.html
@@ -1 +1,12 @@
-ledger works!
+
+
+
+ Buchführung
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ui/hv2-ui/src/app/ledger/ledger.component.ts b/ui/hv2-ui/src/app/ledger/ledger.component.ts
index 60a3b94..a7d4078 100644
--- a/ui/hv2-ui/src/app/ledger/ledger.component.ts
+++ b/ui/hv2-ui/src/app/ledger/ledger.component.ts
@@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
+import { AccountService } from '../data-object-service';
+import { Account } from '../data-objects';
+import { ExtApiService } from '../ext-data-object-service';
+import { MessageService } from '../message.service';
@Component({
selector: 'app-ledger',
@@ -7,9 +11,27 @@ import { Component, OnInit } from '@angular/core';
})
export class LedgerComponent implements OnInit {
- constructor() { }
+ account: Account
+ accountId: number
- ngOnInit(): void {
+ constructor(
+ private extApiService: ExtApiService,
+ private messageService: MessageService
+ ) { }
+
+ async getAccount(): Promise {
+ try {
+ this.messageService.add("Trying to load ledger account")
+ this.account = await this.extApiService.getAccountByDescription('Ledger')
+ this.messageService.add("Account loaded")
+ } catch (err) {
+ this.messageService.add(JSON.stringify(err, undefined, 4))
+ }
+ }
+
+ async ngOnInit(): Promise {
+ await this.getAccount()
+ this.accountId = this.account.id
}
}