@@ -11,34 +11,15 @@ import { splitPayouts } from "./split-payouts";
1111export const dynamic = "force-dynamic" ;
1212export const maxDuration = 600 ; // This function can run for a maximum of 10 minutes
1313
14- const processPayoutsCronSchema = z . preprocess (
15- ( raw : unknown ) => {
16- if ( ! raw || typeof raw !== "object" || raw === null ) {
17- return raw ;
18- }
19- const d = raw as Record < string , unknown > ;
20- if (
21- typeof d . selectedPayoutId === "string" &&
22- d . selectedPayoutId &&
23- ( ! Array . isArray ( d . selectedPayoutIds ) || d . selectedPayoutIds . length === 0 )
24- ) {
25- return {
26- ...d ,
27- selectedPayoutIds : [ d . selectedPayoutId ] ,
28- } ;
29- }
30- return raw ;
31- } ,
32- z . object ( {
33- workspaceId : z . string ( ) ,
34- userId : z . string ( ) ,
35- invoiceId : z . string ( ) ,
36- paymentMethodId : z . string ( ) ,
37- cutoffPeriod : CUTOFF_PERIOD_ENUM ,
38- selectedPayoutIds : z . array ( z . string ( ) ) . optional ( ) ,
39- excludedPayoutIds : z . array ( z . string ( ) ) . optional ( ) ,
40- } ) ,
41- ) ;
14+ const processPayoutsCronSchema = z . object ( {
15+ workspaceId : z . string ( ) ,
16+ userId : z . string ( ) ,
17+ invoiceId : z . string ( ) ,
18+ paymentMethodId : z . string ( ) ,
19+ cutoffPeriod : CUTOFF_PERIOD_ENUM ,
20+ selectedPayoutIds : z . array ( z . string ( ) ) . optional ( ) ,
21+ excludedPayoutIds : z . array ( z . string ( ) ) . optional ( ) ,
22+ } ) ;
4223
4324// POST /api/cron/payouts/process
4425// This route is used to process payouts for a given invoice
0 commit comments