Sorting
Use the helpers to parse a compact sort query string like ?sort=name:asc,createdAt:desc.
import { TypedRoute, SortingParams, createSortingQueryStringSchema } from '@lonestone/nzoth/server'
const allowed = ['name', 'email', 'createdAt'] as constconst sortSchema = createSortingQueryStringSchema(allowed)
@TypedRoute.Get()list(@SortingParams(sortSchema) sort?: z.infer<typeof sortSchema>) { return this.service.list({ sort })}Notes:
- Default direction is
ascwhen omitted (e.g.,name→name:asc). - Invalid directions are rejected with a clear error message.