mitarbeiter finished
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -36,7 +36,8 @@ class Navigation_cl(object):
|
||||
{'action': 'fehler' , 'text': 'Bearbeitung Fehlerdaten'},
|
||||
{'action': 'projekt' , 'text': 'Pflege Projekte'},
|
||||
{'action': 'komponente' , 'text': 'Pflege Komponenten'},
|
||||
{'action': 'mitarbeiter' , 'text': 'Pflege Daten Mitarbeiter'},
|
||||
{'action': 'qsmitarbeiter' , 'text': 'Pflege Daten QS-Mitarbeiter'},
|
||||
{'action': 'swentwickler' , 'text': 'Pflege Daten SW-Entwickler'},
|
||||
{'action': 'kategorien' , 'text': 'Pflege Kategorien'},
|
||||
{'action': 'prolist' , 'text': 'Auswertung Projekte/Fehler'},
|
||||
{'action': 'catlist' , 'text': 'Auswertung Kategorien/Fehler'}
|
||||
|
@ -3,14 +3,27 @@
|
||||
import json
|
||||
|
||||
import cherrypy
|
||||
#from .database import SourceDatabase_cl, EvaluatedDatabase_cl
|
||||
from .database import QsMitarbeiterDatabase_cl, SwEntwicklerDatabase_cl
|
||||
# Method-Dispatching!
|
||||
|
||||
# Übersicht Anforderungen / Methoden
|
||||
# (beachte: / relativ zu /navigation, siehe Konfiguration Server!)
|
||||
|
||||
#-------------------------------------------------------
|
||||
def adjustId_p(id_spl, data_opl):
|
||||
#-------------------------------------------------------
|
||||
|
||||
if id_spl == None:
|
||||
data_opl['id'] = ''
|
||||
elif id_spl == '':
|
||||
data_opl['id'] = ''
|
||||
elif id_spl == '0':
|
||||
data_opl['id'] = ''
|
||||
else:
|
||||
data_opl['id'] = id_spl
|
||||
return data_opl
|
||||
|
||||
|
||||
"""
|
||||
Anforderung GET PUT POST DELETE
|
||||
-----------------------------------------------------------------------------------------
|
||||
@ -32,27 +45,87 @@ class QsMitarbeiter_cl(object):
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
pass
|
||||
self.db_o = QsMitarbeiterDatabase_cl()
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GET(self):
|
||||
def GET(self, id = None):
|
||||
#-------------------------------------------------------
|
||||
return json.dumps(retVal_o)
|
||||
retVal_o = {
|
||||
'data': None
|
||||
}
|
||||
if id == None:
|
||||
# Anforderung der Liste
|
||||
retVal_o['data'] = self.db_o.read_px()
|
||||
else:
|
||||
# Anforderung eines Dokuments
|
||||
data_o = self.db_o.read_px(id)
|
||||
if data_o != None:
|
||||
retVal_o['data'] = adjustId_p(id, data_o)
|
||||
|
||||
return retVal_o
|
||||
|
||||
#-------------------------------------------------------
|
||||
def PUT(self):
|
||||
def PUT(self, data_opl):
|
||||
#-------------------------------------------------------
|
||||
return json.dumps(retVal_o)
|
||||
# Sichern der Daten: jetzt wird keine vollständige Seite
|
||||
# zurückgeliefert, sondern nur noch die Information, ob das
|
||||
# Speichern erfolgreich war
|
||||
|
||||
retVal_o = {
|
||||
'id': None
|
||||
}
|
||||
|
||||
# data_opl: Dictionary mit den gelieferten key-value-Paaren
|
||||
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
|
||||
|
||||
id_s = data_opl["id_s"]
|
||||
data_o = {
|
||||
'name': data_opl["name_s"],
|
||||
'id': data_opl["id_s"]
|
||||
}
|
||||
# Update-Operation
|
||||
retVal_o['id'] = id_s
|
||||
if self.db_o.update_px(id_s, data_o):
|
||||
pass
|
||||
else:
|
||||
retVal_o['id'] = None
|
||||
|
||||
return retVal_o
|
||||
|
||||
#-------------------------------------------------------
|
||||
def POST(self):
|
||||
def POST(self, data_opl):
|
||||
#-------------------------------------------------------
|
||||
return json.dumps(retVal_o)
|
||||
retVal_o = {
|
||||
'id': None
|
||||
}
|
||||
|
||||
# data_opl: Dictionary mit den gelieferten key-value-Paaren
|
||||
|
||||
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
|
||||
|
||||
data_o = {
|
||||
'name': data_opl["name_s"]
|
||||
}
|
||||
# Create-Operation
|
||||
id_s = self.db_o.create_px(data_o)
|
||||
retVal_o['id'] = id_s
|
||||
|
||||
return retVal_o
|
||||
|
||||
#-------------------------------------------------------
|
||||
def DELETE(self):
|
||||
def DELETE(self, id):
|
||||
#-------------------------------------------------------
|
||||
return json.dumps(retVal_o)
|
||||
# Eintrag löschen, nur noch Rückmeldung liefern
|
||||
retVal_o = {
|
||||
'id': id
|
||||
}
|
||||
|
||||
if self.db_o.delete_px(id):
|
||||
pass
|
||||
else:
|
||||
retVal_o['id'] = None
|
||||
|
||||
return retVal_o
|
||||
|
||||
|
||||
|
||||
@ -75,26 +148,86 @@ class SwEntwickler_cl(object):
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
pass
|
||||
self.db_o = SwEntwicklerDatabase_cl()
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GET(self):
|
||||
def GET(self, id = None):
|
||||
#-------------------------------------------------------
|
||||
return json.dumps(retVal_o)
|
||||
retVal_o = {
|
||||
'data': None
|
||||
}
|
||||
if id == None:
|
||||
# Anforderung der Liste
|
||||
retVal_o['data'] = self.db_o.read_px()
|
||||
else:
|
||||
# Anforderung eines Dokuments
|
||||
data_o = self.db_o.read_px(id)
|
||||
if data_o != None:
|
||||
retVal_o['data'] = adjustId_p(id, data_o)
|
||||
|
||||
return retVal_o
|
||||
|
||||
#-------------------------------------------------------
|
||||
def PUT(self):
|
||||
def PUT(self, data_opl):
|
||||
#-------------------------------------------------------
|
||||
return json.dumps(retVal_o)
|
||||
# Sichern der Daten: jetzt wird keine vollständige Seite
|
||||
# zurückgeliefert, sondern nur noch die Information, ob das
|
||||
# Speichern erfolgreich war
|
||||
|
||||
retVal_o = {
|
||||
'id': None
|
||||
}
|
||||
|
||||
# data_opl: Dictionary mit den gelieferten key-value-Paaren
|
||||
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
|
||||
|
||||
id_s = data_opl["id_s"]
|
||||
data_o = {
|
||||
'name': data_opl["name_s"],
|
||||
'id': data_opl["id_s"]
|
||||
}
|
||||
# Update-Operation
|
||||
retVal_o['id'] = id_s
|
||||
if self.db_o.update_px(id_s, data_o):
|
||||
pass
|
||||
else:
|
||||
retVal_o['id'] = None
|
||||
|
||||
return retVal_o
|
||||
|
||||
#-------------------------------------------------------
|
||||
def POST(self):
|
||||
def POST(self, data_opl):
|
||||
#-------------------------------------------------------
|
||||
return json.dumps(retVal_o)
|
||||
retVal_o = {
|
||||
'id': None
|
||||
}
|
||||
|
||||
# data_opl: Dictionary mit den gelieferten key-value-Paaren
|
||||
|
||||
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
|
||||
|
||||
data_o = {
|
||||
'name': data_opl["name_s"]
|
||||
}
|
||||
# Create-Operation
|
||||
id_s = self.db_o.create_px(data_o)
|
||||
retVal_o['id'] = id_s
|
||||
|
||||
return retVal_o
|
||||
|
||||
#-------------------------------------------------------
|
||||
def DELETE(self):
|
||||
def DELETE(self, id):
|
||||
#-------------------------------------------------------
|
||||
return json.dumps(retVal_o)
|
||||
# Eintrag löschen, nur noch Rückmeldung liefern
|
||||
retVal_o = {
|
||||
'id': id
|
||||
}
|
||||
|
||||
if self.db_o.delete_px(id):
|
||||
pass
|
||||
else:
|
||||
retVal_o['id'] = None
|
||||
|
||||
return retVal_o
|
||||
|
||||
# EOF
|
Reference in New Issue
Block a user