@newpeak/barista-cli 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/liberica/index.d.ts.map +1 -1
- package/dist/commands/liberica/index.js +7 -0
- package/dist/commands/liberica/index.js.map +1 -1
- package/dist/commands/liberica/teams/index.d.ts +3 -0
- package/dist/commands/liberica/teams/index.d.ts.map +1 -0
- package/dist/commands/liberica/teams/index.js +15 -0
- package/dist/commands/liberica/teams/index.js.map +1 -0
- package/dist/commands/liberica/teams/issues/close.d.ts +3 -0
- package/dist/commands/liberica/teams/issues/close.d.ts.map +1 -0
- package/dist/commands/liberica/teams/issues/close.js +99 -0
- package/dist/commands/liberica/teams/issues/close.js.map +1 -0
- package/dist/commands/liberica/teams/issues/create.d.ts +3 -0
- package/dist/commands/liberica/teams/issues/create.d.ts.map +1 -0
- package/dist/commands/liberica/teams/issues/create.js +255 -0
- package/dist/commands/liberica/teams/issues/create.js.map +1 -0
- package/dist/commands/liberica/teams/issues/delete.d.ts +3 -0
- package/dist/commands/liberica/teams/issues/delete.d.ts.map +1 -0
- package/dist/commands/liberica/teams/issues/delete.js +55 -0
- package/dist/commands/liberica/teams/issues/delete.js.map +1 -0
- package/dist/commands/liberica/teams/issues/get.d.ts +3 -0
- package/dist/commands/liberica/teams/issues/get.d.ts.map +1 -0
- package/dist/commands/liberica/teams/issues/get.js +68 -0
- package/dist/commands/liberica/teams/issues/get.js.map +1 -0
- package/dist/commands/liberica/teams/issues/index.d.ts +3 -0
- package/dist/commands/liberica/teams/issues/index.d.ts.map +1 -0
- package/dist/commands/liberica/teams/issues/index.js +19 -0
- package/dist/commands/liberica/teams/issues/index.js.map +1 -0
- package/dist/commands/liberica/teams/issues/list.d.ts +3 -0
- package/dist/commands/liberica/teams/issues/list.d.ts.map +1 -0
- package/dist/commands/liberica/teams/issues/list.js +111 -0
- package/dist/commands/liberica/teams/issues/list.js.map +1 -0
- package/dist/commands/liberica/teams/issues/update.d.ts +3 -0
- package/dist/commands/liberica/teams/issues/update.d.ts.map +1 -0
- package/dist/commands/liberica/teams/issues/update.js +132 -0
- package/dist/commands/liberica/teams/issues/update.js.map +1 -0
- package/dist/commands/liberica/teams/projects/create.d.ts +3 -0
- package/dist/commands/liberica/teams/projects/create.d.ts.map +1 -0
- package/dist/commands/liberica/teams/projects/create.js +164 -0
- package/dist/commands/liberica/teams/projects/create.js.map +1 -0
- package/dist/commands/liberica/teams/projects/delete.d.ts +3 -0
- package/dist/commands/liberica/teams/projects/delete.d.ts.map +1 -0
- package/dist/commands/liberica/teams/projects/delete.js +55 -0
- package/dist/commands/liberica/teams/projects/delete.js.map +1 -0
- package/dist/commands/liberica/teams/projects/get.d.ts +3 -0
- package/dist/commands/liberica/teams/projects/get.d.ts.map +1 -0
- package/dist/commands/liberica/teams/projects/get.js +77 -0
- package/dist/commands/liberica/teams/projects/get.js.map +1 -0
- package/dist/commands/liberica/teams/projects/index.d.ts +3 -0
- package/dist/commands/liberica/teams/projects/index.d.ts.map +1 -0
- package/dist/commands/liberica/teams/projects/index.js +17 -0
- package/dist/commands/liberica/teams/projects/index.js.map +1 -0
- package/dist/commands/liberica/teams/projects/list.d.ts +3 -0
- package/dist/commands/liberica/teams/projects/list.d.ts.map +1 -0
- package/dist/commands/liberica/teams/projects/list.js +115 -0
- package/dist/commands/liberica/teams/projects/list.js.map +1 -0
- package/dist/commands/liberica/teams/projects/update.d.ts +3 -0
- package/dist/commands/liberica/teams/projects/update.d.ts.map +1 -0
- package/dist/commands/liberica/teams/projects/update.js +115 -0
- package/dist/commands/liberica/teams/projects/update.js.map +1 -0
- package/dist/commands/liberica/teams/tasks/create.d.ts +3 -0
- package/dist/commands/liberica/teams/tasks/create.d.ts.map +1 -0
- package/dist/commands/liberica/teams/tasks/create.js +88 -0
- package/dist/commands/liberica/teams/tasks/create.js.map +1 -0
- package/dist/commands/liberica/teams/tasks/delete.d.ts +3 -0
- package/dist/commands/liberica/teams/tasks/delete.d.ts.map +1 -0
- package/dist/commands/liberica/teams/tasks/delete.js +73 -0
- package/dist/commands/liberica/teams/tasks/delete.js.map +1 -0
- package/dist/commands/liberica/teams/tasks/get.d.ts +3 -0
- package/dist/commands/liberica/teams/tasks/get.d.ts.map +1 -0
- package/dist/commands/liberica/teams/tasks/get.js +51 -0
- package/dist/commands/liberica/teams/tasks/get.js.map +1 -0
- package/dist/commands/liberica/teams/tasks/index.d.ts +3 -0
- package/dist/commands/liberica/teams/tasks/index.d.ts.map +1 -0
- package/dist/commands/liberica/teams/tasks/index.js +17 -0
- package/dist/commands/liberica/teams/tasks/index.js.map +1 -0
- package/dist/commands/liberica/teams/tasks/list.d.ts +3 -0
- package/dist/commands/liberica/teams/tasks/list.d.ts.map +1 -0
- package/dist/commands/liberica/teams/tasks/list.js +82 -0
- package/dist/commands/liberica/teams/tasks/list.js.map +1 -0
- package/dist/commands/liberica/teams/tasks/update.d.ts +3 -0
- package/dist/commands/liberica/teams/tasks/update.d.ts.map +1 -0
- package/dist/commands/liberica/teams/tasks/update.js +114 -0
- package/dist/commands/liberica/teams/tasks/update.js.map +1 -0
- package/dist/commands/liberica/teams/work-logs/create.d.ts +3 -0
- package/dist/commands/liberica/teams/work-logs/create.d.ts.map +1 -0
- package/dist/commands/liberica/teams/work-logs/create.js +183 -0
- package/dist/commands/liberica/teams/work-logs/create.js.map +1 -0
- package/dist/commands/liberica/teams/work-logs/delete.d.ts +3 -0
- package/dist/commands/liberica/teams/work-logs/delete.d.ts.map +1 -0
- package/dist/commands/liberica/teams/work-logs/delete.js +55 -0
- package/dist/commands/liberica/teams/work-logs/delete.js.map +1 -0
- package/dist/commands/liberica/teams/work-logs/get.d.ts +3 -0
- package/dist/commands/liberica/teams/work-logs/get.d.ts.map +1 -0
- package/dist/commands/liberica/teams/work-logs/get.js +77 -0
- package/dist/commands/liberica/teams/work-logs/get.js.map +1 -0
- package/dist/commands/liberica/teams/work-logs/index.d.ts +3 -0
- package/dist/commands/liberica/teams/work-logs/index.d.ts.map +1 -0
- package/dist/commands/liberica/teams/work-logs/index.js +17 -0
- package/dist/commands/liberica/teams/work-logs/index.js.map +1 -0
- package/dist/commands/liberica/teams/work-logs/list.d.ts +3 -0
- package/dist/commands/liberica/teams/work-logs/list.d.ts.map +1 -0
- package/dist/commands/liberica/teams/work-logs/list.js +109 -0
- package/dist/commands/liberica/teams/work-logs/list.js.map +1 -0
- package/dist/commands/liberica/teams/work-logs/update.d.ts +3 -0
- package/dist/commands/liberica/teams/work-logs/update.d.ts.map +1 -0
- package/dist/commands/liberica/teams/work-logs/update.js +105 -0
- package/dist/commands/liberica/teams/work-logs/update.js.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/batch-delete.d.ts +3 -0
- package/dist/commands/liberica/transfer-in-forms/batch-delete.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/batch-delete.js +147 -0
- package/dist/commands/liberica/transfer-in-forms/batch-delete.js.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/batch-review.d.ts +3 -0
- package/dist/commands/liberica/transfer-in-forms/batch-review.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/batch-review.js +146 -0
- package/dist/commands/liberica/transfer-in-forms/batch-review.js.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/batch-unreview.d.ts +3 -0
- package/dist/commands/liberica/transfer-in-forms/batch-unreview.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/batch-unreview.js +147 -0
- package/dist/commands/liberica/transfer-in-forms/batch-unreview.js.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/create.d.ts +3 -0
- package/dist/commands/liberica/transfer-in-forms/create.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/create.js +168 -0
- package/dist/commands/liberica/transfer-in-forms/create.js.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/get.d.ts +3 -0
- package/dist/commands/liberica/transfer-in-forms/get.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/get.js +94 -0
- package/dist/commands/liberica/transfer-in-forms/get.js.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/index.d.ts +3 -0
- package/dist/commands/liberica/transfer-in-forms/index.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/index.js +21 -0
- package/dist/commands/liberica/transfer-in-forms/index.js.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/list.d.ts +3 -0
- package/dist/commands/liberica/transfer-in-forms/list.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/list.js +94 -0
- package/dist/commands/liberica/transfer-in-forms/list.js.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/update.d.ts +3 -0
- package/dist/commands/liberica/transfer-in-forms/update.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-in-forms/update.js +206 -0
- package/dist/commands/liberica/transfer-in-forms/update.js.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/batch-delete.d.ts +3 -0
- package/dist/commands/liberica/transfer-out-forms/batch-delete.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/batch-delete.js +80 -0
- package/dist/commands/liberica/transfer-out-forms/batch-delete.js.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/batch-review.d.ts +3 -0
- package/dist/commands/liberica/transfer-out-forms/batch-review.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/batch-review.js +142 -0
- package/dist/commands/liberica/transfer-out-forms/batch-review.js.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/batch-unreview.d.ts +3 -0
- package/dist/commands/liberica/transfer-out-forms/batch-unreview.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/batch-unreview.js +53 -0
- package/dist/commands/liberica/transfer-out-forms/batch-unreview.js.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/create.d.ts +3 -0
- package/dist/commands/liberica/transfer-out-forms/create.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/create.js +191 -0
- package/dist/commands/liberica/transfer-out-forms/create.js.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/get.d.ts +3 -0
- package/dist/commands/liberica/transfer-out-forms/get.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/get.js +87 -0
- package/dist/commands/liberica/transfer-out-forms/get.js.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/index.d.ts +3 -0
- package/dist/commands/liberica/transfer-out-forms/index.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/index.js +21 -0
- package/dist/commands/liberica/transfer-out-forms/index.js.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/list.d.ts +3 -0
- package/dist/commands/liberica/transfer-out-forms/list.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/list.js +118 -0
- package/dist/commands/liberica/transfer-out-forms/list.js.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/update.d.ts +3 -0
- package/dist/commands/liberica/transfer-out-forms/update.d.ts.map +1 -0
- package/dist/commands/liberica/transfer-out-forms/update.js +197 -0
- package/dist/commands/liberica/transfer-out-forms/update.js.map +1 -0
- package/dist/core/api/client.d.ts +42 -0
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +798 -0
- package/dist/core/api/client.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/team-issue.d.ts +87 -0
- package/dist/types/team-issue.d.ts.map +1 -0
- package/dist/types/team-issue.js +2 -0
- package/dist/types/team-issue.js.map +1 -0
- package/dist/types/team-project.d.ts +68 -0
- package/dist/types/team-project.d.ts.map +1 -0
- package/dist/types/team-project.js +2 -0
- package/dist/types/team-project.js.map +1 -0
- package/dist/types/team-task.d.ts +91 -0
- package/dist/types/team-task.d.ts.map +1 -0
- package/dist/types/team-task.js +2 -0
- package/dist/types/team-task.js.map +1 -0
- package/dist/types/team-work-log.d.ts +81 -0
- package/dist/types/team-work-log.d.ts.map +1 -0
- package/dist/types/team-work-log.js +2 -0
- package/dist/types/team-work-log.js.map +1 -0
- package/dist/types/transfer-in-form.d.ts +242 -0
- package/dist/types/transfer-in-form.d.ts.map +1 -0
- package/dist/types/transfer-in-form.js +2 -0
- package/dist/types/transfer-in-form.js.map +1 -0
- package/dist/types/transfer-out-form.d.ts +252 -0
- package/dist/types/transfer-out-form.d.ts.map +1 -0
- package/dist/types/transfer-out-form.js +4 -0
- package/dist/types/transfer-out-form.js.map +1 -0
- package/docs/commands/liberica/teams/issues/close.md +161 -0
- package/docs/commands/liberica/teams/issues/create.md +212 -0
- package/docs/commands/liberica/teams/issues/delete.md +179 -0
- package/docs/commands/liberica/teams/issues/get.md +167 -0
- package/docs/commands/liberica/teams/issues/list.md +182 -0
- package/docs/commands/liberica/teams/issues/tests-design.md +341 -0
- package/docs/commands/liberica/teams/issues/update.md +202 -0
- package/docs/commands/liberica/teams/projects/create.md +174 -0
- package/docs/commands/liberica/teams/projects/delete.md +180 -0
- package/docs/commands/liberica/teams/projects/get.md +150 -0
- package/docs/commands/liberica/teams/projects/list.md +179 -0
- package/docs/commands/liberica/teams/projects/update.md +175 -0
- package/docs/commands/liberica/teams/tasks/create.md +163 -0
- package/docs/commands/liberica/teams/tasks/delete.md +109 -0
- package/docs/commands/liberica/teams/tasks/get.md +121 -0
- package/docs/commands/liberica/teams/tasks/list.md +148 -0
- package/docs/commands/liberica/teams/tasks/update.md +158 -0
- package/docs/commands/liberica/teams/work-logs/create.md +151 -0
- package/docs/commands/liberica/teams/work-logs/delete.md +130 -0
- package/docs/commands/liberica/teams/work-logs/get.md +131 -0
- package/docs/commands/liberica/teams/work-logs/list.md +153 -0
- package/docs/commands/liberica/teams/work-logs/update.md +150 -0
- package/docs/commands/liberica/transfer-in-forms/batch-delete.md +157 -0
- package/docs/commands/liberica/transfer-in-forms/batch-review.md +157 -0
- package/docs/commands/liberica/transfer-in-forms/batch-unreview.md +157 -0
- package/docs/commands/liberica/transfer-in-forms/create.md +220 -0
- package/docs/commands/liberica/transfer-in-forms/get.md +221 -0
- package/docs/commands/liberica/transfer-in-forms/list.md +242 -0
- package/docs/commands/liberica/transfer-in-forms/update.md +185 -0
- package/docs/commands/liberica/transfer-out-forms/batch-delete.md +187 -0
- package/docs/commands/liberica/transfer-out-forms/batch-review.md +157 -0
- package/docs/commands/liberica/transfer-out-forms/batch-unreview.md +157 -0
- package/docs/commands/liberica/transfer-out-forms/create.md +280 -0
- package/docs/commands/liberica/transfer-out-forms/get.md +211 -0
- package/docs/commands/liberica/transfer-out-forms/list.md +233 -0
- package/docs/commands/liberica/transfer-out-forms/update.md +286 -0
- package/package.json +1 -1
- package/src/commands/liberica/index.ts +8 -1
- package/src/commands/liberica/teams/index.ts +17 -0
- package/src/commands/liberica/teams/issues/close.ts +104 -0
- package/src/commands/liberica/teams/issues/create.ts +254 -0
- package/src/commands/liberica/teams/issues/delete.ts +58 -0
- package/src/commands/liberica/teams/issues/get.ts +78 -0
- package/src/commands/liberica/teams/issues/index.ts +21 -0
- package/src/commands/liberica/teams/issues/list.ts +144 -0
- package/src/commands/liberica/teams/issues/update.ts +141 -0
- package/src/commands/liberica/teams/projects/create.ts +159 -0
- package/src/commands/liberica/teams/projects/delete.ts +58 -0
- package/src/commands/liberica/teams/projects/get.ts +87 -0
- package/src/commands/liberica/teams/projects/index.ts +19 -0
- package/src/commands/liberica/teams/projects/list.ts +147 -0
- package/src/commands/liberica/teams/projects/update.ts +117 -0
- package/src/commands/liberica/teams/tasks/create.ts +102 -0
- package/src/commands/liberica/teams/tasks/delete.ts +92 -0
- package/src/commands/liberica/teams/tasks/get.ts +64 -0
- package/src/commands/liberica/teams/tasks/index.ts +19 -0
- package/src/commands/liberica/teams/tasks/list.ts +102 -0
- package/src/commands/liberica/teams/tasks/update.ts +122 -0
- package/src/commands/liberica/teams/work-logs/create.ts +204 -0
- package/src/commands/liberica/teams/work-logs/delete.ts +58 -0
- package/src/commands/liberica/teams/work-logs/get.ts +87 -0
- package/src/commands/liberica/teams/work-logs/index.ts +19 -0
- package/src/commands/liberica/teams/work-logs/list.ts +141 -0
- package/src/commands/liberica/teams/work-logs/update.ts +120 -0
- package/src/commands/liberica/transfer-in-forms/batch-delete.ts +152 -0
- package/src/commands/liberica/transfer-in-forms/batch-review.ts +151 -0
- package/src/commands/liberica/transfer-in-forms/batch-unreview.ts +152 -0
- package/src/commands/liberica/transfer-in-forms/create.ts +179 -0
- package/src/commands/liberica/transfer-in-forms/get.ts +107 -0
- package/src/commands/liberica/transfer-in-forms/index.ts +23 -0
- package/src/commands/liberica/transfer-in-forms/list.ts +97 -0
- package/src/commands/liberica/transfer-in-forms/update.ts +213 -0
- package/src/commands/liberica/transfer-out-forms/batch-delete.ts +83 -0
- package/src/commands/liberica/transfer-out-forms/batch-review.ts +148 -0
- package/src/commands/liberica/transfer-out-forms/batch-unreview.ts +56 -0
- package/src/commands/liberica/transfer-out-forms/create.ts +194 -0
- package/src/commands/liberica/transfer-out-forms/get.ts +114 -0
- package/src/commands/liberica/transfer-out-forms/index.ts +23 -0
- package/src/commands/liberica/transfer-out-forms/list.ts +125 -0
- package/src/commands/liberica/transfer-out-forms/update.ts +197 -0
- package/src/core/api/client.ts +1218 -190
- package/src/index.ts +1 -1
- package/src/types/index.ts +5 -0
- package/src/types/team-issue.ts +94 -0
- package/src/types/team-project.ts +74 -0
- package/src/types/team-task.ts +98 -0
- package/src/types/team-work-log.ts +87 -0
- package/src/types/transfer-in-form.ts +265 -0
- package/src/types/transfer-out-form.ts +290 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { apiClient } from '../../../../core/api/client.js';
|
|
4
|
+
import { configManager } from '../../../../core/config/manager.js';
|
|
5
|
+
import {
|
|
6
|
+
CreateTeamWorkLogRequest,
|
|
7
|
+
TeamWorkLog,
|
|
8
|
+
WorkLogType,
|
|
9
|
+
WorkLogStatus,
|
|
10
|
+
} from '../../../../types/team-work-log.js';
|
|
11
|
+
|
|
12
|
+
function formatTable(data: CreateTeamWorkLogRequest): string {
|
|
13
|
+
const lines: string[] = [];
|
|
14
|
+
lines.push(` ${chalk.gray('Title:')} ${data.workLogTitle}`);
|
|
15
|
+
lines.push(` ${chalk.gray('Type:')} ${data.workLogType}`);
|
|
16
|
+
if (data.workLogContent) lines.push(` ${chalk.gray('Content:')} ${data.workLogContent}`);
|
|
17
|
+
if (data.projectId) lines.push(` ${chalk.gray('Project ID:')} ${data.projectId}`);
|
|
18
|
+
if (data.createDate) lines.push(` ${chalk.gray('Date:')} ${data.createDate}`);
|
|
19
|
+
if (data.workHours) lines.push(` ${chalk.gray('Hours:')} ${data.workHours}`);
|
|
20
|
+
if (data.workLogStatus) lines.push(` ${chalk.gray('Status:')} ${data.workLogStatus}`);
|
|
21
|
+
return lines.join('\n');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function createTeamWorkLogCreateCommand(): Command {
|
|
25
|
+
const cmd = new Command('create');
|
|
26
|
+
cmd.description('Create a new team work log');
|
|
27
|
+
|
|
28
|
+
cmd
|
|
29
|
+
.option('--task-id <string>', 'Task/Project ID (required)')
|
|
30
|
+
.option('--title <string>', 'Work log title')
|
|
31
|
+
.option('--type <string>', 'Work log type: DAILY/WEEKLY/MONTHLY/PROJECT/OTHER', 'DAILY')
|
|
32
|
+
.option('--content <string>', 'Work log content')
|
|
33
|
+
.option('--date <string>', 'Work date (YYYY-MM-DD)')
|
|
34
|
+
.option('--hours <number>', 'Work hours')
|
|
35
|
+
.option('--status <string>', 'Work log status: DRAFT/SUBMITTED/APPROVED/REJECTED')
|
|
36
|
+
.option('--dry-run', 'Preview without making API call')
|
|
37
|
+
.option('--json', 'Output as JSON');
|
|
38
|
+
|
|
39
|
+
cmd.action(async () => {
|
|
40
|
+
const context = configManager.getCurrentContext();
|
|
41
|
+
const opts = cmd.opts();
|
|
42
|
+
|
|
43
|
+
const taskId = opts.taskId as string | undefined;
|
|
44
|
+
const title = opts.title as string | undefined;
|
|
45
|
+
const typeInput = opts.type as string | undefined;
|
|
46
|
+
const content = opts.content as string | undefined;
|
|
47
|
+
const date = opts.date as string | undefined;
|
|
48
|
+
const hours = opts.hours ? parseFloat(opts.hours as string) : undefined;
|
|
49
|
+
const statusInput = opts.status as string | undefined;
|
|
50
|
+
const dryRun = opts.dryRun === true;
|
|
51
|
+
const jsonOutput = opts.json === true;
|
|
52
|
+
|
|
53
|
+
// Validate required fields
|
|
54
|
+
if (!taskId) {
|
|
55
|
+
if (jsonOutput) {
|
|
56
|
+
console.log(
|
|
57
|
+
JSON.stringify({
|
|
58
|
+
success: false,
|
|
59
|
+
error: { code: 'MISSING_OPTION', message: 'Option --task-id is required' },
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
} else {
|
|
63
|
+
console.error(chalk.red('\n✗ Error: --task-id is required\n'));
|
|
64
|
+
}
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!title) {
|
|
69
|
+
if (jsonOutput) {
|
|
70
|
+
console.log(
|
|
71
|
+
JSON.stringify({
|
|
72
|
+
success: false,
|
|
73
|
+
error: { code: 'MISSING_OPTION', message: 'Option --title is required' },
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
} else {
|
|
77
|
+
console.error(chalk.red('\n✗ Error: --title is required\n'));
|
|
78
|
+
}
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Validate type
|
|
83
|
+
let workLogType: WorkLogType | undefined;
|
|
84
|
+
if (typeInput) {
|
|
85
|
+
if (!['DAILY', 'WEEKLY', 'MONTHLY', 'PROJECT', 'OTHER'].includes(typeInput)) {
|
|
86
|
+
if (jsonOutput) {
|
|
87
|
+
console.log(
|
|
88
|
+
JSON.stringify({
|
|
89
|
+
success: false,
|
|
90
|
+
error: {
|
|
91
|
+
code: 'INVALID_OPTION',
|
|
92
|
+
message: 'Invalid --type. Valid values: DAILY, WEEKLY, MONTHLY, PROJECT, OTHER',
|
|
93
|
+
},
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
} else {
|
|
97
|
+
console.error(
|
|
98
|
+
chalk.red('\n✗ Error: Invalid --type\n Valid values: DAILY, WEEKLY, MONTHLY, PROJECT, OTHER\n')
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
workLogType = typeInput as WorkLogType;
|
|
104
|
+
} else {
|
|
105
|
+
workLogType = 'DAILY';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Validate status
|
|
109
|
+
let workLogStatus: WorkLogStatus | undefined;
|
|
110
|
+
if (statusInput) {
|
|
111
|
+
if (!['DRAFT', 'SUBMITTED', 'APPROVED', 'REJECTED'].includes(statusInput)) {
|
|
112
|
+
if (jsonOutput) {
|
|
113
|
+
console.log(
|
|
114
|
+
JSON.stringify({
|
|
115
|
+
success: false,
|
|
116
|
+
error: {
|
|
117
|
+
code: 'INVALID_OPTION',
|
|
118
|
+
message: 'Invalid --status. Valid values: DRAFT, SUBMITTED, APPROVED, REJECTED',
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
} else {
|
|
123
|
+
console.error(
|
|
124
|
+
chalk.red('\n✗ Error: Invalid --status\n Valid values: DRAFT, SUBMITTED, APPROVED, REJECTED\n')
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
workLogStatus = statusInput as WorkLogStatus;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const data: CreateTeamWorkLogRequest = {
|
|
133
|
+
workLogTitle: title,
|
|
134
|
+
workLogType: workLogType,
|
|
135
|
+
workLogContent: content,
|
|
136
|
+
projectId: taskId,
|
|
137
|
+
createDate: date,
|
|
138
|
+
workHours: hours,
|
|
139
|
+
workLogStatus: workLogStatus,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
if (dryRun) {
|
|
143
|
+
if (jsonOutput) {
|
|
144
|
+
console.log(JSON.stringify({ success: true, dryRun: true, data }));
|
|
145
|
+
} else {
|
|
146
|
+
console.log(chalk.bold('\n🔍 Dry-Run Mode: No changes will be made\n'));
|
|
147
|
+
console.log(' Work log to be created:');
|
|
148
|
+
console.log(formatTable(data));
|
|
149
|
+
console.log();
|
|
150
|
+
}
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!jsonOutput) {
|
|
155
|
+
console.log(chalk.bold('\n📝 Creating Team Work Log\n'));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const response = await apiClient.createTeamWorkLog(context.environment, context.tenant, data);
|
|
159
|
+
|
|
160
|
+
if (!response.success) {
|
|
161
|
+
const errorMsg = response.error?.message || 'Failed to create team work log';
|
|
162
|
+
const errorCode = response.error?.code || 'CREATE_TEAM_WORK_LOG_ERROR';
|
|
163
|
+
if (jsonOutput) {
|
|
164
|
+
console.log(JSON.stringify({ success: false, error: { code: errorCode, message: errorMsg } }));
|
|
165
|
+
} else {
|
|
166
|
+
console.error(chalk.red(`\n✗ Failed to create team work log: ${errorMsg}`));
|
|
167
|
+
if (response.error?.code) {
|
|
168
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
169
|
+
}
|
|
170
|
+
console.error();
|
|
171
|
+
}
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (response.success) {
|
|
176
|
+
const workLog = response.data as TeamWorkLog | undefined;
|
|
177
|
+
|
|
178
|
+
if (jsonOutput) {
|
|
179
|
+
console.log(JSON.stringify({ success: true, data: workLog }));
|
|
180
|
+
} else {
|
|
181
|
+
console.log(chalk.green('✓ Team work log created successfully\n'));
|
|
182
|
+
if (workLog?.teamWorkLogId)
|
|
183
|
+
console.log(` ${chalk.gray('Work Log ID:')} ${chalk.green(workLog.teamWorkLogId)}`);
|
|
184
|
+
if (workLog?.workLogCode)
|
|
185
|
+
console.log(` ${chalk.gray('Code:')} ${workLog.workLogCode}`);
|
|
186
|
+
if (workLog?.workLogTitle)
|
|
187
|
+
console.log(` ${chalk.gray('Title:')} ${workLog.workLogTitle}`);
|
|
188
|
+
if (workLog?.workLogType)
|
|
189
|
+
console.log(` ${chalk.gray('Type:')} ${workLog.workLogType}`);
|
|
190
|
+
if (workLog?.workLogContent)
|
|
191
|
+
console.log(` ${chalk.gray('Content:')} ${workLog.workLogContent}`);
|
|
192
|
+
if (workLog?.workHours)
|
|
193
|
+
console.log(` ${chalk.gray('Hours:')} ${workLog.workHours}`);
|
|
194
|
+
if (workLog?.workLogStatus)
|
|
195
|
+
console.log(` ${chalk.gray('Status:')} ${workLog.workLogStatus}`);
|
|
196
|
+
if (workLog?.createDate)
|
|
197
|
+
console.log(` ${chalk.gray('Created:')} ${workLog.createDate}`);
|
|
198
|
+
console.log();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
return cmd;
|
|
204
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { configManager } from '../../../../core/config/manager.js';
|
|
4
|
+
import { apiClient } from '../../../../core/api/client.js';
|
|
5
|
+
|
|
6
|
+
export function createTeamWorkLogDeleteCommand(): Command {
|
|
7
|
+
const deleteCommand = new Command('delete');
|
|
8
|
+
deleteCommand
|
|
9
|
+
.description('Delete a team work log')
|
|
10
|
+
.argument('<work-log-id>', 'Work Log ID')
|
|
11
|
+
.option('--force', 'Skip confirmation prompt')
|
|
12
|
+
.option('--dry-run', 'Preview the operation without executing')
|
|
13
|
+
.option('--json', 'Output as JSON');
|
|
14
|
+
|
|
15
|
+
deleteCommand.action(async (workLogId: string, options: Record<string, unknown>) => {
|
|
16
|
+
const context = configManager.getCurrentContext();
|
|
17
|
+
const jsonOutput = options.json === true;
|
|
18
|
+
|
|
19
|
+
if (!workLogId || workLogId.trim() === '') {
|
|
20
|
+
console.error(chalk.red('\n✗ Work Log ID is required\n'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (options.dryRun) {
|
|
25
|
+
if (jsonOutput) {
|
|
26
|
+
console.log(JSON.stringify({ success: true, dryRun: true, workLogId }));
|
|
27
|
+
} else {
|
|
28
|
+
console.log(chalk.bold('\n🗑️ Delete Work Log (Dry Run)\n'));
|
|
29
|
+
console.log(chalk.gray(` Work Log ID: ${workLogId}`));
|
|
30
|
+
console.log(chalk.cyan('\n This operation will delete the work log.\n'));
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!options.force) {
|
|
36
|
+
if (!jsonOutput) {
|
|
37
|
+
console.log(chalk.bold('\n🗑️ Delete Work Log\n'));
|
|
38
|
+
console.log(chalk.gray(` Work Log ID: ${workLogId}`));
|
|
39
|
+
console.log(chalk.yellow('\n ⚠️ Add --force to confirm deletion\n'));
|
|
40
|
+
}
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const response = await apiClient.deleteTeamWorkLog(context.environment, context.tenant, workLogId);
|
|
45
|
+
if (response.success) {
|
|
46
|
+
if (jsonOutput) {
|
|
47
|
+
console.log(JSON.stringify({ success: true, workLogId }));
|
|
48
|
+
} else {
|
|
49
|
+
console.log(chalk.green(`\n✓ Work Log ${workLogId} deleted\n`));
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
console.error(chalk.red(`\n✗ Failed: ${response.error?.message || 'Unknown error'}\n`));
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return deleteCommand;
|
|
58
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { configManager } from '../../../../core/config/manager.js';
|
|
4
|
+
import { apiClient } from '../../../../core/api/client.js';
|
|
5
|
+
import { Environment } from '../../../../types/index.js';
|
|
6
|
+
import { TeamWorkLog } from '../../../../types/team-work-log.js';
|
|
7
|
+
|
|
8
|
+
export function createTeamWorkLogGetCommand(): Command {
|
|
9
|
+
const getCommand = new Command('get');
|
|
10
|
+
getCommand.description('Get team work log details by ID');
|
|
11
|
+
getCommand.arguments('<work-log-id>');
|
|
12
|
+
getCommand.option('--json', 'Output as JSON');
|
|
13
|
+
|
|
14
|
+
getCommand.action(async (workLogId: string, options: Record<string, unknown>) => {
|
|
15
|
+
const context = configManager.getCurrentContext();
|
|
16
|
+
const environment = (options.env as Environment) || context.environment;
|
|
17
|
+
const tenant = (options.tenant as string) || context.tenant;
|
|
18
|
+
|
|
19
|
+
if (!workLogId || workLogId.trim() === '') {
|
|
20
|
+
console.error(chalk.red('\n✗ Work log ID is required\n'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const response = await apiClient.getTeamWorkLog(environment, tenant, workLogId);
|
|
26
|
+
|
|
27
|
+
if (!response.success) {
|
|
28
|
+
const errorCode = response.error?.code || 'UNKNOWN_ERROR';
|
|
29
|
+
const errorMessage = response.error?.message || 'Unknown error';
|
|
30
|
+
console.error(chalk.red(`\n✗ Error: ${errorMessage} (${errorCode})\n`));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const workLog = response.data as TeamWorkLog | null;
|
|
35
|
+
|
|
36
|
+
if (!workLog) {
|
|
37
|
+
console.error(chalk.red('\n✗ Work log not found\n'));
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (options.json) {
|
|
42
|
+
console.log(JSON.stringify({
|
|
43
|
+
success: true,
|
|
44
|
+
data: workLog,
|
|
45
|
+
}, null, 2));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log(chalk.bold('\n📋 Work Log Details\n'));
|
|
50
|
+
console.log(` ${chalk.gray('ID:')} ${workLog.teamWorkLogId}`);
|
|
51
|
+
console.log(` ${chalk.gray('Code:')} ${workLog.workLogCode || '-'}`);
|
|
52
|
+
console.log(` ${chalk.gray('Title:')} ${workLog.workLogTitle}`);
|
|
53
|
+
console.log(` ${chalk.gray('Type:')} ${workLog.workLogType}`);
|
|
54
|
+
console.log(` ${chalk.gray('Status:')} ${workLog.workLogStatus || '-'}`);
|
|
55
|
+
if (workLog.workLogContent) {
|
|
56
|
+
console.log(` ${chalk.gray('Content:')} ${workLog.workLogContent}`);
|
|
57
|
+
}
|
|
58
|
+
if (workLog.projectName) {
|
|
59
|
+
console.log(` ${chalk.gray('Project:')} ${workLog.projectName}`);
|
|
60
|
+
}
|
|
61
|
+
if (workLog.workHours !== undefined) {
|
|
62
|
+
console.log(` ${chalk.gray('Hours:')} ${workLog.workHours}`);
|
|
63
|
+
}
|
|
64
|
+
if (workLog.creatorName) {
|
|
65
|
+
console.log(` ${chalk.gray('Creator:')} ${workLog.creatorName}`);
|
|
66
|
+
}
|
|
67
|
+
if (workLog.createDate) {
|
|
68
|
+
console.log(` ${chalk.gray('Created:')} ${workLog.createDate}`);
|
|
69
|
+
}
|
|
70
|
+
if (workLog.submitDate) {
|
|
71
|
+
console.log(` ${chalk.gray('Submitted:')} ${workLog.submitDate}`);
|
|
72
|
+
}
|
|
73
|
+
if (workLog.approverName) {
|
|
74
|
+
console.log(` ${chalk.gray('Approver:')} ${workLog.approverName}`);
|
|
75
|
+
}
|
|
76
|
+
if (workLog.approverComment) {
|
|
77
|
+
console.log(` ${chalk.gray('Comment:')} ${workLog.approverComment}`);
|
|
78
|
+
}
|
|
79
|
+
console.log();
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error(chalk.red(`\n✗ Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return getCommand;
|
|
87
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createTeamWorkLogListCommand } from './list.js';
|
|
3
|
+
import { createTeamWorkLogGetCommand } from './get.js';
|
|
4
|
+
import { createTeamWorkLogDeleteCommand } from './delete.js';
|
|
5
|
+
import { createTeamWorkLogCreateCommand } from './create.js';
|
|
6
|
+
import { createTeamWorkLogUpdateCommand } from './update.js';
|
|
7
|
+
|
|
8
|
+
export function createTeamWorkLogsCommand(): Command {
|
|
9
|
+
const workLogsCommand = new Command('work-logs');
|
|
10
|
+
workLogsCommand.description('Manage team work logs');
|
|
11
|
+
|
|
12
|
+
workLogsCommand.addCommand(createTeamWorkLogListCommand());
|
|
13
|
+
workLogsCommand.addCommand(createTeamWorkLogGetCommand());
|
|
14
|
+
workLogsCommand.addCommand(createTeamWorkLogDeleteCommand());
|
|
15
|
+
workLogsCommand.addCommand(createTeamWorkLogCreateCommand());
|
|
16
|
+
workLogsCommand.addCommand(createTeamWorkLogUpdateCommand());
|
|
17
|
+
|
|
18
|
+
return workLogsCommand;
|
|
19
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import Table from 'cli-table3';
|
|
4
|
+
import { configManager } from '../../../../core/config/manager.js';
|
|
5
|
+
import { apiClient } from '../../../../core/api/client.js';
|
|
6
|
+
import {
|
|
7
|
+
TeamWorkLogQueryParams,
|
|
8
|
+
TeamWorkLogListResponse,
|
|
9
|
+
WorkLogStatus,
|
|
10
|
+
WorkLogType,
|
|
11
|
+
} from '../../../../types/team-work-log.js';
|
|
12
|
+
import { Environment } from '../../../../types/index.js';
|
|
13
|
+
|
|
14
|
+
export function createTeamWorkLogListCommand(): Command {
|
|
15
|
+
const listCommand = new Command('list');
|
|
16
|
+
listCommand.description('List team work logs with pagination');
|
|
17
|
+
|
|
18
|
+
listCommand
|
|
19
|
+
.option('-p, --page <number>', 'Page number', '1')
|
|
20
|
+
.option('-s, --size <number>', 'Page size', '20')
|
|
21
|
+
.option('--status <string>', 'Filter by status (DRAFT/SUBMITTED/APPROVED/REJECTED)')
|
|
22
|
+
.option('--task-id <string>', 'Filter by task ID')
|
|
23
|
+
.option('--project-id <string>', 'Filter by project ID')
|
|
24
|
+
.option('--user-id <string>', 'Filter by user ID (creator)')
|
|
25
|
+
.option('--type <string>', 'Filter by work log type (DAILY/WEEKLY/MONTHLY/PROJECT/OTHER)')
|
|
26
|
+
.option('--json', 'Output as JSON')
|
|
27
|
+
.action(async (options) => {
|
|
28
|
+
const context = configManager.getCurrentContext();
|
|
29
|
+
const environment = (options.env as Environment) || context.environment;
|
|
30
|
+
const tenant = options.tenant || context.tenant;
|
|
31
|
+
|
|
32
|
+
const page = parseInt(options.page as string, 10) - 1; // API uses 0-based
|
|
33
|
+
const size = parseInt(options.size as string, 10);
|
|
34
|
+
|
|
35
|
+
const params: TeamWorkLogQueryParams = {
|
|
36
|
+
pageNo: page,
|
|
37
|
+
pageSize: size,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
if (options.status) {
|
|
41
|
+
params.workLogStatus = options.status as WorkLogStatus;
|
|
42
|
+
}
|
|
43
|
+
if (options.projectId) {
|
|
44
|
+
params.projectId = options.projectId as string;
|
|
45
|
+
}
|
|
46
|
+
if (options.type) {
|
|
47
|
+
params.workLogType = options.type as WorkLogType;
|
|
48
|
+
}
|
|
49
|
+
if (options.userId) {
|
|
50
|
+
// Map user-id to creatorName for filtering
|
|
51
|
+
params.creatorName = options.userId as string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const response = await apiClient.listTeamWorkLogs(environment, tenant, params);
|
|
55
|
+
|
|
56
|
+
if (!response.success) {
|
|
57
|
+
console.error(chalk.red(`\n✗ Failed to list team work logs: ${response.error?.message || 'Unknown error'}`));
|
|
58
|
+
if (response.error?.code) {
|
|
59
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
60
|
+
}
|
|
61
|
+
console.error();
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const data = response.data as TeamWorkLogListResponse | null;
|
|
66
|
+
|
|
67
|
+
if (!data) {
|
|
68
|
+
if (options.json) {
|
|
69
|
+
console.log(JSON.stringify({ success: true, data: { items: [], pagination: { pageNo: 0, pageSize: 20, totalRows: 0 } } }, null, 2));
|
|
70
|
+
} else {
|
|
71
|
+
console.log(chalk.bold('\n📋 Team Work Log List\n'));
|
|
72
|
+
console.log(chalk.gray(' No team work logs found\n'));
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (options.json) {
|
|
78
|
+
console.log(
|
|
79
|
+
JSON.stringify(
|
|
80
|
+
{
|
|
81
|
+
success: true,
|
|
82
|
+
data: {
|
|
83
|
+
items: data.rows || [],
|
|
84
|
+
pagination: {
|
|
85
|
+
pageNo: data.pageNo,
|
|
86
|
+
pageSize: data.pageSize,
|
|
87
|
+
totalRows: data.totalRows,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
null,
|
|
92
|
+
2
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const records = data.rows || [];
|
|
99
|
+
|
|
100
|
+
if (records.length === 0) {
|
|
101
|
+
console.log(chalk.bold('\n📋 Team Work Log List\n'));
|
|
102
|
+
console.log(chalk.gray(' No team work logs found\n'));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
console.log(chalk.bold('\n📋 Team Work Log List\n'));
|
|
107
|
+
|
|
108
|
+
const table = new Table({
|
|
109
|
+
head: [chalk.bold('ID'), chalk.bold('Title'), chalk.bold('Type'), chalk.bold('Status'), chalk.bold('Creator'), chalk.bold('Project'), chalk.bold('Created')],
|
|
110
|
+
colWidths: [12, 30, 12, 12, 18, 18, 18],
|
|
111
|
+
style: {
|
|
112
|
+
head: [],
|
|
113
|
+
border: [],
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
for (const log of records) {
|
|
118
|
+
const statusColor = log.workLogStatus === 'APPROVED' ? chalk.green : log.workLogStatus === 'SUBMITTED' ? chalk.blue : log.workLogStatus === 'REJECTED' ? chalk.red : chalk.gray;
|
|
119
|
+
table.push([
|
|
120
|
+
log.teamWorkLogId,
|
|
121
|
+
(log.workLogTitle || '-').substring(0, 28) + ((log.workLogTitle || '-').length > 28 ? '...' : ''),
|
|
122
|
+
log.workLogType || '-',
|
|
123
|
+
statusColor(log.workLogStatus || '-'),
|
|
124
|
+
log.creatorName || '-',
|
|
125
|
+
log.projectName || '-',
|
|
126
|
+
log.createDate ? log.createDate.substring(0, 10) : '-',
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
console.log(table.toString());
|
|
131
|
+
console.log();
|
|
132
|
+
console.log(
|
|
133
|
+
chalk.gray(
|
|
134
|
+
` Total: ${data.totalRows} | Page: ${data.pageNo} / ${Math.ceil(data.totalRows / data.pageSize) || 1} | Size: ${data.pageSize}`
|
|
135
|
+
)
|
|
136
|
+
);
|
|
137
|
+
console.log();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return listCommand;
|
|
141
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Command, Option } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { configManager } from '../../../../core/config/manager.js';
|
|
4
|
+
import { apiClient } from '../../../../core/api/client.js';
|
|
5
|
+
import {
|
|
6
|
+
UpdateTeamWorkLogRequest,
|
|
7
|
+
WorkLogType,
|
|
8
|
+
WorkLogStatus,
|
|
9
|
+
} from '../../../../types/team-work-log.js';
|
|
10
|
+
|
|
11
|
+
export function createTeamWorkLogUpdateCommand(): Command {
|
|
12
|
+
const updateCommand = new Command('update');
|
|
13
|
+
updateCommand
|
|
14
|
+
.description('Update team work log information')
|
|
15
|
+
.argument('<work-log-id>', 'Work log ID')
|
|
16
|
+
.option('--title <string>', 'Work log title')
|
|
17
|
+
.option('--type <string>', 'Work log type: DAILY/WEEKLY/MONTHLY/PROJECT/OTHER')
|
|
18
|
+
.option('--content <string>', 'Work log content')
|
|
19
|
+
.option('--hours <number>', 'Work hours')
|
|
20
|
+
.option('--status <string>', 'Work log status: DRAFT/SUBMITTED/APPROVED/REJECTED')
|
|
21
|
+
.addOption(new Option('--env <string>').hideHelp())
|
|
22
|
+
.addOption(new Option('--tenant <string>').hideHelp())
|
|
23
|
+
.option('--dry-run', 'Preview without actual API call')
|
|
24
|
+
.option('--json', 'Output as JSON');
|
|
25
|
+
|
|
26
|
+
updateCommand.action(async (workLogId: string, options: Record<string, unknown>) => {
|
|
27
|
+
const context = configManager.getCurrentContext();
|
|
28
|
+
const environment = context.environment;
|
|
29
|
+
const tenant = context.tenant;
|
|
30
|
+
|
|
31
|
+
const fields: Partial<UpdateTeamWorkLogRequest> = { teamWorkLogId: workLogId };
|
|
32
|
+
if (options.title) fields.workLogTitle = options.title as string;
|
|
33
|
+
if (options.type) fields.workLogType = options.type as WorkLogType;
|
|
34
|
+
if (options.content) fields.workLogContent = options.content as string;
|
|
35
|
+
if (options.hours) fields.workHours = parseFloat(options.hours as string);
|
|
36
|
+
if (options.status) fields.workLogStatus = options.status as WorkLogStatus;
|
|
37
|
+
|
|
38
|
+
const fieldsToUpdate = Object.keys(fields).filter((k) => k !== 'teamWorkLogId');
|
|
39
|
+
if (fieldsToUpdate.length === 0) {
|
|
40
|
+
console.error(
|
|
41
|
+
chalk.red(
|
|
42
|
+
'\n✗ No fields to update. Provide at least one option: --title, --type, --content, --date, --hours, --status\n'
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Validate type if provided
|
|
49
|
+
if (options.type && !['DAILY', 'WEEKLY', 'MONTHLY', 'PROJECT', 'OTHER'].includes(options.type as string)) {
|
|
50
|
+
console.error(
|
|
51
|
+
chalk.red('\n✗ Invalid --type\n Valid values: DAILY, WEEKLY, MONTHLY, PROJECT, OTHER\n')
|
|
52
|
+
);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Validate status if provided
|
|
57
|
+
if (options.status && !['DRAFT', 'SUBMITTED', 'APPROVED', 'REJECTED'].includes(options.status as string)) {
|
|
58
|
+
console.error(
|
|
59
|
+
chalk.red('\n✗ Invalid --status\n Valid values: DRAFT, SUBMITTED, APPROVED, REJECTED\n')
|
|
60
|
+
);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (options.dryRun) {
|
|
65
|
+
console.log(chalk.bold('\n🔍 Dry-Run Mode: Preview update\n'));
|
|
66
|
+
console.log(chalk.gray(' Work Log ID: ') + chalk.white(workLogId));
|
|
67
|
+
if (fields.workLogTitle) console.log(chalk.gray(' Title: ') + chalk.white(fields.workLogTitle));
|
|
68
|
+
if (fields.workLogType) console.log(chalk.gray(' Type: ') + chalk.white(fields.workLogType));
|
|
69
|
+
if (fields.workLogContent)
|
|
70
|
+
console.log(chalk.gray(' Content: ') + chalk.white(fields.workLogContent));
|
|
71
|
+
if (fields.workHours) console.log(chalk.gray(' Hours: ') + chalk.white(fields.workHours));
|
|
72
|
+
if (fields.workLogStatus)
|
|
73
|
+
console.log(chalk.gray(' Status: ') + chalk.white(fields.workLogStatus));
|
|
74
|
+
console.log();
|
|
75
|
+
console.log(chalk.yellow(' ⚠️ This is a dry-run. No API call was made.\n'));
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const response = await apiClient.updateTeamWorkLog(
|
|
81
|
+
environment,
|
|
82
|
+
tenant,
|
|
83
|
+
fields as UpdateTeamWorkLogRequest
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
if (response.success) {
|
|
87
|
+
if (options.json) {
|
|
88
|
+
console.log(JSON.stringify({ success: true, data: response.data }, null, 2));
|
|
89
|
+
} else {
|
|
90
|
+
console.log(chalk.green('\n✓ Team work log updated successfully\n'));
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
if (options.json) {
|
|
94
|
+
console.log(JSON.stringify({ success: false, error: response.error }, null, 2));
|
|
95
|
+
} else {
|
|
96
|
+
console.error(chalk.red(`\n✗ Update failed: ${response.error?.message || 'Unknown error'}`));
|
|
97
|
+
if (response.error?.code) {
|
|
98
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
99
|
+
}
|
|
100
|
+
console.error();
|
|
101
|
+
}
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
if (options.json) {
|
|
106
|
+
console.log(
|
|
107
|
+
JSON.stringify({
|
|
108
|
+
success: false,
|
|
109
|
+
error: { message: error instanceof Error ? error.message : 'Unknown error' },
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
} else {
|
|
113
|
+
console.error(chalk.red(`\n✗ Error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
114
|
+
}
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
return updateCommand;
|
|
120
|
+
}
|