diensteinladung und übertragung fertig. User können leute einladen, sich austragen, jobs abgeben usw.

user können sehen, wenn es neue nachrichten gibt und sehen ob die einladung bzw. anfrage gesehen wurde.
This commit is contained in:
Tim Gröger 2020-06-04 13:19:00 +02:00
parent b0f09969a5
commit fd2c9a2a7e
3 changed files with 5 additions and 4 deletions

View File

@ -68,7 +68,7 @@ class Base:
def updateJobRequest(self, jobrequest):
try:
cursor = self.db.connection.cursor()
cursor.execute("update job_request set watched={}, answered={} where id={}".format(jobrequest['watched'], jobrequest['answered'], jobrequest['id']))
cursor.execute("update job_request set watched={}, answered={}, accepted={} where id={}".format(jobrequest['watched'], jobrequest['answered'], jobrequest['accepted'], jobrequest['id']))
self.db.connection.commit()
return self.getJobRequest(None, None, None, jobrequest['id'])
except Exception as err:
@ -79,7 +79,7 @@ class Base:
def updateAllJobRequest(self, jobrequest):
try:
cursor = self.db.connection.cursor()
cursor.execute("update job_request set answered={}, accepted={} where from_user={} and on_date='{}'".format(jobrequest['answered'], jobrequest['accepted'], jobrequest['from_user']['id'], jobrequest['on_date']))
cursor.execute("update job_request set answered={} where from_user={} and on_date='{}'".format(jobrequest['answered'], jobrequest['from_user']['id'], jobrequest['on_date']))
self.db.connection.commit()
except Exception as err:
traceback.print_exc()

View File

@ -24,8 +24,9 @@ class Base:
from_user = jobRequest['from_user']
to_user = jobRequest['to_user']
on_date = date(jobRequest['date']['year'], jobRequest['date']['month'], jobRequest['date']['day'])
job_kind = jobRequest['job_kind']
debug.info("set new JobRequest from_user {{ {} }}, to_user {{ {} }}, on_date {{ {} }}")
retVal.append(db.setJobRequest(from_user, to_user, on_date))
retVal.append(db.setJobRequest(from_user, to_user, on_date, job_kind))
debug.debug("seted JobRequests are {{ {} }}".format(retVal))
return retVal

View File

@ -360,12 +360,12 @@ def _JobRequests(**kwargs):
try:
debug.info("/user/JobRequests")
data = request.get_json()
data['on_date'] = date(data['on_date']['year'], data['on_date']['month'], data['on_date']['day'])
if request.method == 'PUT':
mainController.setJobRequests(data)
retVal = mainController.getJobRequests(kwargs['accToken'].user.toJSON(), None, datetime.now().date())
debug.debug("return {{ {} }}".format(retVal))
if request.method == 'POST':
data['on_date'] = date(data['on_date']['year'], data['on_date']['month'], data['on_date']['day'])
retVal = mainController.updateJobRequests(data)
return jsonify(retVal)