repository.images#
Module Contents#
Functions#
Check if the user has access rights to a specific picture based on user ID and role. |
|
Upload a new picture to the database. |
|
Delete a specific picture from the database. |
|
|
|
Retrieve information about a specific picture from the database. |
API#
- async repository.images.access_check(user: src.entity.models.User, picture_user_id, role)#
Check if the user has access rights to a specific picture based on user ID and role.
- async repository.images.upload_picture(file: fastapi.UploadFile, body: src.schemas.images.PictureSchema, db: sqlalchemy.ext.asyncio.AsyncSession, user: src.entity.models.User)#
Upload a new picture to the database.
- Parameters:
file (UploadFile) – The file to be uploaded.
body (PictureSchema) – The schema representing the picture data.
db (AsyncSession) – The asynchronous database session.
user (User) – The user uploading the picture.
- Returns:
Information about the uploaded picture.
- Return type:
Dict[str, Union[int, str, List[str], datetime, List[str]]]
- async repository.images.delete_picture(picture_id: int, db: sqlalchemy.ext.asyncio.AsyncSession, user: src.entity.models.User)#
Delete a specific picture from the database.
- Parameters:
picture_id (int) – The ID of the picture to delete.
db (AsyncSession) – The asynchronous database session.
user (User) – The user deleting the picture.
- Returns:
Success message.
- Return type:
str
- async repository.images.update_picture_description(picture_id: int, body: src.schemas.images.PictureUpdateSchema, db: sqlalchemy.ext.asyncio.AsyncSession, user: src.entity.models.User)#
Update the description of a specific picture in the database.
- Parameters:
picture_id (int) – The ID of the picture to update.
body (PictureUpdateSchema) – The schema representing the updated picture data.
db (AsyncSession) – The asynchronous database session.
user (User) – The user updating the picture.
- Returns:
Information about the updated picture.
- Return type:
Dict[str, Union[int, str, List[str], datetime, List[str]]]
- async repository.images.get_picture(picture_id: int, db: sqlalchemy.ext.asyncio.AsyncSession, user: src.entity.models.User)#
Retrieve information about a specific picture from the database.
- Parameters:
picture_id (int) – The ID of the picture to retrieve.
db (AsyncSession) – The asynchronous database session.
user (User) – The user requesting information about the picture.
- Returns:
Information about the picture.
- Return type:
Dict[str, Union[int, str, List[str], datetime, List[str]]]