fix: tests

This commit is contained in:
John Yeo
2025-10-19 10:23:49 +01:00
parent 5d759eba8d
commit 2eeb83ed42
19 changed files with 297 additions and 146 deletions

View File

@@ -1,22 +1,13 @@
import { queryStringArray } from "@api/common/queryHelpers.js";
import { queryInteger, queryStringArray } from "@api/common/queryHelpers.js";
import { z } from "zod/v4";
/**
* Query params for GET /platform/users endpoint
*/
export const ListPlatformUsersQuerySchema = z.object({
limit: z
.number()
.int({ error: "limit must be an integer" })
.min(1, { error: "limit must be at least 1" })
.max(100, { error: "limit must be at most 100" })
.default(10),
limit: queryInteger({ min: 1, max: 100 }).default(10),
offset: z
.number({ error: "offset must be a number" })
.int({ error: "offset must be an integer" })
.min(0, { error: "offset must be at least 0" })
.default(0),
offset: queryInteger({ min: 0 }).default(0),
expand: queryStringArray(z.enum(["organizations"]))
.optional()
@@ -72,3 +63,28 @@ export const ListPlatformUsersResponseSchema = z.object({
export type ListPlatformUsersResponse = z.infer<
typeof ListPlatformUsersResponseSchema
>;
/**
* Query params for GET /platform/orgs endpoint
*/
export const ListPlatformOrgsQuerySchema = z.object({
limit: queryInteger({ min: 1, max: 100 }).default(10),
offset: queryInteger({ min: 0 }).default(0),
});
export type ListPlatformOrgsQuery = z.infer<typeof ListPlatformOrgsQuerySchema>;
/**
* Response schema for GET /platform/orgs
*/
export const ListPlatformOrgsResponseSchema = z.object({
list: z.array(ApiPlatformOrgSchema),
total: z.number().describe("Total number of organizations returned"),
limit: z.number().describe("Limit used in the query"),
offset: z.number().describe("Offset used in the query"),
});
export type ListPlatformOrgsResponse = z.infer<
typeof ListPlatformOrgsResponseSchema
>;