feat: initialize aivideo project
This commit is contained in:
17
backend/app/common/utils/id_gen.py
Normal file
17
backend/app/common/utils/id_gen.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from datetime import datetime
|
||||
from random import choices
|
||||
from string import ascii_uppercase, digits
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
def new_public_id(prefix: str) -> str:
|
||||
return f"{prefix}_{uuid4().hex[:16]}"
|
||||
|
||||
|
||||
def new_order_no(prefix: str) -> str:
|
||||
return f"{prefix}_{datetime.now():%Y%m%d%H%M%S}{uuid4().hex[:6]}"
|
||||
|
||||
|
||||
def new_invite_code(length: int = 6) -> str:
|
||||
return "".join(choices(ascii_uppercase + digits, k=length))
|
||||
|
||||
Reference in New Issue
Block a user