update data format

This commit is contained in:
Viet-Tien Ngoc 2024-06-25 14:41:31 +07:00
parent d2658458aa
commit 3076729d7a
5 changed files with 6 additions and 5 deletions

View file

@ -32,7 +32,7 @@ function getClient() {
} = new URL(process.env.CLICKHOUSE_URL);
const client = createClient({
host: `${protocol}//${hostname}:${port}`,
url: `${protocol}//${hostname}:${port}`,
database: pathname.replace('/', ''),
username: username,
password,

View file

@ -19,7 +19,7 @@ function getClient() {
? {
ssl: true,
sasl: {
mechanism: 'scram-sha-256',
mechanism: 'plain',
username,
password,
},
@ -57,7 +57,7 @@ async function getProducer(): Promise<Producer> {
}
function getDateFormat(date: Date, format?: string): string {
return dateFormat(date, format ? format : 'UTC:yyyy-mm-dd HH:MM:ss');
return dateFormat(date, format ? format : 'yyyy-mm-dd HH:MM:ss');
}
async function sendMessage(

View file

@ -75,7 +75,7 @@ async function clickhouseQuery(data: {
string_value: getStringValue(value, dataType),
number_value: dataType === DATA_TYPE.number ? value : null,
date_value: dataType === DATA_TYPE.date ? getDateFormat(value) : null,
created_at: createdAt,
created_at: createdAt ?? getDateFormat(new Date()),
};
});

View file

@ -94,7 +94,7 @@ async function clickhouseQuery(data: {
string_value: getStringValue(value, dataType),
number_value: dataType === DATA_TYPE.number ? value : null,
date_value: dataType === DATA_TYPE.date ? getDateFormat(value) : null,
created_at: createdAt,
created_at: createdAt ?? getDateFormat(new Date()),
};
});

View file

@ -146,6 +146,7 @@ export type UmamiTracker = {
*/
(eventFunction: CustomEventFunction): Promise<string>;
};
identify: (data: { [key: string]: number | string | number[] | string[] }) => Promise<string>;
};
interface Window {