feat: models

This commit is contained in:
Senko-san
2026-06-07 14:50:35 +03:00
parent 87b48e941e
commit dfd512a13f
11 changed files with 732 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
"""ORM model for albums."""
import uuid
from sqlalchemy import ForeignKey, Integer, String
from sqlalchemy.orm import Mapped, mapped_column
from app.infrastructure.db.base import Base
from app.infrastructure.db.models.mixins import TimestampMixin, UUIDPrimaryKeyMixin
class AlbumModel(UUIDPrimaryKeyMixin, TimestampMixin, Base):
__tablename__ = "albums"
title: Mapped[str] = mapped_column(String(1024), index=True, nullable=False)
artist_id: Mapped[uuid.UUID] = mapped_column(
ForeignKey("artists.id", ondelete="CASCADE"),
index=True,
nullable=False,
)
year: Mapped[int | None] = mapped_column(Integer, nullable=True)
cover_path: Mapped[str | None] = mapped_column(String(1024), nullable=True)
musicbrainz_id: Mapped[str | None] = mapped_column(String(36), index=True, nullable=True)