feat: implement governed reporting vertical
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping, Sequence
|
||||
|
||||
from govoplan_reporting.backend.definitions import (
|
||||
create_definition,
|
||||
get_definition,
|
||||
list_definitions,
|
||||
update_definition,
|
||||
)
|
||||
|
||||
|
||||
class SqlReportingRegistry:
|
||||
def get_definition(
|
||||
self,
|
||||
session: object,
|
||||
principal: object,
|
||||
*,
|
||||
definition_kind: str,
|
||||
definition_id: str,
|
||||
revision: int | None = None,
|
||||
):
|
||||
return get_definition(
|
||||
session, # type: ignore[arg-type]
|
||||
principal,
|
||||
definition_kind=definition_kind,
|
||||
definition_id=definition_id,
|
||||
revision=revision,
|
||||
)
|
||||
|
||||
def list_definitions(
|
||||
self,
|
||||
session: object,
|
||||
principal: object,
|
||||
*,
|
||||
definition_kinds: Sequence[str] | None = None,
|
||||
limit: int = 100,
|
||||
):
|
||||
records, _total = list_definitions(
|
||||
session, # type: ignore[arg-type]
|
||||
principal,
|
||||
definition_kinds=definition_kinds,
|
||||
limit=limit,
|
||||
)
|
||||
return records
|
||||
|
||||
def create_definition(
|
||||
self,
|
||||
session: object,
|
||||
principal: object,
|
||||
**values,
|
||||
):
|
||||
return create_definition(session, principal, **values) # type: ignore[arg-type]
|
||||
|
||||
def update_definition(
|
||||
self,
|
||||
session: object,
|
||||
principal: object,
|
||||
*,
|
||||
definition_kind: str,
|
||||
definition_id: str,
|
||||
expected_revision: int,
|
||||
recorded_at,
|
||||
change_reason: str,
|
||||
idempotency_key: str,
|
||||
changes: Mapping[str, object],
|
||||
):
|
||||
return update_definition(
|
||||
session, # type: ignore[arg-type]
|
||||
principal,
|
||||
definition_kind=definition_kind,
|
||||
definition_id=definition_id,
|
||||
expected_revision=expected_revision,
|
||||
recorded_at=recorded_at,
|
||||
change_reason=change_reason,
|
||||
idempotency_key=idempotency_key,
|
||||
changes=changes,
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["SqlReportingRegistry"]
|
||||
Reference in New Issue
Block a user