25 lines
693 B
Python
25 lines
693 B
Python
from flask import Blueprint, request, jsonify
|
|
from datetime import datetime
|
|
import geruecht.controller.userController as uc
|
|
from geruecht.decorator import login_required
|
|
from geruecht.model import MONEY, GASTRO
|
|
|
|
vorstand = Blueprint("vorstand", __name__)
|
|
userController = uc.UserController()
|
|
|
|
|
|
@vorstand.route("/sm/addUser", methods=['POST', 'GET'])
|
|
|
|
@login_required(groups=[MONEY, GASTRO])
|
|
def _addUser():
|
|
|
|
if request.method == 'GET':
|
|
return "<h1>HEllo World</h1>"
|
|
|
|
data = request.get_json()
|
|
user = data['user']
|
|
date = datetime.utcfromtimestamp(int(data['date']))
|
|
userController.addWorker(user['username'], date)
|
|
|
|
print(data)
|
|
return jsonify({"date": date}) |