add types back to event / pageview. fix non-redis auth

This commit is contained in:
Francis Cao 2023-03-02 12:56:38 -08:00
parent 82f0bc3d2b
commit c9cacbb0e2
3 changed files with 42 additions and 3 deletions

View File

@ -36,7 +36,13 @@ export const useAuth = createMiddleware(async (req, res, next) => {
const shareToken = await parseShareToken(req);
let user = null;
const { userId, authKey } = payload || {};
let userId = null;
const { authKey } = payload || {};
if (typeof payload === 'string') {
userId = payload;
}
if (validate(userId)) {
user = await getUser({ id: userId });

View File

@ -53,7 +53,24 @@ async function relationalQuery(data: {
});
}
async function clickhouseQuery(data) {
async function clickhouseQuery(data: {
id: string;
websiteId: string;
url: string;
referrer?: string;
pageTitle?: string;
eventName?: string;
hostname?: string;
browser?: string;
os?: string;
device?: string;
screen?: string;
language?: string;
country?: string;
subdivision1?: string;
subdivision2?: string;
city?: string;
}) {
const {
websiteId,
id: sessionId,

View File

@ -50,7 +50,23 @@ async function relationalQuery(data: {
});
}
async function clickhouseQuery(data) {
async function clickhouseQuery(data: {
id: string;
websiteId: string;
url: string;
referrer?: string;
pageTitle?: string;
hostname?: string;
browser?: string;
os?: string;
device?: string;
screen?: string;
language?: string;
country?: string;
subdivision1?: string;
subdivision2?: string;
city?: string;
}) {
const {
websiteId,
id: sessionId,