Update sanitizedSchemas.ts

This commit is contained in:
Daniel Hougaard
2024-01-29 14:33:45 +04:00
parent abd3652910
commit fbfe797547

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { IntegrationAuthsSchema, SecretApprovalPoliciesSchema } from "@app/db/schemas";
import { IntegrationAuthsSchema, SecretApprovalPoliciesSchema, UsersSchema } from "@app/db/schemas";
// sometimes the return data must be santizied to avoid leaking important values
// always prefer pick over omit in zod
@@ -28,6 +28,18 @@ export const sapPubSchema = SecretApprovalPoliciesSchema.merge(
})
);
export const sanitizedServiceTokenUserSchema = UsersSchema.pick({
authMethods: true,
id: true,
createdAt: true,
updatedAt: true,
devices: true,
email: true,
firstName: true,
lastName: true,
mfaMethods: true
});
export const secretRawSchema = z.object({
id: z.string(),
_id: z.string(),