Skip to main content

create_user

Creates a new user record in the database by hashing the provided password and committing the user object to the session.

def create_user(
session: Session,
user_create: UserCreate
) - > User

Creates a new user record in the database by hashing the provided password and persisting the user model.

Parameters

NameTypeDescription
sessionSessionThe active SQLAlchemy database session used to perform the transaction.
user_createUserCreateA Pydantic model containing the initial user details and plain-text password to be hashed.

Returns

TypeDescription
UserThe newly created User database object, including the generated ID and refreshed state.