diff --git a/src/services/command.ts b/src/services/command.ts index 20980b8..f43648e 100644 --- a/src/services/command.ts +++ b/src/services/command.ts @@ -13,7 +13,7 @@ import { Metrics } from './metrics'; import { ResponseQueue } from './response-queue'; import { randomTokenBase64Url, sha256Hex } from '../utils/crypto'; 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'; 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 resolveTaskIdFromInput(n: number): number | null { - const byCode = TaskService.getActiveTaskByDisplayCode(n); - return byCode ? byCode.id : null; - } private static async processTareaCommand( context: CommandContext @@ -357,7 +353,7 @@ export class CommandService { // Caso de 1 ID: mantener comportamiento actual if (ids.length === 1) { const idInput = ids[0]; - const resolvedId = this.resolveTaskIdFromInput(idInput); + const resolvedId = resolveTaskIdFromInput(idInput); if (!resolvedId) { return [{ recipient: context.sender, @@ -413,7 +409,7 @@ export class CommandService { } for (const idInput of ids) { - const resolvedId = this.resolveTaskIdFromInput(idInput); + const resolvedId = resolveTaskIdFromInput(idInput); if (!resolvedId) { lines.push(`⚠️ ${codeId(idInput)} no encontrada.`); cntNotFound++; @@ -486,7 +482,7 @@ export class CommandService { if (ids.length === 1) { const idInput = ids[0]; - const resolvedId = this.resolveTaskIdFromInput(idInput); + const resolvedId = resolveTaskIdFromInput(idInput); if (!resolvedId) { return [{ recipient: context.sender, @@ -552,7 +548,7 @@ export class CommandService { } for (const idInput of ids) { - const resolvedId = this.resolveTaskIdFromInput(idInput); + const resolvedId = resolveTaskIdFromInput(idInput); if (!resolvedId) { lines.push(`⚠️ ${codeId(idInput)} no encontrada.`); cntNotFound++; @@ -612,7 +608,7 @@ export class CommandService { }]; } - const resolvedId = this.resolveTaskIdFromInput(idInput); + const resolvedId = resolveTaskIdFromInput(idInput); if (!resolvedId) { return [{ recipient: context.sender,