mirror of
https://github.com/gmbrax/Pilgrim.git
synced 2026-11-10 01:20:16 +00:00
Implemented directory management and improved TravelDiary and Photo handling logic.
- Added `DirectoryManager` utility for consistent directory operations. - Introduced directory name sanitization and uniqueness enforcement for `TravelDiary`. - Updated `TravelDiaryService` with enhanced creation, update, and deletion workflows, including filesystem management. - Improved `PhotoService` to hash files, copy photos to specific diary directories, and manage updates safely. - Refined error handling and cascaded changes across related entities (e.g., `Entry` relationships).
This commit is contained in:
parent
b1e83aabbb
commit
090bbeda1a
@@ -1,9 +1,9 @@
|
||||
from typing import Any
|
||||
|
||||
from pilgrim.models.photo_in_entry import photo_entry_association
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from pilgrim.models.photo_in_entry import photo_entry_association
|
||||
from ..database import Base
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@ class Entry(Base):
|
||||
"Photo",
|
||||
secondary=photo_entry_association,
|
||||
back_populates="entries")
|
||||
fk_travel_diary_id = Column(Integer, ForeignKey("travel_diaries.id"),nullable=False)
|
||||
fk_travel_diary_id = Column(Integer, ForeignKey("travel_diaries.id"), nullable=False)
|
||||
travel_diary = relationship("TravelDiary", back_populates="entries")
|
||||
|
||||
def __init__(self, title: str, text: str, date: str, travel_diary_id: int, **kw: Any):
|
||||
super().__init__(**kw)
|
||||
self.title = title
|
||||
|
||||
Reference in New Issue
Block a user