app.crud package

Submodules

app.crud.base module

class app.crud.base.ModelBase(model: type[ModelType])[source]

Bases: Generic[ModelType, CreateSchemaType, UpdateSchemaType]

create(db: Session, *, obj_in: CreateSchemaType) ModelType[source]
get(db: Session, id: Any) ModelType | None[source]
get_multi(db: Session, *, skip: int = 0, limit: int = 100) list[ModelType][source]
remove(db: Session, *, id: int) ModelType[source]
update(db: Session, *, db_obj: ModelType, obj_in: UpdateSchemaType | dict[str, Any]) ModelType[source]

app.crud.user module

class app.crud.user.UserModel(model: type[ModelType])[source]

Bases: ModelBase[User, UserCreate, UserUpdate]

Class that wraps the User model.

authenticate(db: Session, *, user_name: str, password: str) User | None[source]

Determine if a user exists by the user name and checking the password.

create(db: Session, *, obj_in: UserCreate) User[source]

Create a new user object.

get_by_username(db: Session, *, user_name: str) User | None[source]

Get a user by username from the database.

is_active(user: User) bool[source]

Courtesy function to see if user is active.

is_superuser(user: User) bool[source]

Courtesy function to check if a user is a superuser.

update(db: Session, *, db_obj: User, obj_in: UserUpdate | dict[str, Any]) User[source]

Update a user.

Module contents


Last update: Mar 10, 2024