fix: allow custom admin user collection in query presets constraints (#12202)

Query preset "Specific User" constraints is currently fixed to `users`
collection. However, this will fail if one has a custom admin user collection.
This commit is contained in:
Samuel Gabriel
2025-05-02 01:58:51 +08:00
committed by GitHub
parent e5b28c98dc
commit b9868c4a3b

View File

@@ -74,7 +74,7 @@ export const getConstraints = (config: Config): Field => ({
},
],
},
relationTo: 'users',
relationTo: config.admin?.user ?? 'users', // TODO: remove this fallback when the args are properly typed as `SanitizedConfig`
},
...(config?.queryPresets?.constraints?.[operation]?.reduce(
(acc: Field[], option: QueryPresetConstraint) => {