fix issues in core

This commit is contained in:
2025-12-23 15:38:50 +01:00
parent df5c20c5cc
commit 120d3bb1a1
125 changed files with 1005 additions and 793 deletions

View File

@@ -31,26 +31,19 @@ export class RecordPageViewUseCase implements UseCase<RecordPageViewInput, void,
async execute(input: RecordPageViewInput): Promise<Result<void, ApplicationErrorCode<RecordPageViewErrorCode, { message: string }>>> {
try {
const props = {
type PageViewCreateProps = Parameters<(typeof PageView)['create']>[0];
const props: PageViewCreateProps = {
id: crypto.randomUUID(),
entityType: input.entityType,
entityId: input.entityId,
visitorType: input.visitorType,
sessionId: input.sessionId,
} as any;
if (input.visitorId !== undefined) {
props.visitorId = input.visitorId;
}
if (input.referrer !== undefined) {
props.referrer = input.referrer;
}
if (input.userAgent !== undefined) {
props.userAgent = input.userAgent;
}
if (input.country !== undefined) {
props.country = input.country;
}
...(input.visitorId !== undefined ? { visitorId: input.visitorId } : {}),
...(input.referrer !== undefined ? { referrer: input.referrer } : {}),
...(input.userAgent !== undefined ? { userAgent: input.userAgent } : {}),
...(input.country !== undefined ? { country: input.country } : {}),
};
const pageView = PageView.create(props);