mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 14:47:14 +01:00
Fixed uuid references in schemas.
Some checks are pending
Node.js CI / build (postgresql, 18.18) (push) Waiting to run
Some checks are pending
Node.js CI / build (postgresql, 18.18) (push) Waiting to run
This commit is contained in:
parent
f40e1b44f3
commit
303947fe9b
16 changed files with 36 additions and 27 deletions
|
|
@ -19,8 +19,14 @@ export function checkPassword(password: string, passwordHash: string) {
|
|||
return bcrypt.compareSync(password, passwordHash);
|
||||
}
|
||||
|
||||
export function getBearerToken(request: Request) {
|
||||
const auth = request.headers.get('authorization');
|
||||
|
||||
return auth?.split(' ')[1];
|
||||
}
|
||||
|
||||
export async function checkAuth(request: Request) {
|
||||
const token = request.headers.get('authorization')?.split(' ')?.[1];
|
||||
const token = getBearerToken(request);
|
||||
const payload = parseSecureToken(token, secret());
|
||||
const shareToken = await parseShareToken(request.headers);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { z } from 'zod';
|
||||
import { checkAuth } from '@/lib/auth';
|
||||
import { DEFAULT_PAGE_SIZE, FILTER_COLUMNS } from '@/lib/constants';
|
||||
import { getAllowedUnits, getMinimumUnit, maxDate, parseDateRange } from '@/lib/date';
|
||||
|
|
@ -5,7 +6,6 @@ import { fetchWebsite } from '@/lib/load';
|
|||
import { badRequest, unauthorized } from '@/lib/response';
|
||||
import { QueryFilters } from '@/lib/types';
|
||||
import { getWebsiteSegment } from '@/queries';
|
||||
import { z } from 'zod/v4';
|
||||
import { filtersArrayToObject } from '@/lib/params';
|
||||
|
||||
export async function parseRequest(
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ export const filterParams = {
|
|||
hostname: z.string().optional(),
|
||||
language: z.string().optional(),
|
||||
event: z.string().optional(),
|
||||
segment: z.string().uuid().optional(),
|
||||
cohort: z.string().uuid().optional(),
|
||||
segment: z.uuid().optional(),
|
||||
cohort: z.uuid().optional(),
|
||||
eventType: z.coerce.number().int().positive().optional(),
|
||||
};
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ export const breakdownReportSchema = z.object({
|
|||
});
|
||||
|
||||
export const reportBaseSchema = z.object({
|
||||
websiteId: z.string().uuid(),
|
||||
websiteId: z.uuid(),
|
||||
type: reportTypeParam,
|
||||
name: z.string().max(200),
|
||||
description: z.string().max(500).optional(),
|
||||
|
|
@ -220,7 +220,7 @@ export const reportSchema = reportBaseSchema;
|
|||
|
||||
export const reportResultSchema = z.intersection(
|
||||
z.object({
|
||||
websiteId: z.string().uuid(),
|
||||
websiteId: z.uuid(),
|
||||
filters: z.object({ ...filterParams }),
|
||||
}),
|
||||
reportTypeSchema,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue