Skip to content

Commit

Permalink
feat(parameter date): parameter date in sendlogs is optional now
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter committed Nov 8, 2021
1 parent 0898e70 commit 2335981
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/commands/SendLogsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ class SendLogsCommand extends AbstractCommand {
description: string = 'Команда отправки логов';

protected bindOptions(command: Command) {
command.requiredOption('--date <date>', 'дата в формате ISO', /^\d{4}-\d\d-\d\d$/);
command.option('--date <date>', 'дата в формате ISO', /^\d{4}-\d\d-\d\d$/);
}

/**
* Обработка команды
*/
protected action = async (options: SendLogsCommandOptions) => {
await new Promise(resolve => {
this.validateOptions(options);
// this.validateOptions(options);
if (!options.date) {
// eslint-disable-next-line no-param-reassign
options.date = new Date().toISOString().substring(0, 10);
}

const logEntries = LogPersistenceService.getUnsentDayLogEntries(options.date);
if (logEntries.entries.length === 0) {
Expand Down

0 comments on commit 2335981

Please sign in to comment.