mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(schemas): fix sendgrid email service config (#4093)
This commit is contained in:
parent
740e482aed
commit
3d3c82b1c5
1 changed files with 21 additions and 13 deletions
|
@ -81,11 +81,8 @@ export enum OtherEmailTemplate {
|
|||
|
||||
export const otherEmailTemplateGuard = z.nativeEnum(OtherEmailTemplate);
|
||||
|
||||
export const emailServiceDataGuard = z.discriminatedUnion('provider', [
|
||||
z.object({
|
||||
provider: z.literal(EmailServiceProvider.SendGrid),
|
||||
appId: z.string(),
|
||||
appSecret: z.string(),
|
||||
const emailServiceBasicConfig = {
|
||||
fromName: z.string(),
|
||||
fromEmail: z.string(),
|
||||
templates: z.record(
|
||||
verificationCodeTypeGuard.or(otherEmailTemplateGuard),
|
||||
|
@ -94,7 +91,18 @@ export const emailServiceDataGuard = z.discriminatedUnion('provider', [
|
|||
content: z.string(),
|
||||
})
|
||||
),
|
||||
}),
|
||||
};
|
||||
|
||||
export const sendgridEmailServiceDataGuard = z.object({
|
||||
provider: z.literal(EmailServiceProvider.SendGrid),
|
||||
apiKey: z.string(),
|
||||
...emailServiceBasicConfig,
|
||||
});
|
||||
|
||||
export type SendgridEmailServiceData = z.infer<typeof sendgridEmailServiceDataGuard>;
|
||||
|
||||
export const emailServiceDataGuard = z.discriminatedUnion('provider', [
|
||||
sendgridEmailServiceDataGuard,
|
||||
]);
|
||||
|
||||
export type EmailServiceData = z.infer<typeof emailServiceDataGuard>;
|
||||
|
|
Loading…
Reference in a new issue