adding where and with to read many

This commit is contained in:
dswbx
2025-07-23 11:22:40 +02:00
parent bebf9e0411
commit c1e2456ada
2 changed files with 13 additions and 2 deletions
+1
View File
@@ -169,6 +169,7 @@ export function serveStaticViaImport(opts?: { manifest?: Manifest }) {
if (files.includes(path)) {
try {
const content = await import(`bknd/static/${path}?raw`, {
/* @vite-ignore */
assert: { type: "text" },
}).then((m) => m.default);
+12 -2
View File
@@ -256,10 +256,12 @@ export class DataController extends Controller {
// read many
const saveRepoQuery = s
.object({
...omitKeys(repoQuery.properties, ["with"]),
...omitKeys(repoQuery.properties, ["with", "where"]),
sort: s.string({ default: "id" }),
select: s.array(s.string()),
join: s.array(s.string()),
with: s.anyOf([s.array(s.string()), s.record(s.object({}))]),
where: s.object({}),
})
.partial();
const saveRepoQueryParams = (pick: string[] = Object.keys(repoQuery.properties)) => [
@@ -273,7 +275,15 @@ export class DataController extends Controller {
"/:entity",
describeRoute({
summary: "Read many",
parameters: saveRepoQueryParams(["limit", "offset", "sort", "select", "join"]),
parameters: saveRepoQueryParams([
"limit",
"offset",
"sort",
"select",
"join",
"with",
"where",
]),
tags: ["data"],
}),
permission(DataPermissions.entityRead),