refactor: add server side validation schema for authProviders (#4876)
* refactor: move files to subfolder * refactor: schema for authenticationProviders.info * refactor: schema for authenticationProviders.update * refactor: use validated body
This commit is contained in:
committed by
GitHub
parent
ab7b20958b
commit
0976e85a1a
27
server/routes/api/authenticationProviders/schema.ts
Normal file
27
server/routes/api/authenticationProviders/schema.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { z } from "zod";
|
||||
import BaseSchema from "@server/routes/api/BaseSchema";
|
||||
|
||||
export const AuthenticationProvidersInfoSchema = BaseSchema.extend({
|
||||
body: z.object({
|
||||
/** Authentication Provider Id */
|
||||
id: z.string().uuid(),
|
||||
}),
|
||||
});
|
||||
|
||||
export type AuthenticationProvidersInfoReq = z.infer<
|
||||
typeof AuthenticationProvidersInfoSchema
|
||||
>;
|
||||
|
||||
export const AuthenticationProvidersUpdateSchema = BaseSchema.extend({
|
||||
body: z.object({
|
||||
/** Authentication Provider Id */
|
||||
id: z.string().uuid(),
|
||||
|
||||
/** Whether the Authentication Provider is enabled or not */
|
||||
isEnabled: z.boolean(),
|
||||
}),
|
||||
});
|
||||
|
||||
export type AuthenticationProvidersUpdateReq = z.infer<
|
||||
typeof AuthenticationProvidersUpdateSchema
|
||||
>;
|
||||
Reference in New Issue
Block a user