Fix ts type check

This commit is contained in:
Fang-Pen Lin
2025-12-05 12:27:36 -08:00
parent 43cfcca740
commit 10faea4abe
@@ -23,6 +23,14 @@ const SanitizedAccountSchema = z.union([
SanitizedKubernetesAccountWithResourceSchema SanitizedKubernetesAccountWithResourceSchema
]); ]);
const ListPamAccountsResponseSchema = z.object({
accounts: SanitizedAccountSchema.array(),
folders: PamFoldersSchema.array(),
totalCount: z.number().default(0),
folderId: z.string().optional(),
folderPaths: z.record(z.string(), z.string())
});
export const registerPamAccountRouter = async (server: FastifyZodProvider) => { export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
server.route({ server.route({
method: "GET", method: "GET",
@@ -52,13 +60,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
.optional() .optional()
}), }),
response: { response: {
200: z.object({ 200: ListPamAccountsResponseSchema
accounts: SanitizedAccountSchema.array(),
folders: PamFoldersSchema.array(),
totalCount: z.number().default(0),
folderId: z.string().optional(),
folderPaths: z.record(z.string(), z.string())
})
} }
}, },
onRequest: verifyAuth([AuthMode.JWT]), onRequest: verifyAuth([AuthMode.JWT]),
@@ -95,7 +97,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
} }
}); });
return { accounts, folders, totalCount, folderId, folderPaths }; return { accounts, folders, totalCount, folderId, folderPaths } as z.infer<typeof ListPamAccountsResponseSchema>;
} }
}); });