Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fix insights validation.

Brian Cao9180a7008b03
diff --git a/src/pages/api/reports/insights.ts b/src/pages/api/reports/insights.ts
index 04e51d4ca..d10eba3fb 100644
--- a/src/pages/api/reports/insights.ts
+++ b/src/pages/api/reports/insights.ts
@@ -12,8 +12,8 @@ export interface InsightsRequestBody {
startDate: string;
endDate: string;
};
- fields: { name: string; type: string; value: string }[];
- filters: string[];
+ fields: { name: string; type: string; label: string }[];
+ filters: { name: string; type: string; filter: string; value: string }[];
groups: { name: string; type: string }[];
}
@@ -33,12 +33,23 @@ const schema = {
yup.object().shape({
name: yup.string().required(),
type: yup.string().required(),
+ label: yup.string().required(),
+ }),
+ )
+ .min(1)
+ .required(),
+ filters: yup
+ .array()
+ .of(
+ yup.object().shape({
+ name: yup.string().required(),
+ type: yup.string().required(),
+ filter: yup.string().required(),
value: yup.string().required(),
}),
)
.min(1)
.required(),
- filters: yup.array().of(yup.string()).min(1).required(),
groups: yup.array().of(
yup.object().shape({
name: yup.string().required(),