app.repository.oauth_users_repository module

class app.repository.oauth_users_repository.OAuthUsersRepository(session_factory, model=<class 'app.model.oauth_users.OAuthUsers'>)[source]

Bases: BaseRepository

Repository class for OAuth users.

Parameters:

session_factory (Callable[[...], AbstractAsyncContextManager[AsyncSession]])

session_factory

Factory for creating SQLAlchemy sessions.

Type:

Callable[…, AbstractAsyncContextManager[AsyncSession]]

model

SQLAlchemy model class for OAuth users.

__init__(session_factory, model=<class 'app.model.oauth_users.OAuthUsers'>)[source]
Initializes the OAuthUsersRepository with the provided session

factory and model.

Parameters:
  • session_factory (Callable[..., AbstractAsyncContextManager[AsyncSession]]) – The session factory.

  • model – The SQLAlchemy model class for OAuth users.

Return type:

None

async get_user_by_sub(sub)[source]

Get a user by their sub.

Parameters:

sub (str) – The sub of the user to get (provider_user_id)

Returns:

The user with the provided sub.