fix issues in core
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user