Skip to content

refactor: Move checkExistingAssets(), checkBulkUpdate() remove getAllAssets() - #9715

Merged
jrasm91 merged 7 commits into
immich-app:mainfrom
midzelis:simplify_moveafew2
May 25, 2024
Merged

jrasm91 merged 7 commits into
immich-app:mainfrom
midzelis:simplify_moveafew2

Conversation

@midzelis

@midzelis midzelis commented May 24, 2024 •

Copy link
Copy Markdown
Collaborator

This was split from PR #8480.

This is relocating a few controller.v1 methods into the asset-media controller:

POST /asset/exist (checkExistingAssets)
POST /asset/bulk-upload-check (checkBulkUpload)

This one is deleted, as its unused.

GET /asset (getAllAssets)

@midzelis
midzelis requested a review from danieldietzler as a code owner May 24, 2024 01:14
import { FileUploadInterceptor, Route, UploadFiles, getFiles } from 'src/middleware/file-upload.interceptor';
import { AssetMediaService } from 'src/services/asset-media.service';
import { FileNotEmptyValidator, UUIDParamDto } from 'src/validation';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think removing this newline was intentional

Comment thread server/src/services/asset.service.ts Outdated
import { AssetEntity, AssetType } from 'src/entities/asset.entity';
import { IAlbumRepository } from 'src/interfaces/album.interface';
import { IAssetStackRepository } from 'src/interfaces/asset-stack.interface';
import { IAssetRepositoryV1 } from 'src/interfaces/asset-v1.interface';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { IAssetRepositoryV1 } from 'src/interfaces/asset-v1.interface';

Comment thread server/src/services/asset.service.ts
@midzelis
midzelis requested a review from jrasm91 May 24, 2024 23:00
@midzelis midzelis changed the title refactor: Move a few controller methods - non-breaking refactor: Move checkExistingAssets(), checkBulkUpdate() remove getAllAssets() May 24, 2024
@jrasm91
jrasm91 merged commit d5cf8e4 into immich-app:main May 25, 2024
Deathwalker-47 pushed a commit to Deathwalker-47/Immich-Image-edit that referenced this pull request Aug 15, 2026
None of these show up in local testing — all three only bite once the app is
containerised and pointed at a real Immich. Found by checking the deploy path
rather than assuming the working local build would transfer.

## 1. LoRA catalogue would load EMPTY in production

lora.ts resolved master_lora_dict.json via path.join(__dirname, '../..'),
which is correct from source (<repo>/backend/dist -> repo root) but resolves
to '/' inside the image (/app/dist -> /). Worse, the two JSON files live at
the repo root while the backend image's build context is ./backend, so they
are not in the build context at all and could never have been COPYed in.

Net effect: the picker renders empty, every LoRA edit silently resolves to no
LoRAs, and nothing logs an error — the exact silent-degradation failure mode
this project has been bitten by before. Replaced with a candidate-path
resolver (env override, then the realistic Docker and local locations),
mounted both files read-only in docker-compose, and added a loud startup
warning naming the path it looked at, so an empty catalogue can never again be
invisible. Verified against a simulated /app container layout: 81 LoRAs load,
50-entry AIR cache seeds correctly.

## 2. No volume for backend/data — every deploy wiped runtime state

HANDOFF.md §8 explicitly calls for runware_lora_mapping.json to live on a
persistent, volume-mounted path so container rebuilds don't force a full
re-upload. That mount had never been added, so `docker compose build` also
discarded settings.json along with it. Added ./backend/data:/app/data.

## 3. The gallery's timeline endpoint calls a REMOVED Immich API

routes/immich.ts used GET /assets?page=&size=&order=desc — the getAllAssets
endpoint removed in immich-app/immich#9715, whose documented replacement is
POST /search/metadata. On current Immich this 404s.

This is very likely the actual root cause of HANDOFF.md §6.5's "Failed to load
photos" dead-end. That was characterised as an intermittent failure, but a
removed endpoint fails 100% of the time for the "Recent Photos" view while
album browsing (a different, still-valid endpoint) keeps working — which
presents to a user exactly like intermittent flakiness. The retry + recoverable
error state added earlier fixed how that failure *surfaced*; this fixes the
cause.

Switched to POST /search/metadata (the same endpoint already verified working
against a real Immich in the sibling bridge project) and normalised its nested
{assets:{items:[]}} response to a plain array at the backend boundary. Also
taught the frontend parser that shape directly — otherwise a nested payload
reaching it would be read as a non-array and render "no photos found" on a
*successful* fetch.

Backend and frontend both typecheck and build clean. Note that #3 remains the
one thing not verifiable from here: no Immich instance is reachable from this
environment, so the corrected endpoint is doc-verified and matches a
known-working implementation, but has not been run against a live server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants