website refactor
This commit is contained in:
@@ -4,14 +4,14 @@ import { Reflector } from '@nestjs/core';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import request from 'supertest';
|
||||
import { vi } from 'vitest';
|
||||
import { DashboardController } from './DashboardController';
|
||||
import { DashboardOverviewDTO } from './dtos/DashboardOverviewDTO';
|
||||
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 { DashboardController } from './DashboardController';
|
||||
import { DashboardService } from './DashboardService';
|
||||
import { DashboardOverviewDTO } from './dtos/DashboardOverviewDTO';
|
||||
|
||||
describe('DashboardController', () => {
|
||||
let controller: DashboardController;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Controller, Get, Query, Req, UnauthorizedException, Inject } from '@nestjs/common';
|
||||
import { ApiTags, ApiResponse, ApiOperation, ApiQuery } from '@nestjs/swagger';
|
||||
import { Controller, Get, Inject, Query, Req, UnauthorizedException } from '@nestjs/common';
|
||||
import { ApiOperation, ApiQuery, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||
import { DashboardService } from './DashboardService';
|
||||
import { DashboardOverviewDTO } from './dtos/DashboardOverviewDTO';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { DashboardModule } from './DashboardModule';
|
||||
import { DashboardController } from './DashboardController';
|
||||
import { DashboardModule } from './DashboardModule';
|
||||
import { DashboardService } from './DashboardService';
|
||||
import { DashboardOverviewPresenter } from './presenters/DashboardOverviewPresenter';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { RacingPersistenceModule } from '../../persistence/racing/RacingPersistenceModule';
|
||||
import { SocialPersistenceModule } from '../../persistence/social/SocialPersistenceModule';
|
||||
import { DashboardService } from './DashboardService';
|
||||
import { DashboardController } from './DashboardController';
|
||||
import { DashboardProviders } from './DashboardProviders';
|
||||
import { DashboardService } from './DashboardService';
|
||||
|
||||
@Module({
|
||||
imports: [RacingPersistenceModule, SocialPersistenceModule],
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
import { Provider } from '@nestjs/common';
|
||||
|
||||
// Import core interfaces
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import { IDriverRepository } from '@core/racing/domain/repositories/DriverRepository';
|
||||
import { ILeagueMembershipRepository } from '@core/racing/domain/repositories/LeagueMembershipRepository';
|
||||
import { ILeagueRepository } from '@core/racing/domain/repositories/LeagueRepository';
|
||||
import { IRaceRegistrationRepository } from '@core/racing/domain/repositories/RaceRegistrationRepository';
|
||||
import { IRaceRepository } from '@core/racing/domain/repositories/RaceRepository';
|
||||
import { IResultRepository } from '@core/racing/domain/repositories/ResultRepository';
|
||||
import { ILeagueRepository } from '@core/racing/domain/repositories/LeagueRepository';
|
||||
import { IStandingRepository } from '@core/racing/domain/repositories/StandingRepository';
|
||||
import { ILeagueMembershipRepository } from '@core/racing/domain/repositories/LeagueMembershipRepository';
|
||||
import { IRaceRegistrationRepository } from '@core/racing/domain/repositories/RaceRegistrationRepository';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import { IFeedRepository } from '@core/social/domain/repositories/FeedRepository';
|
||||
import { ISocialGraphRepository } from '@core/social/domain/repositories/SocialGraphRepository';
|
||||
|
||||
import { SOCIAL_FEED_REPOSITORY_TOKEN, SOCIAL_GRAPH_REPOSITORY_TOKEN } from '../../persistence/social/SocialPersistenceTokens';
|
||||
import { ImageServicePort } from '@core/media/application/ports/ImageServicePort';
|
||||
import { DashboardOverviewUseCase } from '@core/racing/application/use-cases/DashboardOverviewUseCase';
|
||||
import { SOCIAL_FEED_REPOSITORY_TOKEN, SOCIAL_GRAPH_REPOSITORY_TOKEN } from '../../persistence/social/SocialPersistenceTokens';
|
||||
|
||||
// Import concrete implementations
|
||||
import { ConsoleLogger } from '@adapters/logging/ConsoleLogger';
|
||||
import { InMemoryImageServiceAdapter } from '@adapters/media/ports/InMemoryImageServiceAdapter';
|
||||
import { DashboardOverviewPresenter } from './presenters/DashboardOverviewPresenter';
|
||||
import {
|
||||
DASHBOARD_OVERVIEW_USE_CASE_TOKEN,
|
||||
DRIVER_REPOSITORY_TOKEN,
|
||||
IMAGE_SERVICE_TOKEN,
|
||||
LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN,
|
||||
LEAGUE_REPOSITORY_TOKEN,
|
||||
LOGGER_TOKEN,
|
||||
RACE_REGISTRATION_REPOSITORY_TOKEN,
|
||||
RACE_REPOSITORY_TOKEN,
|
||||
RESULT_REPOSITORY_TOKEN,
|
||||
STANDING_REPOSITORY_TOKEN,
|
||||
DASHBOARD_OVERVIEW_USE_CASE_TOKEN,
|
||||
DRIVER_REPOSITORY_TOKEN,
|
||||
IMAGE_SERVICE_TOKEN,
|
||||
LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN,
|
||||
LEAGUE_REPOSITORY_TOKEN,
|
||||
LOGGER_TOKEN,
|
||||
RACE_REGISTRATION_REPOSITORY_TOKEN,
|
||||
RACE_REPOSITORY_TOKEN,
|
||||
RESULT_REPOSITORY_TOKEN,
|
||||
STANDING_REPOSITORY_TOKEN,
|
||||
} from './DashboardTokens';
|
||||
import { DashboardOverviewPresenter } from './presenters/DashboardOverviewPresenter';
|
||||
|
||||
// Re-export tokens for convenience (legacy imports)
|
||||
export {
|
||||
DASHBOARD_OVERVIEW_USE_CASE_TOKEN,
|
||||
DRIVER_REPOSITORY_TOKEN,
|
||||
IMAGE_SERVICE_TOKEN,
|
||||
LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN,
|
||||
LEAGUE_REPOSITORY_TOKEN,
|
||||
LOGGER_TOKEN,
|
||||
RACE_REGISTRATION_REPOSITORY_TOKEN,
|
||||
RACE_REPOSITORY_TOKEN,
|
||||
RESULT_REPOSITORY_TOKEN,
|
||||
STANDING_REPOSITORY_TOKEN,
|
||||
DASHBOARD_OVERVIEW_USE_CASE_TOKEN,
|
||||
DRIVER_REPOSITORY_TOKEN,
|
||||
IMAGE_SERVICE_TOKEN,
|
||||
LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN,
|
||||
LEAGUE_REPOSITORY_TOKEN,
|
||||
LOGGER_TOKEN,
|
||||
RACE_REGISTRATION_REPOSITORY_TOKEN,
|
||||
RACE_REPOSITORY_TOKEN,
|
||||
RESULT_REPOSITORY_TOKEN,
|
||||
STANDING_REPOSITORY_TOKEN
|
||||
} from './DashboardTokens';
|
||||
|
||||
export const DashboardProviders: Provider[] = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { DashboardService } from './DashboardService';
|
||||
|
||||
describe('DashboardService', () => {
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
// Tokens (standalone to avoid circular imports)
|
||||
import {
|
||||
DASHBOARD_OVERVIEW_USE_CASE_TOKEN,
|
||||
LOGGER_TOKEN,
|
||||
DASHBOARD_OVERVIEW_USE_CASE_TOKEN,
|
||||
LOGGER_TOKEN,
|
||||
} from './DashboardTokens';
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber, IsOptional } from 'class-validator';
|
||||
import { IsNumber, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class DashboardDriverSummaryDTO {
|
||||
@ApiProperty()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsOptional } from 'class-validator';
|
||||
import { IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export type DashboardFeedItemType =
|
||||
| 'friend-joined-league'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber } from 'class-validator';
|
||||
import { IsNumber, IsString } from 'class-validator';
|
||||
|
||||
export class DashboardLeagueStandingSummaryDTO {
|
||||
@ApiProperty()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber, IsOptional, IsBoolean, IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsArray, IsBoolean, IsNumber, IsOptional, IsString, ValidateNested } from 'class-validator';
|
||||
|
||||
export class DashboardDriverSummaryDTO {
|
||||
@ApiProperty()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsBoolean } from 'class-validator';
|
||||
import { IsBoolean, IsString } from 'class-validator';
|
||||
|
||||
export class DashboardRaceSummaryDTO {
|
||||
@ApiProperty()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber } from 'class-validator';
|
||||
import { IsNumber, IsString } from 'class-validator';
|
||||
|
||||
export class DashboardRecentResultDTO {
|
||||
@ApiProperty()
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type {
|
||||
DashboardOverviewResult,
|
||||
DashboardOverviewResult,
|
||||
} from '@core/racing/application/use-cases/DashboardOverviewUseCase';
|
||||
import {
|
||||
DashboardOverviewDTO,
|
||||
DashboardDriverSummaryDTO,
|
||||
DashboardRaceSummaryDTO,
|
||||
DashboardRecentResultDTO,
|
||||
DashboardLeagueStandingSummaryDTO,
|
||||
DashboardFeedSummaryDTO,
|
||||
DashboardFeedItemSummaryDTO,
|
||||
DashboardFriendSummaryDTO,
|
||||
DashboardDriverSummaryDTO,
|
||||
DashboardFeedItemSummaryDTO,
|
||||
DashboardFeedSummaryDTO,
|
||||
DashboardFriendSummaryDTO,
|
||||
DashboardLeagueStandingSummaryDTO,
|
||||
DashboardOverviewDTO,
|
||||
DashboardRaceSummaryDTO,
|
||||
DashboardRecentResultDTO,
|
||||
} from '../dtos/DashboardOverviewDTO';
|
||||
|
||||
export class DashboardOverviewPresenter {
|
||||
|
||||
Reference in New Issue
Block a user