Compare commits

...

1 Commits

Author SHA1 Message Date
dswbx c1e2456ada adding where and with to read many 2025-07-23 11:22:40 +02:00
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)) { if (files.includes(path)) {
try { try {
const content = await import(`bknd/static/${path}?raw`, { const content = await import(`bknd/static/${path}?raw`, {
/* @vite-ignore */
assert: { type: "text" }, assert: { type: "text" },
}).then((m) => m.default); }).then((m) => m.default);
+12 -2
View File
@@ -256,10 +256,12 @@ export class DataController extends Controller {
// read many // read many
const saveRepoQuery = s const saveRepoQuery = s
.object({ .object({
...omitKeys(repoQuery.properties, ["with"]), ...omitKeys(repoQuery.properties, ["with", "where"]),
sort: s.string({ default: "id" }), sort: s.string({ default: "id" }),
select: s.array(s.string()), select: s.array(s.string()),
join: s.array(s.string()), join: s.array(s.string()),
with: s.anyOf([s.array(s.string()), s.record(s.object({}))]),
where: s.object({}),
}) })
.partial(); .partial();
const saveRepoQueryParams = (pick: string[] = Object.keys(repoQuery.properties)) => [ const saveRepoQueryParams = (pick: string[] = Object.keys(repoQuery.properties)) => [
@@ -273,7 +275,15 @@ export class DataController extends Controller {
"/:entity", "/:entity",
describeRoute({ describeRoute({
summary: "Read many", summary: "Read many",
parameters: saveRepoQueryParams(["limit", "offset", "sort", "select", "join"]), parameters: saveRepoQueryParams([
"limit",
"offset",
"sort",
"select",
"join",
"with",
"where",
]),
tags: ["data"], tags: ["data"],
}), }),
permission(DataPermissions.entityRead), permission(DataPermissions.entityRead),