fix issues in core
This commit is contained in:
@@ -31,17 +31,28 @@ export class RecordPageViewUseCase implements UseCase<RecordPageViewInput, void,
|
||||
|
||||
async execute(input: RecordPageViewInput): Promise<Result<void, ApplicationErrorCode<RecordPageViewErrorCode, { message: string }>>> {
|
||||
try {
|
||||
const pageView = PageView.create({
|
||||
const props = {
|
||||
id: crypto.randomUUID(),
|
||||
entityType: input.entityType,
|
||||
entityId: input.entityId,
|
||||
visitorId: input.visitorId,
|
||||
visitorType: input.visitorType,
|
||||
sessionId: input.sessionId,
|
||||
referrer: input.referrer,
|
||||
userAgent: input.userAgent,
|
||||
country: input.country,
|
||||
});
|
||||
} 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;
|
||||
}
|
||||
|
||||
const pageView = PageView.create(props);
|
||||
|
||||
await this.pageViewRepository.save(pageView);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user