add active mieters request

This commit is contained in:
Wolfgang Hottgenroth 2021-02-21 11:52:06 +01:00
parent 4f4b959e9e
commit ab44de341d
Signed by: wn
GPG Key ID: E49AF3B9EF6DD469
3 changed files with 42 additions and 1 deletions

View File

@ -21,6 +21,29 @@ SELECT m.id as id,
w.id = m.wohnung
""", [], "Mieter")
def get_mieters_active():
return getMany("""
SELECT m.id as id,
o.id as objekt,
w.id as wohnung,
w.shortname as wohnung_shortname,
o.shortname as objekt_shortname,
COALESCE(m.anrede, '-') as anrede,
COALESCE(m.vorname, '-') as vorname,
m.nachname as nachname,
COALESCE(m.strasse, '-') as strasse,
COALESCE(m.plz, '-') as plz,
COALESCE(m.ort, '-') as ort,
COALESCE(m.telefon, '-') as telefon,
m.einzug as einzug,
COALESCE(m.auszug, '-') as auszug
FROM wohnung w, objekt o, mieter m
WHERE o.id = w.objekt AND
w.id = m.wohnung AND
m.einzug <= curdate() and
(m.auszug is null or m.auszug > curdate())
""", [], "Mieter")
def get_mieter(id=None):
return getOne("""
SELECT m.id as id,

View File

@ -1,7 +1,7 @@
#!/bin/bash
IMAGE_NAME="registry.hottis.de/hv/hv-service"
VERSION=0.0.3
VERSION=0.0.4
docker build -t ${IMAGE_NAME}:${VERSION} .
docker push ${IMAGE_NAME}:${VERSION}

View File

@ -126,6 +126,24 @@ paths:
description: No Mieter available
500:
description: Some server error
/hv/mieters/active:
get:
tags: [ "Mieter" ]
operationId: Mieter.get_mieters_active
summary: Returns all currently active Mieters
responses:
200:
description: Successful response.
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/Mieter'
404:
description: No Mieter available
500:
description: Some server error
/hv/mieter/{id}:
get:
tags: [ "Mieter" ]