Type Alias QuerySchema<TFilterSchema, TOrderBySchema>

QuerySchema<TFilterSchema, TOrderBySchema>: z.ZodObject<{
    filter: z.ZodOptional<z.ZodNullable<TFilterSchema>>;
    where: z.ZodOptional<z.ZodNullable<TFilterSchema>>;
    orderBy: z.ZodOptional<z.ZodNullable<TOrderBySchema>>;
    cursor: z.ZodOptional<z.ZodNullable<CursorSchema>>;
}, "strip">

Query schema defines shape of the query used to fetch data.

Type Parameters

  • TFilterSchema extends FilterSchema

    Filter schema used to filter data.

  • TOrderBySchema extends OrderBySchema

    OrderBy schema used to order data.

Type declaration

  • filter: z.ZodOptional<z.ZodNullable<TFilterSchema>>

    User-land filter.

  • where: z.ZodOptional<z.ZodNullable<TFilterSchema>>

    "Hard" filter, overrides "filter"; this is useful for bound queries (for example given clientId should not be changed).

  • orderBy: z.ZodOptional<z.ZodNullable<TOrderBySchema>>

    Order by schema.

  • cursor: z.ZodOptional<z.ZodNullable<CursorSchema>>

    Paging support.

Remarks

Basic idea of this schema is to define a standard way how to fetch data from the source. It should be used in all queries to provide consistent API.

Filter is dynamic part fully available to the user, when where is filter defined by your application which cannot be change by the user.