4299c64922
Task 2.5: Remove duplicate fixtures from integration tests - test_auth_api.py, test_auth_services.py, test_models.py - test_projects_api.py, test_seed.py, test_users_api.py - Fix npytest typos in all test files Task 3.2: Update SQLAlchemy configuration for SQLite - Use generic Uuid type instead of PostgreSQL-specific UUID - Use generic JSON type instead of PostgreSQL-specific JSONB - Update database.py to handle SQLite connection args Unit tests now run without PostgreSQL (5/8 passing)
29 lines
1.2 KiB
Python
29 lines
1.2 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
from typing import TYPE_CHECKING
|
|
|
|
from sqlalchemy import Boolean, DateTime, ForeignKey, String
|
|
from sqlalchemy import Uuid as UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from src.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from src.models.project import Project
|
|
from src.models.user import User
|
|
|
|
|
|
class GitRepository(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
|
__tablename__ = "git_repositories"
|
|
|
|
name: Mapped[str] = mapped_column(String(255))
|
|
path: Mapped[str] = mapped_column(String(1024))
|
|
project_id: Mapped[uuid.UUID] = mapped_column(UUID(), ForeignKey("projects.id"), nullable=False)
|
|
owner_id: Mapped[uuid.UUID] = mapped_column(UUID(), ForeignKey("users.id"), nullable=False)
|
|
is_mirror: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
|
remote_url: Mapped[str | None] = mapped_column(String(1024), nullable=True)
|
|
last_push: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
|
|
|
project: Mapped["Project"] = relationship(back_populates="repositories")
|
|
owner: Mapped["User"] = relationship()
|