def create_client(session, orga, name="test"): client = Clients() client.orga = orga client.email = name + "@test.com" client.name = name client.identifier = name + "id" session.add(client) session.commit() time.sleep(config.SPI_GENERATION_INTERVAL * 3) return client
def client_create(request, decoded): """ REST endpoint to create a client. :param request: The flask request. :param decoded: The decoded json value from the with_json decorator. :return: json of the newly created client. """ orga = int(request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk')) client = Clients() client.orga = orga client.email = decoded['email'] client.name = decoded['name'] client.identifier = decoded['identifier'] db.session.add(client) db.session.commit() return {'client': client.json}
def client_create(request, decoded): """ REST endpoint to create a client. :param request: The flask request. :param decoded: The decoded json value from the with_json decorator. :return: json of the newly created client. """ orga = int( request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk')) client = Clients() client.orga = orga client.email = decoded['email'] client.name = decoded['name'] client.identifier = decoded['identifier'] db.session.add(client) db.session.commit() return {'client': client.json}