2025-02-03 23:45:35 +01:00
|
|
|
from flask import Blueprint, render_template
|
|
|
|
|
|
|
|
from .exceptions import exception_handler
|
2025-02-04 10:08:25 +01:00
|
|
|
from ..set_list import BrickSetList, set_metadata_lists
|
2025-02-03 23:45:35 +01:00
|
|
|
from ..set_storage import BrickSetStorage
|
|
|
|
from ..set_storage_list import BrickSetStorageList
|
|
|
|
|
|
|
|
storage_page = Blueprint('storage', __name__, url_prefix='/storages')
|
|
|
|
|
|
|
|
|
|
|
|
# Index
|
|
|
|
@storage_page.route('/', methods=['GET'])
|
|
|
|
@exception_handler(__file__)
|
|
|
|
def list() -> str:
|
|
|
|
return render_template(
|
|
|
|
'storages.html',
|
|
|
|
table_collection=BrickSetStorageList.all(),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Storage details
|
|
|
|
@storage_page.route('/<id>/details')
|
|
|
|
@exception_handler(__file__)
|
|
|
|
def details(*, id: str) -> str:
|
|
|
|
storage = BrickSetStorage().select_specific(id)
|
|
|
|
|
|
|
|
return render_template(
|
|
|
|
'storage.html',
|
|
|
|
item=storage,
|
|
|
|
sets=BrickSetList().using_storage(storage),
|
2025-02-04 10:08:25 +01:00
|
|
|
**set_metadata_lists(as_class=True)
|
2025-02-03 23:45:35 +01:00
|
|
|
)
|