@@ -5,7 +5,7 @@ import type {
55} from "adminforth" ;
66import clone from 'clone' ;
77
8- import { AdminForthPlugin , parseBody , AdminForthResourcePages , suggestIfTypo } from "adminforth" ;
8+ import { AdminForthPlugin , AdminForthResourcePages , suggestIfTypo } from "adminforth" ;
99import { PluginOptions } from "./types.js" ;
1010import { interpretResource , ActionCheckSource } from "adminforth" ;
1111import { z } from "zod" ;
@@ -67,10 +67,9 @@ export default class ForeignInlineListPlugin extends AdminForthPlugin {
6767 server . endpoint ( {
6868 method : 'POST' ,
6969 path : `/plugin/${ this . pluginInstanceId } /start_bulk_action` ,
70- handler : async ( { body, adminUser, tr, response : httpResponse } ) => {
71- const parsed = parseBody ( startBulkActionBodySchema , body , httpResponse ) ;
72- if ( 'error' in parsed ) return parsed . error ;
73- const data = parsed . data ;
70+ request_schema : startBulkActionBodySchema ,
71+ handler : async ( { body, adminUser, tr } ) => {
72+ const data = body as z . infer < typeof startBulkActionBodySchema > ;
7473 const { resourceId, actionId, recordIds } = data ;
7574 const resource = this . adminforth . config . resources . find ( ( res ) => res . resourceId == resourceId ) ;
7675 if ( ! resource ) {
@@ -116,13 +115,12 @@ export default class ForeignInlineListPlugin extends AdminForthPlugin {
116115 server . endpoint ( {
117116 method : 'POST' ,
118117 path : `/plugin/${ this . pluginInstanceId } /get_default_filters` ,
119- handler : async ( { body, response } ) => {
118+ request_schema : getDefaultFiltersBodySchema ,
119+ handler : async ( { body } ) => {
120120 if ( ! this . options . defaultFilters ) {
121121 return { error : 'No default filters function defined' , ok : false } ;
122122 }
123- const parsed = parseBody ( getDefaultFiltersBodySchema , body , response ) ;
124- if ( 'error' in parsed ) return parsed . error ;
125- const data = parsed . data ;
123+ const data = body as z . infer < typeof getDefaultFiltersBodySchema > ;
126124 const record = data . record ;
127125 if ( ! record ) {
128126 return { error : 'No record provided in request body' , ok : false } ;
0 commit comments