Files
Messenger/app/utils/id_generator.py
benya 0b4bb19425
Some checks failed
CI / test (push) Failing after 20s
feat(chat): add random public_id and fix users blocked route
- add chats.public_id random identifier with migration 0011
- expose public_id in chat API payloads
- use chat public_id in message search UI label
- fix users router order so /users/blocked no longer conflicts with /users/{user_id}
2026-03-08 02:34:24 +03:00

10 lines
200 B
Python

import secrets
import string
_ALPHABET = string.ascii_letters + string.digits
def generate_public_id(length: int = 12) -> str:
return "".join(secrets.choice(_ALPHABET) for _ in range(length))