[DEV] add back cover

This commit is contained in:
Edouard DUPIN 2020-01-21 22:15:24 +01:00
parent fcd15511d9
commit faf60efd4d
3 changed files with 11 additions and 7 deletions

View File

@ -35,12 +35,14 @@ def add(_app, _name_api):
class DataModelBdd:
id = int
name = str
description = [str, type(None)]
covers = [[], type(None)]
data_global_elements.get_interface(_name_api).set_data_model(DataModelBdd)
class DataModel:
name = str
description = str
@elem_blueprint.get('/' + _name_api, strict_slashes=True)
@doc.summary("Show resources")
@ -135,8 +137,8 @@ def add(_app, _name_api):
raise ServerError("No data found", status_code=404)
@elem_blueprint.post('/' + _name_api + "/<id:int>/add_cover", strict_slashes=True)
@doc.summary("Add cover on video")
@doc.description("Add a cover data ID to the video.")
@doc.summary("Add cover on group")
@doc.description("Add a cover data ID to the group.")
@doc.consumes(DataModel, location='body')#, required=True)
@doc.response_success(status=201, description='If successful added')
async def create(request, id):
@ -155,6 +157,6 @@ def add(_app, _name_api):
return response.json(elem)
value["covers"].append(request.json["data_id"]);
data_global_elements.get_interface(_name_api).set(id, value)
return response.json(elem)
return response.json(value)
_app.blueprint(elem_blueprint)

View File

@ -35,6 +35,7 @@ def add(_app, _name_api):
class DataModelBdd:
id = int
number = int
description = [str, type(None)]
group_id = int
covers = [[], type(None)]
@ -42,6 +43,7 @@ def add(_app, _name_api):
class DataModel:
number = int
description = str
group_id = int
@elem_blueprint.get('/' + _name_api, strict_slashes=True)
@ -131,6 +133,6 @@ def add(_app, _name_api):
return response.json(elem)
value["covers"].append(request.json["data_id"]);
data_global_elements.get_interface(_name_api).set(id, value)
return response.json(elem)
return response.json(value)
_app.blueprint(elem_blueprint)

View File

@ -127,8 +127,8 @@ def add(_app, _name_api):
return response.json(list_values)
@elem_blueprint.post('/' + _name_api + "/<id:int>/add_cover", strict_slashes=True)
@doc.summary("Add cover on video")
@doc.description("Add a cover data ID to the video.")
@doc.summary("Add cover on univers")
@doc.description("Add a cover data ID to the univers.")
@doc.consumes(DataModel, location='body')#, required=True)
@doc.response_success(status=201, description='If successful added')
async def create(request, id):
@ -147,6 +147,6 @@ def add(_app, _name_api):
return response.json(elem)
value["covers"].append(request.json["data_id"]);
data_global_elements.get_interface(_name_api).set(id, value)
return response.json(elem)
return response.json(value)
_app.blueprint(elem_blueprint)