Rename routes
This commit is contained in:
parent
5f847168f4
commit
9c925b56da
@ -19,12 +19,12 @@ def list() -> str:
|
|||||||
|
|
||||||
|
|
||||||
# Minifigure details
|
# Minifigure details
|
||||||
@minifigure_page.route('/<number>/details')
|
@minifigure_page.route('/<figure>/details')
|
||||||
@exception_handler(__file__)
|
@exception_handler(__file__)
|
||||||
def details(*, number: str) -> str:
|
def details(*, figure: str) -> str:
|
||||||
return render_template(
|
return render_template(
|
||||||
'minifigure.html',
|
'minifigure.html',
|
||||||
item=BrickMinifigure().select_generic(number),
|
item=BrickMinifigure().select_generic(figure),
|
||||||
using=BrickSetList().using_minifigure(number),
|
using=BrickSetList().using_minifigure(figure),
|
||||||
missing=BrickSetList().missing_minifigure(number),
|
missing=BrickSetList().missing_minifigure(figure),
|
||||||
)
|
)
|
||||||
|
@ -108,33 +108,28 @@ def details(*, id: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
# Update the missing pieces of a minifig part
|
# Update the missing pieces of a minifig part
|
||||||
@set_page.route('/<id>/minifigures/<minifigure_id>/parts/<part_id>/missing', methods=['POST']) # noqa: E501
|
@set_page.route('/<id>/minifigures/<figure>/parts/<part>/missing', methods=['POST']) # noqa: E501
|
||||||
@login_required
|
@login_required
|
||||||
@exception_handler(__file__, json=True)
|
@exception_handler(__file__, json=True)
|
||||||
def missing_minifigure_part(
|
def missing_minifigure_part(*, id: str, figure: str, part: str) -> Response:
|
||||||
*,
|
|
||||||
id: str,
|
|
||||||
minifigure_id: str,
|
|
||||||
part_id: str
|
|
||||||
) -> Response:
|
|
||||||
brickset = BrickSet().select_specific(id)
|
brickset = BrickSet().select_specific(id)
|
||||||
minifigure = BrickMinifigure().select_specific(brickset, minifigure_id)
|
brickminifigure = BrickMinifigure().select_specific(brickset, figure)
|
||||||
part = BrickPart().select_specific(
|
brickpart = BrickPart().select_specific(
|
||||||
brickset,
|
brickset,
|
||||||
part_id,
|
part,
|
||||||
minifigure=minifigure,
|
minifigure=brickminifigure,
|
||||||
)
|
)
|
||||||
|
|
||||||
missing = request.json.get('missing', '') # type: ignore
|
missing = request.json.get('missing', '') # type: ignore
|
||||||
|
|
||||||
part.update_missing(missing)
|
brickpart.update_missing(missing)
|
||||||
|
|
||||||
# Info
|
# Info
|
||||||
logger.info('Set {number} ({id}): updated minifigure ({minifigure}) part ({part}) missing count to {missing}'.format( # noqa: E501
|
logger.info('Set {number} ({id}): updated minifigure ({figure}) part ({part}) missing count to {missing}'.format( # noqa: E501
|
||||||
number=brickset.fields.set,
|
number=brickset.fields.set,
|
||||||
id=brickset.fields.id,
|
id=brickset.fields.id,
|
||||||
minifigure=minifigure.fields.fig_num,
|
figure=brickminifigure.fields.fig_num,
|
||||||
part=part.fields.id,
|
part=brickpart.fields.id,
|
||||||
missing=missing,
|
missing=missing,
|
||||||
))
|
))
|
||||||
|
|
||||||
@ -142,22 +137,22 @@ def missing_minifigure_part(
|
|||||||
|
|
||||||
|
|
||||||
# Update the missing pieces of a part
|
# Update the missing pieces of a part
|
||||||
@set_page.route('/<id>/parts/<part_id>/missing', methods=['POST'])
|
@set_page.route('/<id>/parts/<part>/missing', methods=['POST'])
|
||||||
@login_required
|
@login_required
|
||||||
@exception_handler(__file__, json=True)
|
@exception_handler(__file__, json=True)
|
||||||
def missing_part(*, id: str, part_id: str) -> Response:
|
def missing_part(*, id: str, part: str) -> Response:
|
||||||
brickset = BrickSet().select_specific(id)
|
brickset = BrickSet().select_specific(id)
|
||||||
part = BrickPart().select_specific(brickset, part_id)
|
brickpart = BrickPart().select_specific(brickset, part)
|
||||||
|
|
||||||
missing = request.json.get('missing', '') # type: ignore
|
missing = request.json.get('missing', '') # type: ignore
|
||||||
|
|
||||||
part.update_missing(missing)
|
brickpart.update_missing(missing)
|
||||||
|
|
||||||
# Info
|
# Info
|
||||||
logger.info('Set {number} ({id}): updated part ({part}) missing count to {missing}'.format( # noqa: E501
|
logger.info('Set {number} ({id}): updated part ({part}) missing count to {missing}'.format( # noqa: E501
|
||||||
number=brickset.fields.set,
|
number=brickset.fields.set,
|
||||||
id=brickset.fields.id,
|
id=brickset.fields.id,
|
||||||
part=part.fields.id,
|
part=brickpart.fields.id,
|
||||||
missing=missing,
|
missing=missing,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user