Expand portal onboarding and administration
This commit is contained in:
parent
3d334479e9
commit
8229c6dd33
17 changed files with 1601 additions and 32 deletions
|
|
@ -198,6 +198,12 @@ class PostgresUserEngineStore:
|
|||
self._query_records("family_invitations", user_id=user_id),
|
||||
)
|
||||
|
||||
def family_invitations_for_tenant(self, tenant: str) -> tuple[FamilyInvitation, ...]:
|
||||
return cast(
|
||||
tuple[FamilyInvitation, ...],
|
||||
self._query_records("family_invitations", tenant=tenant),
|
||||
)
|
||||
|
||||
def save_registration_session(self, session: RegistrationSession) -> None:
|
||||
self._upsert_record(session)
|
||||
|
||||
|
|
@ -413,7 +419,7 @@ class PostgresUserEngineStore:
|
|||
"""
|
||||
SELECT payload
|
||||
FROM user_engine_outbox_events
|
||||
WHERE claimed_at IS NULL AND delivered_at IS NULL
|
||||
WHERE claimed_at IS NULL AND delivered_at IS NULL AND failed_at IS NULL
|
||||
ORDER BY occurred_at, event_id
|
||||
"""
|
||||
)
|
||||
|
|
@ -422,6 +428,31 @@ class PostgresUserEngineStore:
|
|||
for row in cursor.fetchall()
|
||||
)
|
||||
|
||||
def save_outbox(self, event: OutboxEvent) -> None:
|
||||
store_record = store_record_for(event)
|
||||
with self._cursor() as cursor:
|
||||
cursor.execute(
|
||||
"""
|
||||
UPDATE user_engine_outbox_events
|
||||
SET payload = %s::jsonb, claimed_at = %s, claimed_by = %s,
|
||||
delivered_at = %s, failed_at = %s, failure_reason = %s
|
||||
WHERE event_id = %s
|
||||
""",
|
||||
(json.dumps(store_record.payload), event.claimed_at, event.claimed_by,
|
||||
event.delivered_at, event.failed_at, event.failure_reason, event.event_id),
|
||||
)
|
||||
|
||||
def outbox_event(self, event_id: str) -> OutboxEvent | None:
|
||||
with self._cursor() as cursor:
|
||||
cursor.execute(
|
||||
"SELECT payload FROM user_engine_outbox_events WHERE event_id = %s",
|
||||
(event_id,),
|
||||
)
|
||||
row = cursor.fetchone()
|
||||
return None if row is None else cast(
|
||||
OutboxEvent, self._decode_payload_row("outbox_events", row)
|
||||
)
|
||||
|
||||
def record_counts(self) -> Mapping[str, int]:
|
||||
counts = {key: 0 for key in USER_ENGINE_RECORD_COUNT_KEYS}
|
||||
with self._cursor() as cursor:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue