mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 06:46:00 +00:00
add endpoints for identifiers
This commit is contained in:
@@ -169,20 +169,17 @@ class DBCollectionsHandler(DBBaseHandler):
|
||||
self,
|
||||
type: str,
|
||||
limit: int | None = None,
|
||||
only_fields: Sequence[QueryableAttribute] | None = None,
|
||||
session: Session = None, # type: ignore
|
||||
) -> Sequence[VirtualCollection]:
|
||||
return (
|
||||
session.scalars(
|
||||
select(VirtualCollection)
|
||||
.filter(or_(VirtualCollection.type == type, literal(type == "all")))
|
||||
.limit(limit)
|
||||
.order_by(VirtualCollection.name.asc())
|
||||
)
|
||||
.unique()
|
||||
.all()
|
||||
query = (
|
||||
select(VirtualCollection)
|
||||
.filter(or_(VirtualCollection.type == type, literal(type == "all")))
|
||||
.limit(limit)
|
||||
.order_by(VirtualCollection.name.asc())
|
||||
)
|
||||
|
||||
return session.scalars(query).unique().all()
|
||||
|
||||
# Smart collections
|
||||
@begin_session
|
||||
def add_smart_collection(
|
||||
@@ -233,6 +230,9 @@ class DBCollectionsHandler(DBBaseHandler):
|
||||
if updated_after:
|
||||
query = query.filter(SmartCollection.updated_at > updated_after)
|
||||
|
||||
if only_fields:
|
||||
query = query.options(load_only(*only_fields))
|
||||
|
||||
return session.scalars(query).unique().all()
|
||||
|
||||
@begin_session
|
||||
|
||||
@@ -1061,7 +1061,7 @@ class DBRomsHandler(DBBaseHandler):
|
||||
rom_id: int,
|
||||
user_id: int,
|
||||
public_only: bool = False,
|
||||
search: str = "",
|
||||
search: str | None = "",
|
||||
tags: list[str] | None = None,
|
||||
only_fields: Sequence[QueryableAttribute] | None = None,
|
||||
session: Session = None, # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user