add psql query for retention
This commit is contained in:
@@ -7,17 +7,12 @@ import { getRetention } from 'queries';
|
||||
|
||||
export interface RetentionRequestBody {
|
||||
websiteId: string;
|
||||
urls: string[];
|
||||
window: number;
|
||||
dateRange: {
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
};
|
||||
window: string;
|
||||
dateRange: { window; startDate: string; endDate: string };
|
||||
}
|
||||
|
||||
export interface RetentionResponse {
|
||||
urls: string[];
|
||||
window: number;
|
||||
window: string;
|
||||
startAt: number;
|
||||
endAt: number;
|
||||
}
|
||||
@@ -32,7 +27,6 @@ export default async (
|
||||
if (req.method === 'POST') {
|
||||
const {
|
||||
websiteId,
|
||||
urls,
|
||||
window,
|
||||
dateRange: { startDate, endDate },
|
||||
} = req.body;
|
||||
@@ -44,8 +38,7 @@ export default async (
|
||||
const data = await getRetention(websiteId, {
|
||||
startDate: new Date(startDate),
|
||||
endDate: new Date(endDate),
|
||||
urls,
|
||||
windowMinutes: +window,
|
||||
window: window,
|
||||
});
|
||||
|
||||
return ok(res, data);
|
||||
|
||||
Reference in New Issue
Block a user