def create_Color(): entity = Color( id = request.json['id'] , name = request.json['name'] , created_at = datetime.datetime.strptime(request.json['created_at'], "%Y-%m-%d").date() , updated_at = datetime.datetime.strptime(request.json['updated_at'], "%Y-%m-%d").date() ) db.session.add(entity) db.session.commit() return jsonify(entity.to_dict()), 201
def update_Color(id): entity = Color.query.get(id) if not entity: abort(404) entity = Color( id = request.json['id'], name = request.json['name'], created_at = datetime.datetime.strptime(request.json['created_at'], "%Y-%m-%d").date(), updated_at = datetime.datetime.strptime(request.json['updated_at'], "%Y-%m-%d").date() ) db.session.merge(entity) db.session.commit() return jsonify(entity.to_dict()), 200
def create_Color(): entity = Color(id=request.json['id'], name=request.json['name']) db.session.add(entity) db.session.commit() return jsonify(entity.to_dict()), 201