fix(files): filter by entity.memberOf instead of entity.id#21
Merged
Conversation
GET /files?memberOf=X was filtering files whose related entity *id* equalled the given URL, instead of files whose entity is a *member of* the given collection. Because File and Entity share an id (1:1), this collapsed to a primary-key lookup that almost never matched a collection URL. Add an integration test (with seeded File rows in the test DB) and a response-body assertion to the unit test, since mocked Prisma will silently accept any where-clause shape.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
alvinsw
approved these changes
Apr 29, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Apr 29, 2026
## [4.0.0](v3.0.0...v4.0.0) (2026-04-29) ### ⚠ BREAKING CHANGES * arocapi no longer decorates fastify.prisma or fastify.opensearch; consumers must close over their own client references. Arocapi no longer calls prisma.$connect()/$disconnect() or opensearch.ping()/close() — consumers now own connecting before registration and closing on shutdown. ### Features * replace decoration with options-based dependency injection ([#20](#20)) ([aa5c6b7](aa5c6b7)) ### Bug Fixes * **files:** filter by entity.memberOf instead of entity.id ([#21](#21)) ([a6f27bd](a6f27bd))
|
🎉 This PR is included in version 4.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /files?memberOf=Xwas filtering files whose related entity id equalled the given URL, instead of files whose entity is a member of that collection. BecauseFileandEntityshare an id (1:1 relation viaFile.id→Entity.id), this collapsed to a primary-key lookup that almost never matched a collection URL.files.test.tsreinforced the bug — it assertedprisma.file.findManywas called with the wrongwhereshape, which mocks happily accept. The fix updates that assertion and adds a response-body assertion./filesintegration coverage backed by real File rows seeded against the test DB. Verified the new integration tests fail when the bug is reintroduced.Test plan
pnpm test src/routes/files.test.ts— 12 passedpnpm test src/test/integration.test.ts— 25 passed (4 new/filestests)pnpm exec tsc --noEmit— clean