Skip to content

Commit

Permalink
Fixed types
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeShi42 committed Feb 22, 2024
1 parent a8646c6 commit aa91177
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/api/src/tasks/checkAlerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const buildAlertMessageTemplateTitle = ({
template,
view,
}: {
template?: string;
template?: string | null;
view: AlertMessageTemplateDefaultView;
}) => {
const { alert, dashboard, savedSearch, value } = view;
Expand Down Expand Up @@ -210,7 +210,7 @@ export const buildAlertMessageTemplateBody = async ({
template,
view,
}: {
template?: string;
template?: string | null;
view: AlertMessageTemplateDefaultView;
}) => {
const {
Expand Down
9 changes: 4 additions & 5 deletions packages/api/src/utils/zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ export const alertSchema = z
threshold: z.number().min(0),
type: z.enum(['presence', 'absence']),
source: z.enum(['LOG', 'CHART']).default('LOG'),
templateTitle: z.string().min(1).max(512).nullable().optional(),
templateBody: z.string().min(1).max(4096).nullable().optional(),
templateTitle: z.string().min(1).max(512).nullish(),
templateBody: z.string().min(1).max(4096).nullish(),
})
.and(zLogAlert.or(zChartAlert));

Expand All @@ -233,7 +233,6 @@ export const externalSearchAlertSchema = z.object({
source: z.literal('search'),
groupBy: z.string().optional(),
savedSearchId: objectIdSchema,
message: z.string().optional(),
});

export const externalChartAlertSchema = z.object({
Expand All @@ -249,8 +248,8 @@ export const externalAlertSchema = z
threshold: z.number().min(0),
threshold_type: z.enum(['above', 'below']),
source: z.enum(['search', 'chart']).default('search'),
name: z.string().min(1).max(512).nullable().optional(),
message: z.string().min(1).max(4096).nullable().optional(),
name: z.string().min(1).max(512).nullish(),
message: z.string().min(1).max(4096).nullish(),
})
.and(externalSearchAlertSchema.or(externalChartAlertSchema));

Expand Down

0 comments on commit aa91177

Please sign in to comment.