|
|
|
@ -13,7 +13,7 @@ import { Metrics } from './metrics';
|
|
|
|
import { ResponseQueue } from './response-queue';
|
|
|
|
import { ResponseQueue } from './response-queue';
|
|
|
|
import { randomTokenBase64Url, sha256Hex } from '../utils/crypto';
|
|
|
|
import { randomTokenBase64Url, sha256Hex } from '../utils/crypto';
|
|
|
|
import { route as routeCommand } from './commands';
|
|
|
|
import { route as routeCommand } from './commands';
|
|
|
|
import { ACTION_ALIASES, SCOPE_ALIASES, todayYMD as todayYMD_TZ } from './commands/shared';
|
|
|
|
import { ACTION_ALIASES, SCOPE_ALIASES, todayYMD as todayYMD_TZ, resolveTaskIdFromInput } from './commands/shared';
|
|
|
|
import { parseNueva } from './commands/parsers/nueva';
|
|
|
|
import { parseNueva } from './commands/parsers/nueva';
|
|
|
|
|
|
|
|
|
|
|
|
type CommandContext = {
|
|
|
|
type CommandContext = {
|
|
|
|
@ -43,10 +43,6 @@ export class CommandService {
|
|
|
|
private static readonly CTA_HELP: string = 'ℹ️ Tus tareas: `/t mias` · Todas: `/t todas` · Info: `/t info` · Web: `/t web`';
|
|
|
|
private static readonly CTA_HELP: string = 'ℹ️ Tus tareas: `/t mias` · Todas: `/t todas` · Info: `/t info` · Web: `/t web`';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static resolveTaskIdFromInput(n: number): number | null {
|
|
|
|
|
|
|
|
const byCode = TaskService.getActiveTaskByDisplayCode(n);
|
|
|
|
|
|
|
|
return byCode ? byCode.id : null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static async processTareaCommand(
|
|
|
|
private static async processTareaCommand(
|
|
|
|
context: CommandContext
|
|
|
|
context: CommandContext
|
|
|
|
@ -357,7 +353,7 @@ export class CommandService {
|
|
|
|
// Caso de 1 ID: mantener comportamiento actual
|
|
|
|
// Caso de 1 ID: mantener comportamiento actual
|
|
|
|
if (ids.length === 1) {
|
|
|
|
if (ids.length === 1) {
|
|
|
|
const idInput = ids[0];
|
|
|
|
const idInput = ids[0];
|
|
|
|
const resolvedId = this.resolveTaskIdFromInput(idInput);
|
|
|
|
const resolvedId = resolveTaskIdFromInput(idInput);
|
|
|
|
if (!resolvedId) {
|
|
|
|
if (!resolvedId) {
|
|
|
|
return [{
|
|
|
|
return [{
|
|
|
|
recipient: context.sender,
|
|
|
|
recipient: context.sender,
|
|
|
|
@ -413,7 +409,7 @@ export class CommandService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (const idInput of ids) {
|
|
|
|
for (const idInput of ids) {
|
|
|
|
const resolvedId = this.resolveTaskIdFromInput(idInput);
|
|
|
|
const resolvedId = resolveTaskIdFromInput(idInput);
|
|
|
|
if (!resolvedId) {
|
|
|
|
if (!resolvedId) {
|
|
|
|
lines.push(`⚠️ ${codeId(idInput)} no encontrada.`);
|
|
|
|
lines.push(`⚠️ ${codeId(idInput)} no encontrada.`);
|
|
|
|
cntNotFound++;
|
|
|
|
cntNotFound++;
|
|
|
|
@ -486,7 +482,7 @@ export class CommandService {
|
|
|
|
if (ids.length === 1) {
|
|
|
|
if (ids.length === 1) {
|
|
|
|
const idInput = ids[0];
|
|
|
|
const idInput = ids[0];
|
|
|
|
|
|
|
|
|
|
|
|
const resolvedId = this.resolveTaskIdFromInput(idInput);
|
|
|
|
const resolvedId = resolveTaskIdFromInput(idInput);
|
|
|
|
if (!resolvedId) {
|
|
|
|
if (!resolvedId) {
|
|
|
|
return [{
|
|
|
|
return [{
|
|
|
|
recipient: context.sender,
|
|
|
|
recipient: context.sender,
|
|
|
|
@ -552,7 +548,7 @@ export class CommandService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (const idInput of ids) {
|
|
|
|
for (const idInput of ids) {
|
|
|
|
const resolvedId = this.resolveTaskIdFromInput(idInput);
|
|
|
|
const resolvedId = resolveTaskIdFromInput(idInput);
|
|
|
|
if (!resolvedId) {
|
|
|
|
if (!resolvedId) {
|
|
|
|
lines.push(`⚠️ ${codeId(idInput)} no encontrada.`);
|
|
|
|
lines.push(`⚠️ ${codeId(idInput)} no encontrada.`);
|
|
|
|
cntNotFound++;
|
|
|
|
cntNotFound++;
|
|
|
|
@ -612,7 +608,7 @@ export class CommandService {
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const resolvedId = this.resolveTaskIdFromInput(idInput);
|
|
|
|
const resolvedId = resolveTaskIdFromInput(idInput);
|
|
|
|
if (!resolvedId) {
|
|
|
|
if (!resolvedId) {
|
|
|
|
return [{
|
|
|
|
return [{
|
|
|
|
recipient: context.sender,
|
|
|
|
recipient: context.sender,
|
|
|
|
|