feat(01-01): add matrix pending confirm store helpers
- add pending confirm prefix and storage helpers - preserve existing matrix store behavior and tests
This commit is contained in:
parent
608297b751
commit
9123401556
1 changed files with 13 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ ROOM_META_PREFIX = "matrix_room:"
|
|||
USER_META_PREFIX = "matrix_user:"
|
||||
ROOM_STATE_PREFIX = "matrix_state:"
|
||||
SKILLS_MSG_PREFIX = "matrix_skills_msg:"
|
||||
PENDING_CONFIRM_PREFIX = "matrix_pending_confirm:"
|
||||
|
||||
|
||||
async def get_room_meta(store: StateStore, room_id: str) -> dict | None:
|
||||
|
|
@ -48,3 +49,15 @@ async def next_chat_id(store: StateStore, matrix_user_id: str) -> str:
|
|||
meta["next_chat_index"] = index + 1
|
||||
await set_user_meta(store, matrix_user_id, meta)
|
||||
return f"C{index}"
|
||||
|
||||
|
||||
async def get_pending_confirm(store: StateStore, room_id: str) -> dict | None:
|
||||
return await store.get(f"{PENDING_CONFIRM_PREFIX}{room_id}")
|
||||
|
||||
|
||||
async def set_pending_confirm(store: StateStore, room_id: str, meta: dict) -> None:
|
||||
await store.set(f"{PENDING_CONFIRM_PREFIX}{room_id}", meta)
|
||||
|
||||
|
||||
async def clear_pending_confirm(store: StateStore, room_id: str) -> None:
|
||||
await store.delete(f"{PENDING_CONFIRM_PREFIX}{room_id}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue