nestjs-query
nestjs-query copied to clipboard
FilterableUnPagedRelation decorator not working with withDeleted: true
Describe the bug
I have a File entity that is linked to FileToProject relation by the ID. I want to query potentially deleted Files (which works fine) along with the deleted nested FileToProject relation. However, when I use FilterableUnPagedRelation with withDeleted: true, it seems to have no effect on the query and I just get an empty toProjects array and it seems it is querying "toProjects"."deletedAt" IS NULL despite withDeleted being set.
Have you read the Contributing Guidelines?
yes
To Reproduce Check out this repo https://github.com/zilvis97/nestjs-filterableunpagedrelation-deleted-issue/
- Create a
Fileobject
mutation {
createOneFile(
input: { file: { id: "1", name: "File 1", deletedAt: null} }
) {
id
name
deletedAt
}
}
- Create
FileToProjectobject that references previously createdFile
mutation {
createOneFileToProject(
input: { fileToProject: { projectID: "3", fileID: "1", type:"PHOTO", version:1, deletedAt: null } }
) {
projectID
fileID
type
deletedAt
}
}
- Query files with linked
toProjectsobject and you will be able to see the link
query {
files {
edges {
node {
id
name
deletedAt
toProjects {
projectID
fileID
}
}
}
}
}
- Create another
FileToProjectthat references the sameFile, but the deletedAt date for this object
mutation {
createOneFileToProject(
input: { fileToProject: { projectID: "3", fileID: "1", type:"PHOTO", version:1, deletedAt: "2024-09-09T00:00:00.000Z" } }
) {
projectID
fileID
type
deletedAt
}
}
- Query files again and you will see that the latest relation will not be returned in the
toProjectsarray
Expected behavior
withDeleted: true option should be properly applied to FilterableUnPagedRelation
Screenshots
Screenshots of the data
Files:FilesToProjects:
As you can see there are 3 FileToProject links, but only the non deleted one is resolved on the File side.
Desktop (please complete the following information):
- Node Version [e.g. 14.14.0]
- Nestjs-query Version [e.g. v0.21.0]
Additional context Add any other context about the problem here.
Think the Nestjs versie seems incorrect? If not please update to the latest version, if the problem persists please create a repo that reproduces this issue.
@TriPSs I upgraded the versions but that doesn't seem to have any affect, I updated the issue description and added a link to the repo to reproduce the issue.
After looking at the code it seems this is not implemented for the many.