MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / update_preferences

Method update_preferences

app/services/account_state.py:262–289  ·  view source on GitHub ↗
(self, account_id: str, request: AccountPreferencesRequest)

Source from the content-addressed store, hash-verified

260 records[index] = task.model_dump()
261 return records
262 records.append(task.model_dump())
263 return records
264
265 self.tasks_store.update(updater)
266 return task
267
268 def clear_payment_cache(self) -> None:
269 """Discard QR/payment task cache that should not survive service restarts."""
270 self.tasks_store.write([])
271 for account in self.list_accounts():
272 session = self.load_session(account.id)
273 session.last_sign = ""
274 session.last_order_id = ""
275 session.preview = None
276 self.save_session(session)
277 logger.info("payment cache cleared on startup")
278
279 def delete_account(self, account_id: str) -> None:
280 account = self.get_account(account_id)
281
282 def update_accounts(records: list[dict[str, Any]]) -> list[dict[str, Any]]:
283 return [item for item in records if item.get("id") != account_id]
284
285 def update_tasks(records: list[dict[str, Any]]) -> list[dict[str, Any]]:
286 return [item for item in records if item.get("account_id") != account_id]
287
288 self.accounts_store.update(update_accounts)
289 self.tasks_store.update(update_tasks)
290 session_path = self._session_path(account_id)
291 if session_path.exists():
292 session_path.unlink()

Callers

nothing calls this directly

Calls 9

get_accountMethod · 0.95
load_sessionMethod · 0.95
_scheduled_run_keyMethod · 0.95
update_accountMethod · 0.95
save_sessionMethod · 0.95
get_account_detailMethod · 0.95

Tested by

no test coverage detected