Skip to content

Commit 4d76bd5

Browse files
committed
Batch add resource
1 parent b9f27b5 commit 4d76bd5

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { json } from "@remix-run/server-runtime";
2+
import {
3+
ApiBatchListPresenter,
4+
ApiBatchListSearchParams,
5+
} from "~/presenters/v3/ApiBatchListPresenter.server";
6+
import { createLoaderApiRoute } from "~/services/routeBuilders/apiBuilder.server";
7+
8+
export const loader = createLoaderApiRoute(
9+
{
10+
searchParams: ApiBatchListSearchParams,
11+
allowJWT: true,
12+
corsStrategy: "all",
13+
authorization: {
14+
action: "read",
15+
resource: () => ({ type: "runs" }),
16+
},
17+
findResource: async () => 1,
18+
},
19+
async ({ searchParams, authentication }) => {
20+
const presenter = new ApiBatchListPresenter();
21+
const result = await presenter.call(authentication.environment, searchParams);
22+
return json(result);
23+
}
24+
);

0 commit comments

Comments
 (0)