website refactor
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import 'reflect-metadata';
|
||||
|
||||
import { EngagementAction, EngagementEntityType } from '@core/analytics/domain/types/EngagementEvent';
|
||||
import { EntityType, VisitorType } from '@core/analytics/domain/types/PageView';
|
||||
import { Reflector } from '@nestjs/core';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import type { Response } from 'express';
|
||||
import request from 'supertest';
|
||||
import { vi } from 'vitest';
|
||||
import { AnalyticsController } from './AnalyticsController';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
import type { Response } from 'express';
|
||||
import { EntityType, VisitorType } from '@core/analytics/domain/types/PageView';
|
||||
import { EngagementAction, EngagementEntityType } from '@core/analytics/domain/types/EngagementEvent';
|
||||
import type { RecordEngagementOutputDTO } from './dtos/RecordEngagementOutputDTO';
|
||||
import type { RecordPageViewOutputDTO } from './dtos/RecordPageViewOutputDTO';
|
||||
import { AuthenticationGuard } from '../auth/AuthenticationGuard';
|
||||
import { AuthorizationGuard } from '../auth/AuthorizationGuard';
|
||||
import type { AuthorizationService } from '../auth/AuthorizationService';
|
||||
import { FeatureAvailabilityGuard } from '../policy/FeatureAvailabilityGuard';
|
||||
import type { PolicyService, PolicySnapshot } from '../policy/PolicyService';
|
||||
import { AnalyticsController } from './AnalyticsController';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
import type { RecordEngagementOutputDTO } from './dtos/RecordEngagementOutputDTO';
|
||||
import type { RecordPageViewOutputDTO } from './dtos/RecordPageViewOutputDTO';
|
||||
|
||||
describe('AnalyticsController', () => {
|
||||
let controller: AnalyticsController;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Controller, Get, Post, Body, Res, HttpStatus, Inject } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiBody, ApiResponse } from '@nestjs/swagger';
|
||||
import { Body, Controller, Get, HttpStatus, Inject, Post, Res } from '@nestjs/common';
|
||||
import { ApiBody, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||
import type { Response } from 'express';
|
||||
import { Public } from '../auth/Public';
|
||||
import { RecordPageViewInputDTO } from './dtos/RecordPageViewInputDTO';
|
||||
import { RecordPageViewOutputDTO } from './dtos/RecordPageViewOutputDTO';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
import { GetAnalyticsMetricsOutputDTO } from './dtos/GetAnalyticsMetricsOutputDTO';
|
||||
import { GetDashboardDataOutputDTO } from './dtos/GetDashboardDataOutputDTO';
|
||||
import { RecordEngagementInputDTO } from './dtos/RecordEngagementInputDTO';
|
||||
import { RecordEngagementOutputDTO } from './dtos/RecordEngagementOutputDTO';
|
||||
import { GetDashboardDataOutputDTO } from './dtos/GetDashboardDataOutputDTO';
|
||||
import { GetAnalyticsMetricsOutputDTO } from './dtos/GetAnalyticsMetricsOutputDTO';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
import { RecordPageViewInputDTO } from './dtos/RecordPageViewInputDTO';
|
||||
import { RecordPageViewOutputDTO } from './dtos/RecordPageViewOutputDTO';
|
||||
|
||||
type RecordPageViewInput = RecordPageViewInputDTO;
|
||||
type RecordEngagementInput = RecordEngagementInputDTO;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { AnalyticsModule } from './AnalyticsModule';
|
||||
import { AnalyticsController } from './AnalyticsController';
|
||||
import { AnalyticsModule } from './AnalyticsModule';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
|
||||
describe('AnalyticsModule', () => {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Module } from '@nestjs/common';
|
||||
|
||||
import { AnalyticsPersistenceModule } from '../../persistence/analytics/AnalyticsPersistenceModule';
|
||||
import { AnalyticsController } from './AnalyticsController';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
import { AnalyticsProviders } from './AnalyticsProviders';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
|
||||
@Module({
|
||||
imports: [AnalyticsPersistenceModule],
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
import { RecordPageViewPresenter } from './presenters/RecordPageViewPresenter';
|
||||
import { RecordEngagementPresenter } from './presenters/RecordEngagementPresenter';
|
||||
import { GetDashboardDataPresenter } from './presenters/GetDashboardDataPresenter';
|
||||
import { GetAnalyticsMetricsPresenter } from './presenters/GetAnalyticsMetricsPresenter';
|
||||
import { GetDashboardDataPresenter } from './presenters/GetDashboardDataPresenter';
|
||||
import { RecordEngagementPresenter } from './presenters/RecordEngagementPresenter';
|
||||
import { RecordPageViewPresenter } from './presenters/RecordPageViewPresenter';
|
||||
|
||||
describe('AnalyticsService', () => {
|
||||
it('recordPageView returns presenter response on success', async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsOptional, IsEnum, IsObject } from 'class-validator';
|
||||
import { EngagementAction, EngagementEntityType } from '@core/analytics/domain/types/EngagementEvent';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsEnum, IsObject, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class RecordEngagementInputDTO {
|
||||
@ApiProperty({ enum: EngagementAction })
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber } from 'class-validator';
|
||||
import { IsNumber, IsString } from 'class-validator';
|
||||
|
||||
export class RecordEngagementOutputDTO {
|
||||
@ApiProperty()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsOptional, IsEnum } from 'class-validator';
|
||||
import { EntityType, VisitorType } from '@core/analytics/domain/types/PageView';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class RecordPageViewInputDTO {
|
||||
@ApiProperty({ enum: EntityType })
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { GetAnalyticsMetricsPresenter } from './GetAnalyticsMetricsPresenter';
|
||||
import type { GetAnalyticsMetricsOutput } from '@core/analytics/application/use-cases/GetAnalyticsMetricsUseCase';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import { GetAnalyticsMetricsPresenter } from './GetAnalyticsMetricsPresenter';
|
||||
|
||||
describe('GetAnalyticsMetricsPresenter', () => {
|
||||
let presenter: GetAnalyticsMetricsPresenter;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { GetDashboardDataPresenter } from './GetDashboardDataPresenter';
|
||||
import type { GetDashboardDataOutput } from '@core/analytics/application/use-cases/GetDashboardDataUseCase';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import { GetDashboardDataPresenter } from './GetDashboardDataPresenter';
|
||||
|
||||
describe('GetDashboardDataPresenter', () => {
|
||||
let presenter: GetDashboardDataPresenter;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { RecordEngagementPresenter } from './RecordEngagementPresenter';
|
||||
import type { RecordEngagementOutput } from '@core/analytics/application/use-cases/RecordEngagementUseCase';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import { RecordEngagementPresenter } from './RecordEngagementPresenter';
|
||||
|
||||
describe('RecordEngagementPresenter', () => {
|
||||
let presenter: RecordEngagementPresenter;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { RecordPageViewPresenter } from './RecordPageViewPresenter';
|
||||
import type { RecordPageViewOutput } from '@core/analytics/application/use-cases/RecordPageViewUseCase';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import { RecordPageViewPresenter } from './RecordPageViewPresenter';
|
||||
|
||||
describe('RecordPageViewPresenter', () => {
|
||||
let presenter: RecordPageViewPresenter;
|
||||
|
||||
Reference in New Issue
Block a user