mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
fix: get event id from max_id
sometimes the 'max_id' format can come as `${created_at}-${id}`
so if that's the case, we split by the - (minus) character
This commit is contained in:
parent
8e8f8767b4
commit
6d9d2fd42a
1 changed files with 4 additions and 1 deletions
|
|
@ -2,7 +2,10 @@ import { z } from 'zod';
|
|||
|
||||
/** Schema to parse pagination query params. */
|
||||
export const paginationSchema = z.object({
|
||||
max_id: z.string().optional().catch(undefined),
|
||||
max_id: z.string().transform((val) => {
|
||||
if (!val.includes('-')) return val;
|
||||
return val.split('-')[1];
|
||||
}).optional().catch(undefined),
|
||||
min_id: z.string().optional().catch(undefined),
|
||||
since: z.coerce.number().nonnegative().optional().catch(undefined),
|
||||
until: z.coerce.number().nonnegative().optional().catch(undefined),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue