update packages

This commit is contained in:
Sylvain Briat
2024-01-17 08:54:41 +01:00
parent 957eb93f3e
commit d47de20588
12 changed files with 2742 additions and 1813 deletions

View File

@@ -1,7 +1,4 @@
import {
ConfigurationDomainGet,
ConfigurationType,
} from '@mobicoop/configuration-module';
import { KeyType, Type } from '@mobicoop/configuration-module';
export const CARPOOL_CONFIG_ROLE = 'role';
export const CARPOOL_CONFIG_SEATS_PROPOSED = 'seatsProposed';
@@ -9,25 +6,25 @@ export const CARPOOL_CONFIG_SEATS_REQUESTED = 'seatsRequested';
export const CARPOOL_CONFIG_DEPARTURE_TIME_MARGIN = 'departureTimeMargin';
export const CARPOOL_CONFIG_STRICT_FREQUENCY = 'strictFrequency';
export const CarpoolConfig: ConfigurationDomainGet[] = [
export const CarpoolKeyTypes: KeyType[] = [
{
key: CARPOOL_CONFIG_ROLE,
type: ConfigurationType.STRING,
type: Type.STRING,
},
{
key: CARPOOL_CONFIG_SEATS_PROPOSED,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: CARPOOL_CONFIG_SEATS_REQUESTED,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: CARPOOL_CONFIG_DEPARTURE_TIME_MARGIN,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: CARPOOL_CONFIG_STRICT_FREQUENCY,
type: ConfigurationType.BOOLEAN,
type: Type.BOOLEAN,
},
];

View File

@@ -17,7 +17,7 @@ import { Paginator } from '@mobicoop/ddd-library';
import { MatchingEntity } from '@modules/ad/core/domain/matching.entity';
import { MatchingRepositoryPort } from '../../ports/matching.repository.port';
import {
ConfigurationDomain,
Domain,
Configurator,
GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module';
@@ -27,7 +27,7 @@ import {
CARPOOL_CONFIG_SEATS_PROPOSED,
CARPOOL_CONFIG_SEATS_REQUESTED,
CARPOOL_CONFIG_STRICT_FREQUENCY,
CarpoolConfig,
CarpoolKeyTypes,
} from '@modules/ad/ad.constants';
import {
MATCH_CONFIG_ALGORITHM,
@@ -57,18 +57,12 @@ export class MatchQueryHandler implements IQueryHandler {
execute = async (query: MatchQuery): Promise<MatchingResult> => {
const carpoolConfigurator: Configurator =
await this.configurationRepository.mget(
ConfigurationDomain.CARPOOL,
CarpoolConfig,
);
await this.configurationRepository.mget(Domain.CARPOOL, CarpoolKeyTypes);
const matchConfigurator: Configurator =
await this.configurationRepository.mget(
ConfigurationDomain.MATCH,
MatchConfig,
);
await this.configurationRepository.mget(Domain.MATCH, MatchConfig);
const paginationConfigurator: Configurator =
await this.configurationRepository.mget(
ConfigurationDomain.PAGINATION,
Domain.PAGINATION,
PaginationConfig,
);
query

View File

@@ -1,7 +1,4 @@
import {
ConfigurationDomainGet,
ConfigurationType,
} from '@mobicoop/configuration-module';
import { KeyType, Type } from '@mobicoop/configuration-module';
export const MATCH_CONFIG_ALGORITHM = 'algorithm';
export const MATCH_CONFIG_REMOTENESS = 'remoteness';
@@ -13,44 +10,44 @@ export const MATCH_CONFIG_MAX_DETOUR_DISTANCE_RATIO = 'maxDetourDistanceRatio';
export const MATCH_CONFIG_MAX_DETOUR_DURATION_RATIO = 'maxDetourDurationRatio';
export const PAGINATION_CONFIG_PER_PAGE = 'perPage';
export const MatchConfig: ConfigurationDomainGet[] = [
export const MatchConfig: KeyType[] = [
{
key: MATCH_CONFIG_ALGORITHM,
type: ConfigurationType.STRING,
type: Type.STRING,
},
{
key: MATCH_CONFIG_REMOTENESS,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: MATCH_CONFIG_USE_PROPORTION,
type: ConfigurationType.BOOLEAN,
type: Type.BOOLEAN,
},
{
key: MATCH_CONFIG_PROPORTION,
type: ConfigurationType.FLOAT,
type: Type.FLOAT,
},
{
key: MATCH_CONFIG_USE_AZIMUTH,
type: ConfigurationType.BOOLEAN,
type: Type.BOOLEAN,
},
{
key: MATCH_CONFIG_AZIMUTH_MARGIN,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: MATCH_CONFIG_MAX_DETOUR_DISTANCE_RATIO,
type: ConfigurationType.FLOAT,
type: Type.FLOAT,
},
{
key: MATCH_CONFIG_MAX_DETOUR_DURATION_RATIO,
type: ConfigurationType.FLOAT,
type: Type.FLOAT,
},
];
export const PaginationConfig: ConfigurationDomainGet[] = [
export const PaginationConfig: KeyType[] = [
{
key: PAGINATION_CONFIG_PER_PAGE,
type: ConfigurationType.INT,
type: Type.INT,
},
];

View File

@@ -54,6 +54,7 @@ const mockAdRepository: AdRepositoryPort = {
findOneById: jest.fn(),
findOne: jest.fn(),
findAll: jest.fn(),
findAllByIds: jest.fn(),
insert: jest.fn(),
update: jest.fn(),
updateWhere: jest.fn(),

View File

@@ -1,6 +1,6 @@
import {
ConfigurationDomain,
ConfigurationDomainGet,
Domain,
KeyType,
Configurator,
GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module';
@@ -258,83 +258,83 @@ const mockConfigurationRepository: GetConfigurationRepositoryPort = {
get: jest.fn(),
mget: jest.fn().mockImplementation(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(domain: ConfigurationDomain, configs: ConfigurationDomainGet[]) => {
(domain: Domain, keyTypes: KeyType[]) => {
switch (domain) {
case ConfigurationDomain.CARPOOL:
return new Configurator(ConfigurationDomain.CARPOOL, [
case Domain.CARPOOL:
return new Configurator(Domain.CARPOOL, [
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_DEPARTURE_TIME_MARGIN,
value: 900,
},
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_ROLE,
value: 'passenger',
},
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_SEATS_PROPOSED,
value: 3,
},
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_SEATS_REQUESTED,
value: 1,
},
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_STRICT_FREQUENCY,
value: false,
},
]);
case ConfigurationDomain.MATCH:
return new Configurator(ConfigurationDomain.MATCH, [
case Domain.MATCH:
return new Configurator(Domain.MATCH, [
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_ALGORITHM,
value: 'PASSENGER_ORIENTED',
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_REMOTENESS,
value: 15000,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_USE_PROPORTION,
value: true,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_PROPORTION,
value: 0.3,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_USE_AZIMUTH,
value: true,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_AZIMUTH_MARGIN,
value: 10,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_MAX_DETOUR_DISTANCE_RATIO,
value: 0.3,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_MAX_DETOUR_DURATION_RATIO,
value: 0.3,
},
]);
case ConfigurationDomain.PAGINATION:
return new Configurator(ConfigurationDomain.PAGINATION, [
case Domain.PAGINATION:
return new Configurator(Domain.PAGINATION, [
{
domain: ConfigurationDomain.PAGINATION,
domain: Domain.PAGINATION,
key: PAGINATION_CONFIG_PER_PAGE,
value: 10,
},

View File

@@ -55,6 +55,7 @@ const mockMatcherRepository: AdRepositoryPort = {
findOneById: jest.fn(),
findOne: jest.fn(),
findAll: jest.fn(),
findAllByIds: jest.fn(),
insert: jest.fn(),
update: jest.fn(),
updateWhere: jest.fn(),

View File

@@ -100,6 +100,7 @@ const mockMatcherRepository: AdRepositoryPort = {
findOneById: jest.fn(),
findOne: jest.fn(),
findAll: jest.fn(),
findAllByIds: jest.fn(),
insert: jest.fn(),
update: jest.fn(),
updateWhere: jest.fn(),

View File

@@ -1,18 +1,15 @@
import {
ConfigurationDomainGet,
ConfigurationType,
} from '@mobicoop/configuration-module';
import { KeyType, Type } from '@mobicoop/configuration-module';
export const GEOGRAPHY_CONFIG_GEOROUTER_TYPE = 'georouterType';
export const GEOGRAPHY_CONFIG_GEOROUTER_URL = 'georouterUrl';
export const GeographyConfig: ConfigurationDomainGet[] = [
export const GeographyKeyTypes: KeyType[] = [
{
key: GEOGRAPHY_CONFIG_GEOROUTER_TYPE,
type: ConfigurationType.STRING,
type: Type.STRING,
},
{
key: GEOGRAPHY_CONFIG_GEOROUTER_URL,
type: ConfigurationType.STRING,
type: Type.STRING,
},
];

View File

@@ -15,13 +15,13 @@ import {
} from '../core/domain/route.errors';
import { GeodesicPort } from '../core/application/ports/geodesic.port';
import {
ConfigurationDomain,
Domain,
Configurator,
GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module';
import {
GEOGRAPHY_CONFIG_GEOROUTER_URL,
GeographyConfig,
GeographyKeyTypes,
} from '../geography.constants';
@Injectable()
@@ -42,8 +42,8 @@ export class GraphhopperGeorouter implements GeorouterPort {
): Promise<Route> => {
const geographyConfigurator: Configurator =
await this.configurationRepository.mget(
ConfigurationDomain.GEOGRAPHY,
GeographyConfig,
Domain.GEOGRAPHY,
GeographyKeyTypes,
);
this.url = [
geographyConfigurator.get<string>(GEOGRAPHY_CONFIG_GEOROUTER_URL),

View File

@@ -1,6 +1,6 @@
import {
ConfigurationDomain,
ConfigurationDomainGet,
Domain,
KeyType,
Configurator,
GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module';
@@ -272,12 +272,12 @@ const mockConfigurationRepository: GetConfigurationRepositoryPort = {
get: jest.fn(),
mget: jest.fn().mockImplementation(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(domain: ConfigurationDomain, configs: ConfigurationDomainGet[]) => {
(domain: Domain, keyTypes: KeyType[]) => {
switch (domain) {
case ConfigurationDomain.GEOGRAPHY:
return new Configurator(ConfigurationDomain.GEOGRAPHY, [
case Domain.GEOGRAPHY:
return new Configurator(Domain.GEOGRAPHY, [
{
domain: ConfigurationDomain.GEOGRAPHY,
domain: Domain.GEOGRAPHY,
key: GEOGRAPHY_CONFIG_GEOROUTER_URL,
value: 'http://localhost:8989',
},