Skip to content

Feature 041: supply title/description at upload time; return expected_id in response#4385

Merged
ildyria merged 9 commits into
masterfrom
copilot/feature-41-set-photo-title-description
Jun 1, 2026
Merged

Feature 041: supply title/description at upload time; return expected_id in response#4385
ildyria merged 9 commits into
masterfrom
copilot/feature-41-set-photo-title-description

Conversation

Copilot AI commented May 31, 2026

Copy link
Copy Markdown
Contributor

Callers currently must make a second API call to set title/description after upload. This wires those fields directly into the upload request and returns an expected_id so clients know the photo's ID before async processing completes.

HTTP layer

  • UploadPhotoRequest: adds title (max 100) and description (max 1 000) optional fields with TitleRule/DescriptionRule validation
  • UploadMetaResource: gains ?string $expected_id, ?string $title, ?string $description
  • PhotoController::upload(): generates a 24-char Base64url expected_id on the final non-zip chunk (same algorithm as generateKey()); forwards all three fields into ProcessImageJob

DTO chain

ImportParam → InitDTO → StandaloneDTO each gain ?string $title, ?string $description, ?string $preallocated_id (nullable, default null; backward-compatible).

Pipeline

  • New ApplyUserProvidedMetadata pipe inserted before HydrateMetadata — assigns caller-supplied title/description to the photo so EXIF cannot overwrite them
  • AutoRenamer: returns early when $state->title !== null

ID pre-allocation

  • Photo::preallocateId(string $id) stores the caller-chosen ID
  • HasRandomIDAndLegacyTimeBasedID::generateKey() consumes it on first insert then clears it; falls back to a fresh random ID on DB collision (so expected_id is best-effort, not guaranteed)

Tests

UploadWithMetadataTest (9 tests, 466 assertions) covering title/description override, EXIF fallback, expected_id match, duplicate 409 (skip_duplicates=true), zip null expected_id, validation limits, and AutoRenamer skip.

Note on duplicate 409: ThrowSkipDuplicate throws PhotoSkippedException (HTTP 409) only when skip_duplicates = true. With the default skip_duplicates = false the duplicate is re-linked without error (HTTP 201).

Copilot AI and others added 8 commits May 31, 2026 10:35
…ng docs

Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
…stions.md

Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
…n doc, and open-questions

Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
Agent-Logs-Url: https://github.com/LycheeOrg/Lychee/sessions/82663c4f-6e7e-4d20-b22a-5a87f3a60171

Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
…d var)

Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
Copilot AI changed the title Feature 041: Upload Photo Metadata (title, description, expected_id) Feature 041: supply title/description at upload time; return expected_id in response May 31, 2026
Copilot AI requested a review from ildyria May 31, 2026 22:09
@codecov

codecov Bot commented May 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.28%. Comparing base (46c372d) to head (8276d55).
⚠️ Report is 3 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria marked this pull request as ready for review June 1, 2026 13:19
@ildyria ildyria requested a review from a team as a code owner June 1, 2026 13:19
@ildyria ildyria merged commit 0ee2463 into master Jun 1, 2026
45 checks passed
@ildyria ildyria deleted the copilot/feature-41-set-photo-title-description branch June 1, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants