refactor
This commit is contained in:
parent
2c6e045841
commit
8d1d0f82cf
|
@ -31,7 +31,7 @@ import { TimeConverterPort } from './core/ports/time-converter.port';
|
|||
export class AdMapper
|
||||
implements Mapper<AdEntity, AdReadModel, AdWriteModel, AdResponseDto>
|
||||
{
|
||||
private readonly defaultParams: DefaultParams;
|
||||
private readonly _defaultParams: DefaultParams;
|
||||
|
||||
constructor(
|
||||
@Inject(PARAMS_PROVIDER)
|
||||
|
@ -41,7 +41,7 @@ export class AdMapper
|
|||
@Inject(TIME_CONVERTER)
|
||||
private readonly timeConverter: TimeConverterPort,
|
||||
) {
|
||||
this.defaultParams = defaultParamsProvider.getParams();
|
||||
this._defaultParams = defaultParamsProvider.getParams();
|
||||
}
|
||||
|
||||
toPersistence = (entity: AdEntity): AdWriteModel => {
|
||||
|
@ -50,7 +50,7 @@ export class AdMapper
|
|||
const timezone = this.timezoneFinder.timezones(
|
||||
lon,
|
||||
lat,
|
||||
this.defaultParams.DEFAULT_TIMEZONE,
|
||||
this._defaultParams.DEFAULT_TIMEZONE,
|
||||
)[0];
|
||||
const now = new Date();
|
||||
const record: AdWriteModel = {
|
||||
|
@ -146,7 +146,7 @@ export class AdMapper
|
|||
const timezone = this.timezoneFinder.timezones(
|
||||
record.waypoints[0].lon,
|
||||
record.waypoints[0].lat,
|
||||
this.defaultParams.DEFAULT_TIMEZONE,
|
||||
this._defaultParams.DEFAULT_TIMEZONE,
|
||||
)[0];
|
||||
const entity = new AdEntity({
|
||||
id: record.uuid,
|
||||
|
|
|
@ -13,7 +13,7 @@ import { Waypoint } from '../../types/waypoint';
|
|||
|
||||
@CommandHandler(CreateAdCommand)
|
||||
export class CreateAdService implements ICommandHandler {
|
||||
private readonly defaultParams: DefaultParams;
|
||||
private readonly _defaultParams: DefaultParams;
|
||||
|
||||
constructor(
|
||||
@Inject(AD_REPOSITORY)
|
||||
|
@ -21,7 +21,7 @@ export class CreateAdService implements ICommandHandler {
|
|||
@Inject(PARAMS_PROVIDER)
|
||||
private readonly defaultParamsProvider: DefaultParamsProviderPort,
|
||||
) {
|
||||
this.defaultParams = defaultParamsProvider.getParams();
|
||||
this._defaultParams = defaultParamsProvider.getParams();
|
||||
}
|
||||
|
||||
async execute(command: CreateAdCommand): Promise<AggregateID> {
|
||||
|
@ -55,20 +55,20 @@ export class CreateAdService implements ICommandHandler {
|
|||
})),
|
||||
},
|
||||
{
|
||||
driver: this.defaultParams.DRIVER,
|
||||
passenger: this.defaultParams.PASSENGER,
|
||||
driver: this._defaultParams.DRIVER,
|
||||
passenger: this._defaultParams.PASSENGER,
|
||||
marginDurations: {
|
||||
mon: this.defaultParams.MON_MARGIN,
|
||||
tue: this.defaultParams.TUE_MARGIN,
|
||||
wed: this.defaultParams.WED_MARGIN,
|
||||
thu: this.defaultParams.THU_MARGIN,
|
||||
fri: this.defaultParams.FRI_MARGIN,
|
||||
sat: this.defaultParams.SAT_MARGIN,
|
||||
sun: this.defaultParams.SUN_MARGIN,
|
||||
mon: this._defaultParams.MON_MARGIN,
|
||||
tue: this._defaultParams.TUE_MARGIN,
|
||||
wed: this._defaultParams.WED_MARGIN,
|
||||
thu: this._defaultParams.THU_MARGIN,
|
||||
fri: this._defaultParams.FRI_MARGIN,
|
||||
sat: this._defaultParams.SAT_MARGIN,
|
||||
sun: this._defaultParams.SUN_MARGIN,
|
||||
},
|
||||
strict: this.defaultParams.STRICT,
|
||||
seatsProposed: this.defaultParams.SEATS_PROPOSED,
|
||||
seatsRequested: this.defaultParams.SEATS_REQUESTED,
|
||||
strict: this._defaultParams.STRICT,
|
||||
seatsProposed: this._defaultParams.SEATS_PROPOSED,
|
||||
seatsRequested: this._defaultParams.SEATS_REQUESTED,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
@ -5,20 +5,20 @@ import { DefaultParams } from '../core/ports/default-params.type';
|
|||
|
||||
@Injectable()
|
||||
export class DefaultParamsProvider implements DefaultParamsProviderPort {
|
||||
constructor(private readonly configService: ConfigService) {}
|
||||
constructor(private readonly _configService: ConfigService) {}
|
||||
getParams = (): DefaultParams => ({
|
||||
MON_MARGIN: parseInt(this.configService.get('DEPARTURE_MARGIN')),
|
||||
TUE_MARGIN: parseInt(this.configService.get('DEPARTURE_MARGIN')),
|
||||
WED_MARGIN: parseInt(this.configService.get('DEPARTURE_MARGIN')),
|
||||
THU_MARGIN: parseInt(this.configService.get('DEPARTURE_MARGIN')),
|
||||
FRI_MARGIN: parseInt(this.configService.get('DEPARTURE_MARGIN')),
|
||||
SAT_MARGIN: parseInt(this.configService.get('DEPARTURE_MARGIN')),
|
||||
SUN_MARGIN: parseInt(this.configService.get('DEPARTURE_MARGIN')),
|
||||
DRIVER: this.configService.get('ROLE') == 'driver',
|
||||
SEATS_PROPOSED: parseInt(this.configService.get('SEATS_PROPOSED')),
|
||||
PASSENGER: this.configService.get('ROLE') == 'passenger',
|
||||
SEATS_REQUESTED: parseInt(this.configService.get('SEATS_REQUESTED')),
|
||||
STRICT: this.configService.get('STRICT_FREQUENCY') == 'true',
|
||||
DEFAULT_TIMEZONE: this.configService.get('DEFAULT_TIMEZONE'),
|
||||
MON_MARGIN: parseInt(this._configService.get('DEPARTURE_MARGIN')),
|
||||
TUE_MARGIN: parseInt(this._configService.get('DEPARTURE_MARGIN')),
|
||||
WED_MARGIN: parseInt(this._configService.get('DEPARTURE_MARGIN')),
|
||||
THU_MARGIN: parseInt(this._configService.get('DEPARTURE_MARGIN')),
|
||||
FRI_MARGIN: parseInt(this._configService.get('DEPARTURE_MARGIN')),
|
||||
SAT_MARGIN: parseInt(this._configService.get('DEPARTURE_MARGIN')),
|
||||
SUN_MARGIN: parseInt(this._configService.get('DEPARTURE_MARGIN')),
|
||||
DRIVER: this._configService.get('ROLE') == 'driver',
|
||||
SEATS_PROPOSED: parseInt(this._configService.get('SEATS_PROPOSED')),
|
||||
PASSENGER: this._configService.get('ROLE') == 'passenger',
|
||||
SEATS_REQUESTED: parseInt(this._configService.get('SEATS_REQUESTED')),
|
||||
STRICT: this._configService.get('STRICT_FREQUENCY') == 'true',
|
||||
DEFAULT_TIMEZONE: this._configService.get('DEFAULT_TIMEZONE'),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
export class HealthHttpController {
|
||||
constructor(
|
||||
private readonly repositoriesHealthIndicatorUseCase: RepositoriesHealthIndicatorUseCase,
|
||||
private healthCheckService: HealthCheckService,
|
||||
private readonly healthCheckService: HealthCheckService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
|
|
Loading…
Reference in New Issue