Ejemplo n.º 1
0
	def put(self, jwt):
		body = request.get_json()

		title = body['title']
		description = body['description']
		start_time = body['start_time']
		capacity = body['capacity']

		try:
			slot = Slot()

			slot.title = title
			slot.description = description
			slot.start_time = start_time
			slot.capacity = capacity

			db.session.add(slot)
			db.session.commit()
		except:
			db.session.rollback()
			abort(422, "unprocessable")

		return jsonify( { "success": True, "id": slot.id } )