Set theme override

This commit is contained in:
2025-01-29 19:28:00 +01:00
parent 257bccc339
commit b2d2019bfd
8 changed files with 111 additions and 12 deletions
+19
View File
@@ -167,3 +167,22 @@ def refresh(*, id: str) -> str:
namespace=current_app.config['SOCKET_NAMESPACE'],
messages=MESSAGES
)
# Change the theme override
@set_page.route('/<id>/theme', methods=['POST'])
@login_required
@exception_handler(__file__, json=True)
def update_theme(*, id: str) -> Response:
brickset = BrickSet().select_light(id)
brickset.update_theme(request.json)
# Info
logger.info('Set {set} ({id}): theme override changed to "{theme}"'.format( # noqa: E501
set=brickset.fields.set,
id=brickset.fields.id,
theme=brickset.fields.theme,
))
return jsonify({'value': brickset.fields.theme})