ledger
This commit is contained in:
parent
8c4dbe7d71
commit
2b883aee02
@ -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']
|
||||
|
||||
|
@ -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, )
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -8,7 +8,7 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Kategorie</mat-label>
|
||||
<mat-select [(ngModel)]="newAccountEntry.account_entry_category" name="category" disabled="shallBeRentPayment">
|
||||
<mat-select [(ngModel)]="newAccountEntry.account_entry_category" name="category" [disabled]="shallBeRentPayment">
|
||||
<mat-option *ngFor="let p of accountEntryCategories" [value]="p.id">{{p.description}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
@ -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"
|
||||
|
@ -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<OverheadAdvance[]>(`${serviceBaseUrl}/v1/overhead_advances/flat/${id}`).toPromise()
|
||||
}
|
||||
|
||||
async getAccountByDescription(description: string): Promise<Account> {
|
||||
this.messageService.add(`ExtApiService: get account by description ${description}`);
|
||||
return this.http.get<Account>(`${serviceBaseUrl}/v1/accounts/bydescription/${description}`).toPromise()
|
||||
}
|
||||
|
||||
async getFeeByTenancies(id: number): Promise<Fee[]> {
|
||||
this.messageService.add(`ExtApiService: get fees by flat ${id}`);
|
||||
return this.http.get<Fee[]>(`${serviceBaseUrl}/v1/fees/tenancy/${id}`).toPromise()
|
||||
|
@ -1 +1,12 @@
|
||||
<p>ledger works!</p>
|
||||
<mat-card class="defaultCard">
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
Buchführung
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
|
||||
<app-account [selectedAccountId]="accountId" [shallBeRentPayment]="false"></app-account>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
@ -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<void> {
|
||||
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<void> {
|
||||
await this.getAccount()
|
||||
this.accountId = this.account.id
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user