added feeding data objects and workflow
Build and Push Docker Image / build-and-push (pull_request) Successful in 57s
Python Code Quality / python-code-quality (pull_request) Successful in 10s
Python Test / python-test (pull_request) Successful in 17s

This commit is contained in:
Brian Bjarke Jensen
2025-11-09 17:22:37 +01:00
parent 1f48083db8
commit 55de11dcdd
11 changed files with 1104 additions and 8 deletions
+28
View File
@@ -0,0 +1,28 @@
"""Feeding database model."""
from typing import TYPE_CHECKING
from sqlalchemy import Column, Integer, DateTime, ForeignKey, String
from datetime import datetime, UTC
if TYPE_CHECKING:
from sqlalchemy.orm import DeclarativeBase
Base = DeclarativeBase
else:
from baby_monitor.repositories.dependencies.get_database import Base
class Feeding(Base):
"""Feeding log database model."""
__tablename__ = "feedings"
id = Column(Integer, primary_key=True, index=True)
child_id = Column(Integer, ForeignKey("children.id"), nullable=False)
start_time = Column(DateTime, nullable=False)
end_time = Column(DateTime, nullable=True)
feeding_type = Column(String, nullable=False) # stores FeedingType enum
created_at = Column(DateTime, default=datetime.now(UTC), nullable=False)
def __repr__(self) -> str:
return f"<Feeding(id={self.id}, child_id={self.child_id})>"