Fixed stuff
This commit is contained in:
@ -104,29 +104,29 @@ class ModelView(FlaskView):
|
||||
else:
|
||||
m = AIModel.query.fiter_by(id=_id).first_or_404()
|
||||
|
||||
try:
|
||||
data = storage.connection.get_object(current_app.config['MINIO_BUCKET_NAME'], str(m.id))
|
||||
except NoSuchKey:
|
||||
abort(500, "The ID is stored in the database but not int the Object Store")
|
||||
|
||||
return Response(data.stream(), mimetype=data.headers['Content-type'])
|
||||
return "asd"
|
||||
|
||||
@route('<_id>/details')
|
||||
def get_details(self, _id: str):
|
||||
|
||||
if _id == "$default":
|
||||
default = Default.query.first_or_404() # TODO: Kitalálni, hogy inkább a latestestest-el térjen-e vissza
|
||||
m = default.default
|
||||
m = default.aimodel
|
||||
else:
|
||||
m = AIModel.query.fiter_by(id=_id).first_or_404()
|
||||
m = AIModel.query.filter_by(id=_id).first_or_404()
|
||||
|
||||
return jsonify(self.aimodel_schema.dump(m))
|
||||
|
||||
def delete(self, _id: str):
|
||||
|
||||
m = AIModel.query.fiter_by(id=_id).first_or_404()
|
||||
if _id == '$default':
|
||||
default = Default.query.first_or_404()
|
||||
m = default.aimodel
|
||||
else:
|
||||
m = AIModel.query.fiter_by(id=_id).first_or_404()
|
||||
|
||||
storage.connection.remove_object(current_app.config['MINIO_BUCKET_NAME'], m.id)
|
||||
storage.connection.remove_object(current_app.config['MINIO_MODEL_BUCKET_NAME'], str(m.id))
|
||||
storage.connection.remove_object(current_app.config['MINIO_MEANS_BUCKET_NAME'], str(m.id))
|
||||
|
||||
db.session.delete(m)
|
||||
db.session.commit()
|
||||
@ -138,14 +138,14 @@ class ModelView(FlaskView):
|
||||
def put_default(self):
|
||||
|
||||
try:
|
||||
req = self.default_schema.load(request.json())
|
||||
req = self.default_schema.load(request.json)
|
||||
except ValidationError as e:
|
||||
abort(404, str(e))
|
||||
|
||||
m = AIModel.query.fiter_by(id=req['id']).first_or_404()
|
||||
m = AIModel.query.filter_by(id=req['id']).first_or_404()
|
||||
|
||||
Default.query.delete()
|
||||
new_default = Default(m)
|
||||
new_default = Default(aimodel=m)
|
||||
db.session.add(new_default)
|
||||
db.session.commit()
|
||||
|
||||
|
Reference in New Issue
Block a user