quivr/backend/core/utils/users.py

19 lines
467 B
Python
Raw Normal View History

from logger import get_logger
2023-06-19 23:46:25 +03:00
from models.settings import CommonsDep
from models.users import User
logger = get_logger(__name__)
def create_user(commons: CommonsDep, user: User, date):
logger.info(f"New user entry in db document for user {user.email}")
return (
commons["supabase"]
.table("users")
.insert(
{"user_id": user.id, "email": user.email, "date": date, "requests_count": 1}
)
.execute()
)