inseret monthly forderungen
This commit is contained in:
parent
59625cac68
commit
d69e4be6a9
@ -1,4 +1,4 @@
|
||||
from dbpool import getConnection, getOne, getMany, putOne
|
||||
from dbpool import getConnection, getOne, getMany, putOne, call
|
||||
import datetime
|
||||
import decimal
|
||||
import dateparser
|
||||
@ -122,3 +122,6 @@ INSERT INTO zahlung (datum_soll, datum_ist, mieter, betrag, kommentar)
|
||||
except KeyError as e:
|
||||
print("Some parameter missing: {}".format(e))
|
||||
return str(e), 500
|
||||
|
||||
def insertAllForMonth():
|
||||
return call("insert_monatl_miet_forderung")
|
25
dbpool.py
25
dbpool.py
@ -94,4 +94,27 @@ def putOne(stmt, params, objName):
|
||||
cur.close()
|
||||
if dbh:
|
||||
dbh.close()
|
||||
|
||||
|
||||
def call(procName):
|
||||
dbh = None
|
||||
cur = None
|
||||
try:
|
||||
dbh = getConnection()
|
||||
cur = dbh.cursor(dictionary=True)
|
||||
cur.execute("CALL {}(null)".format(procName))
|
||||
dbh.commit()
|
||||
return "{} successfully called {}".format(procName), 202
|
||||
except mariadb.Error as err:
|
||||
dbh.rollback()
|
||||
print("Database error in call {}: {}".format(procName, err))
|
||||
return str(err), 500
|
||||
except Exception as err:
|
||||
dbh.rollback()
|
||||
print("Some error in call {}: {}".format(procName, err))
|
||||
return str(err), 500
|
||||
finally:
|
||||
print("return connection in call {}".format(procName))
|
||||
if cur:
|
||||
cur.close()
|
||||
if dbh:
|
||||
dbh.close()
|
||||
|
11
swagger.yaml
11
swagger.yaml
@ -330,6 +330,17 @@ paths:
|
||||
description: Zahlung successfully inserted
|
||||
500:
|
||||
description: Some server or database error
|
||||
/hv/forderung/insertAllForMonth:
|
||||
post:
|
||||
tags: [ "Forderung" ]
|
||||
operationId: ZahlungenForderungen.insertAllForMonth
|
||||
summary: Insert the Forderungen for the insertAllForMonth
|
||||
responses:
|
||||
202:
|
||||
description: Forderungen successfully inserted
|
||||
500:
|
||||
description: Some server or database error
|
||||
|
||||
|
||||
|
||||
components:
|
||||
|
Loading…
x
Reference in New Issue
Block a user