fix gql *_by_version

This commit is contained in:
Nitwel
2025-08-25 18:15:28 +02:00
parent c6d5b561a0
commit 82bf7239e8
3 changed files with 3 additions and 2 deletions

View File

@@ -36,7 +36,6 @@ export async function resolveQuery(gql: GraphQLService, info: GraphQLResolveInfo
if (collection.endsWith('_by_version') && collection in gql.schema.collections === false) {
collection = collection.slice(0, -11);
query.versionRaw = true;
}
}

View File

@@ -707,6 +707,7 @@ export async function getReadableTypes(
? { version: new GraphQLNonNull(GraphQLString) }
: {
version: new GraphQLNonNull(GraphQLString),
versionRaw: GraphQLBoolean,
id: new GraphQLNonNull(GraphQLID),
},
resolve: async ({ info, context }: { info: GraphQLResolveInfo; context: Record<string, any> }) => {

View File

@@ -81,7 +81,8 @@ export async function sanitizeQuery(
// whether or not to merge the relational results
query.versionRaw = Boolean(
'versionRaw' in rawQuery && (rawQuery['versionRaw'] === '' || rawQuery['versionRaw'] === 'true'),
'versionRaw' in rawQuery &&
(rawQuery['versionRaw'] === '' || rawQuery['versionRaw'] === 'true' || rawQuery['versionRaw'] === true),
);
}