1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-22 22:39:36 +02:00

feat: update Immich integration to use dynamic image URLs and enhance image retrieval logic

This commit is contained in:
Sean Morley 2025-06-02 21:25:07 -04:00
parent 937db00226
commit 45e195a84e
5 changed files with 112 additions and 78 deletions

View file

@ -808,16 +808,7 @@ class AdventureImage(models.Model):
raise ValidationError("Cannot have both image file and Immich ID. Please provide only one.")
if not has_image and not has_immich_id:
raise ValidationError("Must provide either an image file or an Immich ID.")
# Enforce: immich_id may only be used by a single user
if has_immich_id:
# Check if this immich_id is already used by a *different* user
from adventures.models import AdventureImage
conflict = AdventureImage.objects.filter(immich_id=self.immich_id).exclude(user_id=self.user_id)
if conflict.exists():
raise ValidationError("This Immich ID is already used by another user.")
def save(self, *args, **kwargs):
# Clean empty strings to None for proper database storage
if not self.image: