refactor(schema): reorganize IndexField and related types (#22439)
## Summary
Querying `indexMetadatas { indexFieldMetadatas { ... } }` on the
`/metadata` GraphQL endpoint fails with a 500:
> Nest could not find IndexFieldMetadataDTOAuthorizer element (this
provider does not
> exist in the current context)
The `@CursorConnection('indexFieldMetadatas', ...)` decorator on
`IndexMetadataDTO` makes nestjs-query auto-generate a relation resolver
that injects an authorizer for `IndexFieldMetadataDTO`. That authorizer
is never provided, because the DTO was never registered as a resolver in
`IndexMetadataModule` — so the field has been broken since it was
introduced in #7162.
Since the working, DataLoader-backed `indexFieldMetadataList` field
already exposes the same data (and is what the frontend uses), this PR
removes the dead connection instead of wiring up the authorizer.
## Changes
- Remove `@CursorConnection('indexFieldMetadatas', ...)` from
`IndexMetadataDTO`
- Regenerate frontend metadata GraphQL types
(`twenty-front/src/generated-metadata`)
- Regenerate client SDK metadata schema/types
(`twenty-client-sdk/src/metadata/generated`)
## Notes
- Not a breaking change in practice: the removed field always threw, so
no consumer can have been relying on it. Callers now get a standard
GraphQL validation error suggesting `indexFieldMetadataList` instead of
an internal server error.
- Verified locally: the failing query now returns `Cannot query field
"indexFieldMetadatas" on type "Index". Did you mean
"indexFieldMetadataList"?` and `indexFieldMetadataList` continues to
work.
Fixes [sonarly issue #54098](https://sonarly.com/issue/54098?type=bug)
<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/22439?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
@@ -529,15 +529,6 @@ enum FieldMetadataType {
|
||||
UUID
|
||||
}
|
||||
|
||||
type IndexField {
|
||||
id: UUID!
|
||||
fieldMetadataId: UUID!
|
||||
order: Float!
|
||||
subFieldName: String
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
}
|
||||
|
||||
type Index {
|
||||
id: UUID!
|
||||
name: String!
|
||||
@@ -555,13 +546,6 @@ type Index {
|
||||
"""Specify to filter the records returned."""
|
||||
filter: ObjectFilter! = {}
|
||||
): IndexObjectMetadataConnection!
|
||||
indexFieldMetadatas(
|
||||
"""Limit or page results."""
|
||||
paging: CursorPaging! = {first: 10}
|
||||
|
||||
"""Specify to filter the records returned."""
|
||||
filter: IndexFieldFilter! = {}
|
||||
): IndexIndexFieldMetadatasConnection!
|
||||
}
|
||||
|
||||
"""Type of the index"""
|
||||
@@ -622,13 +606,6 @@ input BooleanFieldComparison {
|
||||
isNot: Boolean
|
||||
}
|
||||
|
||||
input IndexFieldFilter {
|
||||
and: [IndexFieldFilter!]
|
||||
or: [IndexFieldFilter!]
|
||||
id: UUIDFilterComparison
|
||||
fieldMetadataId: UUIDFilterComparison
|
||||
}
|
||||
|
||||
type ObjectStandardOverrides {
|
||||
labelSingular: String
|
||||
labelPlural: String
|
||||
@@ -2021,6 +1998,15 @@ enum RelationType {
|
||||
MANY_TO_ONE
|
||||
}
|
||||
|
||||
type IndexField {
|
||||
id: UUID!
|
||||
fieldMetadataId: UUID!
|
||||
order: Float!
|
||||
subFieldName: String
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
}
|
||||
|
||||
type IndexEdge {
|
||||
"""The node containing the Index"""
|
||||
node: Index!
|
||||
@@ -2051,22 +2037,6 @@ type IndexConnection {
|
||||
edges: [IndexEdge!]!
|
||||
}
|
||||
|
||||
type IndexFieldEdge {
|
||||
"""The node containing the IndexField"""
|
||||
node: IndexField!
|
||||
|
||||
"""Cursor for this node."""
|
||||
cursor: ConnectionCursor!
|
||||
}
|
||||
|
||||
type IndexIndexFieldMetadatasConnection {
|
||||
"""Paging information"""
|
||||
pageInfo: PageInfo!
|
||||
|
||||
"""Array of edges."""
|
||||
edges: [IndexFieldEdge!]!
|
||||
}
|
||||
|
||||
type ObjectEdge {
|
||||
"""The node containing the Object"""
|
||||
node: Object!
|
||||
|
||||
Reference in New Issue
Block a user