fix export api
This commit is contained in:
@@ -69,6 +69,12 @@ const eventsScheme = z.object({
|
|||||||
end: z.coerce.string().optional(),
|
end: z.coerce.string().optional(),
|
||||||
page: z.coerce.number().optional().default(1),
|
page: z.coerce.number().optional().default(1),
|
||||||
limit: z.coerce.number().optional().default(50),
|
limit: z.coerce.number().optional().default(50),
|
||||||
|
includes: z
|
||||||
|
.preprocess(
|
||||||
|
(arg) => (typeof arg === 'string' ? [arg] : arg),
|
||||||
|
z.array(z.string())
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function events(
|
export async function events(
|
||||||
@@ -103,7 +109,7 @@ export async function events(
|
|||||||
cursor,
|
cursor,
|
||||||
take,
|
take,
|
||||||
meta: false,
|
meta: false,
|
||||||
profile: true,
|
profile: query.data.includes?.includes('profile'),
|
||||||
};
|
};
|
||||||
|
|
||||||
const [data, totalCount] = await Promise.all([
|
const [data, totalCount] = await Promise.all([
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ export async function getEventList({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (startDate && endDate) {
|
if (startDate && endDate) {
|
||||||
sb.where.created_at = `toDate(created_at) BETWEEN '${formatClickhouseDate(startDate)}' AND '${formatClickhouseDate(endDate)}'`;
|
sb.where.created_at = `toDate(created_at) BETWEEN toDate('${formatClickhouseDate(startDate)}') AND toDate('${formatClickhouseDate(endDate)}')`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events && events.length > 0) {
|
if (events && events.length > 0) {
|
||||||
@@ -403,7 +403,7 @@ export async function getEventsCount({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (startDate && endDate) {
|
if (startDate && endDate) {
|
||||||
sb.where.created_at = `created_at BETWEEN '${formatClickhouseDate(startDate)}' AND '${formatClickhouseDate(endDate)}'`;
|
sb.where.created_at = `toDate(created_at) BETWEEN toDate('${formatClickhouseDate(startDate)}') AND toDate('${formatClickhouseDate(endDate)}')`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events && events.length > 0) {
|
if (events && events.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user