Added the photo_service.py and modified photo.py to have all the crud operations

This commit is contained in:
Gustavo Henrique Santos Souza de Miranda
2025-06-05 17:35:12 -03:00
parent 8ad57b548f
commit 7e29a590a2
3 changed files with 125 additions and 13 deletions
+11 -1
View File
@@ -1,3 +1,5 @@
from typing import Any
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import relationship
@@ -12,8 +14,16 @@ class Photo(Base):
name = Column(String)
addition_date = Column(String)
caption = Column(String)
entries = relationship(
entries:relationship = relationship(
"Entry",
secondary=photo_entry_association,
back_populates="photos"
)
def __init__(self, filepath, name, addition_date=None, caption=None, entries=None, **kw: Any):
super().__init__(**kw)
self.filepath = filepath
self.name = name
self.addition_date = addition_date
self.caption = caption
self.entries = entries