refactor
This commit is contained in:
parent
dd957763a3
commit
a30b19e2f3
|
@ -1,6 +1,6 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { IDefaultParams } from '../../domain/interfaces/default-params.type';
|
import { IDefaultParams } from '../../domain/types/default-params.type';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DefaultParamsProvider {
|
export class DefaultParamsProvider {
|
||||||
|
|
|
@ -10,10 +10,10 @@ import {
|
||||||
Min,
|
Min,
|
||||||
} from 'class-validator';
|
} from 'class-validator';
|
||||||
import { AutoMap } from '@automapper/classes';
|
import { AutoMap } from '@automapper/classes';
|
||||||
import { Point } from '../entities/point.type';
|
import { Point } from '../types/point.type';
|
||||||
import { Schedule } from '../entities/schedule.type';
|
import { Schedule } from '../types/schedule.type';
|
||||||
import { MarginDurations } from '../entities/margin-durations.type';
|
import { MarginDurations } from '../types/margin-durations.type';
|
||||||
import { Algorithm } from './algorithm.enum';
|
import { Algorithm } from '../types/algorithm.enum';
|
||||||
import { IRequestTime } from '../interfaces/time-request.interface';
|
import { IRequestTime } from '../interfaces/time-request.interface';
|
||||||
import { IRequestPerson } from '../interfaces/person-request.interface';
|
import { IRequestPerson } from '../interfaces/person-request.interface';
|
||||||
import { IRequestGeography } from '../interfaces/geography-request.interface';
|
import { IRequestGeography } from '../interfaces/geography-request.interface';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Algorithm } from '../dtos/algorithm.enum';
|
|
||||||
import { IRequestAlgorithmSettings } from '../interfaces/algorithm-settings-request.interface';
|
import { IRequestAlgorithmSettings } from '../interfaces/algorithm-settings-request.interface';
|
||||||
import { DefaultAlgorithmSettings } from '../interfaces/default-algorithm-settings.type';
|
import { DefaultAlgorithmSettings } from '../types/default-algorithm-settings.type';
|
||||||
import { TimingFrequency } from './timing';
|
import { Algorithm } from '../types/algorithm.enum';
|
||||||
|
import { TimingFrequency } from '../types/timing';
|
||||||
|
|
||||||
export class AlgorithmSettings {
|
export class AlgorithmSettings {
|
||||||
_algorithmSettingsRequest: IRequestAlgorithmSettings;
|
_algorithmSettingsRequest: IRequestAlgorithmSettings;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { MatcherException } from '../../exceptions/matcher.exception';
|
import { MatcherException } from '../../exceptions/matcher.exception';
|
||||||
import { IRequestGeography } from '../interfaces/geography-request.interface';
|
import { IRequestGeography } from '../interfaces/geography-request.interface';
|
||||||
import { PointType } from './geography.enum';
|
import { PointType } from '../types/geography.enum';
|
||||||
import { Point } from './point.type';
|
import { Point } from '../types/point.type';
|
||||||
import { Route } from './route';
|
import { Route } from './route';
|
||||||
import { find } from 'geo-tz';
|
import { find } from 'geo-tz';
|
||||||
import { Waypoint } from './waypoint';
|
import { Waypoint } from '../types/waypoint';
|
||||||
|
|
||||||
export class Geography {
|
export class Geography {
|
||||||
_geographyRequest: IRequestGeography;
|
_geographyRequest: IRequestGeography;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { MatcherException } from '../../exceptions/matcher.exception';
|
import { MatcherException } from '../../exceptions/matcher.exception';
|
||||||
import { MarginDurations } from './margin-durations.type';
|
import { MarginDurations } from '../types/margin-durations.type';
|
||||||
import { IRequestTime } from '../interfaces/time-request.interface';
|
import { IRequestTime } from '../interfaces/time-request.interface';
|
||||||
import { TimingDays, TimingFrequency, Days } from './timing';
|
import { TimingDays, TimingFrequency, Days } from '../types/timing';
|
||||||
import { Schedule } from './schedule.type';
|
import { Schedule } from '../types/schedule.type';
|
||||||
|
|
||||||
export class Time {
|
export class Time {
|
||||||
_timeRequest: IRequestTime;
|
_timeRequest: IRequestTime;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Algorithm } from '../dtos/algorithm.enum';
|
import { Algorithm } from '../types/algorithm.enum';
|
||||||
|
|
||||||
export interface IRequestAlgorithmSettings {
|
export interface IRequestAlgorithmSettings {
|
||||||
algorithm: Algorithm;
|
algorithm: Algorithm;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Point } from '../entities/point.type';
|
import { Point } from '../types/point.type';
|
||||||
|
|
||||||
export interface IRequestGeography {
|
export interface IRequestGeography {
|
||||||
waypoints: Array<Point>;
|
waypoints: Array<Point>;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { MarginDurations } from '../entities/margin-durations.type';
|
import { MarginDurations } from '../types/margin-durations.type';
|
||||||
import { Schedule } from '../entities/schedule.type';
|
import { Schedule } from '../types/schedule.type';
|
||||||
|
|
||||||
export interface IRequestTime {
|
export interface IRequestTime {
|
||||||
departure?: string;
|
departure?: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Person } from './person';
|
import { Person } from '../entities/person';
|
||||||
import { Role } from './role.enum';
|
import { Role } from './role.enum';
|
||||||
import { Step } from './step.enum';
|
import { Step } from './step.enum';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Algorithm } from '../dtos/algorithm.enum';
|
import { Algorithm } from './algorithm.enum';
|
||||||
|
|
||||||
export type DefaultAlgorithmSettings = {
|
export type DefaultAlgorithmSettings = {
|
||||||
algorithm: Algorithm;
|
algorithm: Algorithm;
|
|
@ -1,4 +1,4 @@
|
||||||
import { Actor } from './actor';
|
import { Actor } from './actor.type.';
|
||||||
import { Point } from './point.type';
|
import { Point } from './point.type';
|
||||||
|
|
||||||
export type Waypoint = {
|
export type Waypoint = {
|
|
@ -2,10 +2,10 @@ import { MatchRequest } from '../domain/dtos/match.request';
|
||||||
import { Geography } from '../domain/entities/geography';
|
import { Geography } from '../domain/entities/geography';
|
||||||
import { Person } from '../domain/entities/person';
|
import { Person } from '../domain/entities/person';
|
||||||
import { Requirement } from '../domain/entities/requirement';
|
import { Requirement } from '../domain/entities/requirement';
|
||||||
import { Role } from '../domain/entities/role.enum';
|
import { Role } from '../domain/types/role.enum';
|
||||||
import { AlgorithmSettings } from '../domain/entities/algorithm-settings';
|
import { AlgorithmSettings } from '../domain/entities/algorithm-settings';
|
||||||
import { Time } from '../domain/entities/time';
|
import { Time } from '../domain/entities/time';
|
||||||
import { IDefaultParams } from '../domain/interfaces/default-params.type';
|
import { IDefaultParams } from '../domain/types/default-params.type';
|
||||||
|
|
||||||
export class MatchQuery {
|
export class MatchQuery {
|
||||||
private readonly _matchRequest: MatchRequest;
|
private readonly _matchRequest: MatchRequest;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
import { DefaultParamsProvider } from '../../adapters/secondaries/default-params.provider';
|
import { DefaultParamsProvider } from '../../adapters/secondaries/default-params.provider';
|
||||||
import { IDefaultParams } from '../../domain/interfaces/default-params.type';
|
import { IDefaultParams } from '../../domain/types/default-params.type';
|
||||||
|
|
||||||
const mockConfigService = {
|
const mockConfigService = {
|
||||||
get: jest.fn().mockImplementationOnce(() => 99),
|
get: jest.fn().mockImplementationOnce(() => 99),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Algorithm } from '../../domain/dtos/algorithm.enum';
|
|
||||||
import { MatchRequest } from '../../domain/dtos/match.request';
|
import { MatchRequest } from '../../domain/dtos/match.request';
|
||||||
import { Role } from '../../domain/entities/role.enum';
|
import { Role } from '../../domain/types/role.enum';
|
||||||
import { TimingFrequency } from '../../domain/entities/timing';
|
import { TimingFrequency } from '../../domain/types/timing';
|
||||||
import { IDefaultParams } from '../../domain/interfaces/default-params.type';
|
import { IDefaultParams } from '../../domain/types/default-params.type';
|
||||||
import { MatchQuery } from '../../queries/match.query';
|
import { MatchQuery } from '../../queries/match.query';
|
||||||
|
import { Algorithm } from '../../domain/types/algorithm.enum';
|
||||||
|
|
||||||
const defaultParams: IDefaultParams = {
|
const defaultParams: IDefaultParams = {
|
||||||
DEFAULT_IDENTIFIER: 0,
|
DEFAULT_IDENTIFIER: 0,
|
||||||
|
|
|
@ -6,8 +6,8 @@ import { MatchQuery } from '../../queries/match.query';
|
||||||
import { AdRepository } from '../../adapters/secondaries/ad.repository';
|
import { AdRepository } from '../../adapters/secondaries/ad.repository';
|
||||||
import { AutomapperModule } from '@automapper/nestjs';
|
import { AutomapperModule } from '@automapper/nestjs';
|
||||||
import { classes } from '@automapper/classes';
|
import { classes } from '@automapper/classes';
|
||||||
import { IDefaultParams } from '../../domain/interfaces/default-params.type';
|
import { IDefaultParams } from '../../domain/types/default-params.type';
|
||||||
import { Algorithm } from '../../domain/dtos/algorithm.enum';
|
import { Algorithm } from '../../domain/types/algorithm.enum';
|
||||||
|
|
||||||
const mockAdRepository = {};
|
const mockAdRepository = {};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue