Skip to content

Commit 21987b0

Browse files
committed
chore: update albums
1 parent cba57e2 commit 21987b0

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

src/app/music/albums/api/routes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import AsyncGenerator
44

55
from fastapi import APIRouter, Depends, HTTPException, status
6+
67
from src.app.music.albums.api.utils import CurrentUser, get_current_user
78
from src.app.music.albums.core.service import get_service
89
from src.domain.music.albums.api.routes import BaseRouter
@@ -18,7 +19,7 @@
1819
from src.infrastructure.api import ExceptionHandler
1920
from src.infrastructure.exceptions import Exc
2021
from src.infrastructure.loggers import app as logger
21-
from src.presentation.music.albums.schemas import (
22+
from src.presentation.schemas.music.albums import (
2223
SAlbumRequest,
2324
SAlbumResponse,
2425
SArtist,

src/app/music/albums/core/service.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async def get_popular_albums(self, user_id: int, start: int, size: int) -> Popul
103103
return get_items_response(
104104
total=total,
105105
start=start,
106-
size=size,
106+
size=len(items),
107107
response_dto=PopularAlbumsResponseDTO,
108108
items=list(map(lambda album: AlbumItemResponseDTO(
109109
id=album.id,

src/app/music/albums/interfaces/da/dao.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from dataclasses import dataclass
22
from datetime import date, datetime
3+
from types import TracebackType
34
from typing import Self, Literal
45

56
from sqlalchemy import select, func
7+
68
from src.app.auth.artists.models import ArtistProfile
7-
from src.app.auth.users.models import User
9+
from src.app.auth.users.interfaces.da.models import User
810
from src.app.music.albums.interfaces.da.models import Album
911
from src.app.music.tracks.models import Track
1012
from src.app.social.tags.models import Tag
@@ -118,7 +120,12 @@ async def delete_album(self, album_id: int) -> None:
118120
async def __aenter__(self) -> Self:
119121
return self
120122

121-
async def __aexit__(self, exc_type, exc_val, exc_tb) -> None: # type: ignore[no-untyped-def]
123+
async def __aexit__(
124+
self,
125+
exc_type: type[Exception],
126+
exc_val: Exception,
127+
exc_tb: TracebackType,
128+
) -> None:
122129
await self.commit()
123130
await self.close()
124131

src/domain/music/albums/core/service.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def get_popular_albums(self, user_id: int, start: int, size: int) -> BaseP
5454
5555
:param user_id: user's numeric identificator
5656
:param start: start point where objects start being taken from storage.
57-
Another words, this is just the beginning of the page
57+
Another words, this is just the beginning of the page
5858
:param size: object's length
5959
:return: DTO with albums' sequence
6060
:raise NotImplementedError: when called directly by abstract class instance
@@ -71,7 +71,7 @@ async def update_cover(self, album_id: int, user_id: int, data: bytes) -> None:
7171
:param data: file data in bytes format
7272
:raise NotImplementedError: when called directly by abstract class instance
7373
:raise NoArtistRightsError: when specified artist doesn't exist in storage
74-
or the user is not the owner of that artist's profile
74+
or the user is not the owner of that artist's profile
7575
"""
7676
raise NotImplementedError
7777

@@ -118,7 +118,7 @@ async def create_album(
118118
:raise NotImplementedError: when called directly by abstract class instance
119119
:raise NoArtistRightsError: when a user doesn't have an artist profile
120120
:raise AlbumAlreasyExistsError: when there's an existing album with same
121-
title on an artist's page
121+
title on an artist's page
122122
"""
123123
raise NotImplementedError
124124

0 commit comments

Comments
 (0)