time request
This commit is contained in:
parent
56bdd11970
commit
1e4aa0eadc
|
@ -90,6 +90,7 @@
|
|||
".module.ts",
|
||||
".request.ts",
|
||||
".presenter.ts",
|
||||
".exception.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"rootDir": "src",
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import { MatcherException } from '../../exceptions/matcher.exception';
|
||||
import { MarginDurations } from './margin-durations.type';
|
||||
import { IRequestTime } from '../interfaces/time-request.interface';
|
||||
import { TimingDays, TimingFrequency } from './timing';
|
||||
import { TimingDays, TimingFrequency, Days } from './timing';
|
||||
import { Schedule } from './schedule.type';
|
||||
|
||||
const days = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
|
||||
|
||||
export class Time {
|
||||
_timeRequest: IRequestTime;
|
||||
_defaultMarginDuration: number;
|
||||
|
@ -84,7 +82,7 @@ export class Time {
|
|||
}
|
||||
if (
|
||||
!Object.keys(this._timeRequest.schedule).some((elem) =>
|
||||
days.includes(elem),
|
||||
Days.includes(elem),
|
||||
)
|
||||
) {
|
||||
throw new MatcherException(3, 'No valid day in the given schedule');
|
||||
|
@ -140,7 +138,7 @@ export class Time {
|
|||
if (this._timeRequest.marginDurations) {
|
||||
if (
|
||||
!Object.keys(this._timeRequest.marginDurations).some((elem) =>
|
||||
days.includes(elem),
|
||||
Days.includes(elem),
|
||||
)
|
||||
) {
|
||||
throw new MatcherException(
|
||||
|
|
|
@ -12,3 +12,5 @@ export enum TimingDays {
|
|||
'fri',
|
||||
'sat',
|
||||
}
|
||||
|
||||
export const Days = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
|
||||
|
|
Loading…
Reference in New Issue