github-issue-tower-defence-management 1.47.0 → 1.49.0
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/CHANGELOG.md +19 -0
- package/README.md +6 -25
- package/bin/adapter/entry-points/cli/index.js +2 -55
- package/bin/adapter/entry-points/cli/index.js.map +1 -1
- package/bin/adapter/entry-points/cli/projectConfig.js +0 -15
- package/bin/adapter/entry-points/cli/projectConfig.js.map +1 -1
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +12 -53
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
- package/bin/adapter/repositories/GraphqlProjectRepository.js +37 -0
- package/bin/adapter/repositories/GraphqlProjectRepository.js.map +1 -1
- package/bin/domain/entities/WorkflowStatus.js +56 -0
- package/bin/domain/entities/WorkflowStatus.js.map +1 -0
- package/bin/domain/usecases/AnalyzeStoriesUseCase.js +2 -1
- package/bin/domain/usecases/AnalyzeStoriesUseCase.js.map +1 -1
- package/bin/domain/usecases/ChangeStatusByStoryColorUseCase.js +5 -4
- package/bin/domain/usecases/ChangeStatusByStoryColorUseCase.js.map +1 -1
- package/bin/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.js +2 -1
- package/bin/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.js.map +1 -1
- package/bin/domain/usecases/CreateEstimationIssueUseCase.js +2 -1
- package/bin/domain/usecases/CreateEstimationIssueUseCase.js.map +1 -1
- package/bin/domain/usecases/CreateNewStoryByLabelUseCase.js.map +1 -1
- package/bin/domain/usecases/HandleScheduledEventUseCase.js +9 -17
- package/bin/domain/usecases/HandleScheduledEventUseCase.js.map +1 -1
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js +13 -15
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js.map +1 -1
- package/bin/domain/usecases/RevertOrphanedPreparationUseCase.js +4 -5
- package/bin/domain/usecases/RevertOrphanedPreparationUseCase.js.map +1 -1
- package/bin/domain/usecases/SetupTowerDefenceProjectUseCase.js +49 -0
- package/bin/domain/usecases/SetupTowerDefenceProjectUseCase.js.map +1 -0
- package/bin/domain/usecases/StartPreparationUseCase.js +7 -8
- package/bin/domain/usecases/StartPreparationUseCase.js.map +1 -1
- package/bin/domain/usecases/UpdateIssueStatusByLabelUseCase.js.map +1 -1
- package/package.json +1 -1
- package/src/adapter/entry-points/cli/index.test.ts +8 -212
- package/src/adapter/entry-points/cli/index.ts +6 -88
- package/src/adapter/entry-points/cli/projectConfig.ts +0 -33
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.test.ts +5 -17
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +16 -32
- package/src/adapter/repositories/GraphqlProjectRepository.ts +55 -1
- package/src/domain/entities/WorkflowStatus.ts +60 -0
- package/src/domain/usecases/AnalyzeStoriesUseCase.ts +2 -2
- package/src/domain/usecases/ChangeStatusByStoryColorUseCase.test.ts +0 -5
- package/src/domain/usecases/ChangeStatusByStoryColorUseCase.ts +5 -5
- package/src/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.test.ts +2 -13
- package/src/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.ts +2 -2
- package/src/domain/usecases/CreateEstimationIssueUseCase.ts +2 -2
- package/src/domain/usecases/CreateNewStoryByLabelUseCase.test.ts +0 -4
- package/src/domain/usecases/CreateNewStoryByLabelUseCase.ts +0 -1
- package/src/domain/usecases/HandleScheduledEventUseCase.test.ts +4 -41
- package/src/domain/usecases/HandleScheduledEventUseCase.ts +9 -27
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.test.ts +0 -202
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.ts +18 -31
- package/src/domain/usecases/RevertOrphanedPreparationUseCase.test.ts +13 -101
- package/src/domain/usecases/RevertOrphanedPreparationUseCase.ts +10 -10
- package/src/domain/usecases/SetupTowerDefenceProjectUseCase.test.ts +266 -0
- package/src/domain/usecases/SetupTowerDefenceProjectUseCase.ts +73 -0
- package/src/domain/usecases/StartPreparationUseCase.test.ts +1 -151
- package/src/domain/usecases/StartPreparationUseCase.ts +11 -20
- package/src/domain/usecases/UpdateIssueStatusByLabelUseCase.test.ts +2 -47
- package/src/domain/usecases/UpdateIssueStatusByLabelUseCase.ts +1 -5
- package/src/domain/usecases/adapter-interfaces/ProjectRepository.ts +6 -1
- package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
- package/types/adapter/entry-points/cli/projectConfig.d.ts +0 -3
- package/types/adapter/entry-points/cli/projectConfig.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
- package/types/adapter/repositories/GraphqlProjectRepository.d.ts +4 -1
- package/types/adapter/repositories/GraphqlProjectRepository.d.ts.map +1 -1
- package/types/domain/entities/WorkflowStatus.d.ts +17 -0
- package/types/domain/entities/WorkflowStatus.d.ts.map +1 -0
- package/types/domain/usecases/AnalyzeStoriesUseCase.d.ts +0 -1
- package/types/domain/usecases/AnalyzeStoriesUseCase.d.ts.map +1 -1
- package/types/domain/usecases/ChangeStatusByStoryColorUseCase.d.ts +0 -1
- package/types/domain/usecases/ChangeStatusByStoryColorUseCase.d.ts.map +1 -1
- package/types/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.d.ts +0 -1
- package/types/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.d.ts.map +1 -1
- package/types/domain/usecases/CreateEstimationIssueUseCase.d.ts +0 -1
- package/types/domain/usecases/CreateEstimationIssueUseCase.d.ts.map +1 -1
- package/types/domain/usecases/CreateNewStoryByLabelUseCase.d.ts +0 -1
- package/types/domain/usecases/CreateNewStoryByLabelUseCase.d.ts.map +1 -1
- package/types/domain/usecases/HandleScheduledEventUseCase.d.ts +3 -8
- package/types/domain/usecases/HandleScheduledEventUseCase.d.ts.map +1 -1
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts +1 -4
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts.map +1 -1
- package/types/domain/usecases/RevertOrphanedPreparationUseCase.d.ts +0 -3
- package/types/domain/usecases/RevertOrphanedPreparationUseCase.d.ts.map +1 -1
- package/types/domain/usecases/SetupTowerDefenceProjectUseCase.d.ts +10 -0
- package/types/domain/usecases/SetupTowerDefenceProjectUseCase.d.ts.map +1 -0
- package/types/domain/usecases/StartPreparationUseCase.d.ts +1 -3
- package/types/domain/usecases/StartPreparationUseCase.d.ts.map +1 -1
- package/types/domain/usecases/UpdateIssueStatusByLabelUseCase.d.ts +0 -1
- package/types/domain/usecases/UpdateIssueStatusByLabelUseCase.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/ProjectRepository.d.ts +3 -1
- package/types/domain/usecases/adapter-interfaces/ProjectRepository.d.ts.map +1 -1
|
@@ -2,6 +2,7 @@ import { IssueRepository } from './adapter-interfaces/IssueRepository';
|
|
|
2
2
|
import { Project } from '../entities/Project';
|
|
3
3
|
import { DateRepository } from './adapter-interfaces/DateRepository';
|
|
4
4
|
import { StoryObjectMap } from '../entities/StoryObjectMap';
|
|
5
|
+
import { ICEBOX_STATUS_NAME } from '../entities/WorkflowStatus';
|
|
5
6
|
|
|
6
7
|
export class ChangeStatusByStoryColorUseCase {
|
|
7
8
|
constructor(
|
|
@@ -17,7 +18,6 @@ export class ChangeStatusByStoryColorUseCase {
|
|
|
17
18
|
cacheUsed: boolean;
|
|
18
19
|
org: string;
|
|
19
20
|
repo: string;
|
|
20
|
-
disabledStatus: string;
|
|
21
21
|
storyObjectMap: StoryObjectMap;
|
|
22
22
|
}): Promise<void> => {
|
|
23
23
|
const firstStatus = input.project.status.statuses[0];
|
|
@@ -27,16 +27,16 @@ export class ChangeStatusByStoryColorUseCase {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
const disabledStatusObject = input.project.status.statuses.find(
|
|
30
|
-
(status) => status.name ===
|
|
30
|
+
(status) => status.name === ICEBOX_STATUS_NAME,
|
|
31
31
|
);
|
|
32
32
|
if (!disabledStatusObject) {
|
|
33
|
-
throw new Error('
|
|
33
|
+
throw new Error('Icebox status is not found');
|
|
34
34
|
}
|
|
35
35
|
for (const storyObject of Array.from(input.storyObjectMap.values())) {
|
|
36
36
|
const isStoryDisabled = storyObject.story.color === 'GRAY';
|
|
37
37
|
for (const issue of storyObject.issues) {
|
|
38
38
|
if (isStoryDisabled) {
|
|
39
|
-
if (issue.status && issue.status ===
|
|
39
|
+
if (issue.status && issue.status === ICEBOX_STATUS_NAME) {
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
42
|
await this.issueRepository.updateStatus(
|
|
@@ -49,7 +49,7 @@ export class ChangeStatusByStoryColorUseCase {
|
|
|
49
49
|
`This issue status is changed because the story is disabled.`,
|
|
50
50
|
);
|
|
51
51
|
} else if (!isStoryDisabled) {
|
|
52
|
-
if (issue.status && issue.status !==
|
|
52
|
+
if (issue.status && issue.status !== ICEBOX_STATUS_NAME) {
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
55
55
|
await this.issueRepository.updateStatus(
|
|
@@ -99,7 +99,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
99
99
|
issues: Issue[];
|
|
100
100
|
cacheUsed: boolean;
|
|
101
101
|
urlOfStoryView: string;
|
|
102
|
-
disabledStatus: string;
|
|
103
102
|
storyObjectMap: StoryObjectMap;
|
|
104
103
|
};
|
|
105
104
|
expectedThrowError?: Error;
|
|
@@ -122,7 +121,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
122
121
|
issues: [basicStoryIssue1],
|
|
123
122
|
cacheUsed: false,
|
|
124
123
|
urlOfStoryView: 'https://example.com',
|
|
125
|
-
disabledStatus: 'Closed',
|
|
126
124
|
storyObjectMap: basicStoryObjectMap,
|
|
127
125
|
},
|
|
128
126
|
expectedCreateNewIssueCalls: [],
|
|
@@ -137,7 +135,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
137
135
|
issues: [basicStoryIssue1],
|
|
138
136
|
cacheUsed: true,
|
|
139
137
|
urlOfStoryView: 'https://example.com',
|
|
140
|
-
disabledStatus: 'Closed',
|
|
141
138
|
storyObjectMap: basicStoryObjectMap,
|
|
142
139
|
},
|
|
143
140
|
expectedCreateNewIssueCalls: [],
|
|
@@ -152,7 +149,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
152
149
|
issues: [basicStoryIssue1],
|
|
153
150
|
cacheUsed: false,
|
|
154
151
|
urlOfStoryView: 'https://example.com',
|
|
155
|
-
disabledStatus: 'Closed',
|
|
156
152
|
storyObjectMap: regularStoryObjectMap,
|
|
157
153
|
},
|
|
158
154
|
expectedCreateNewIssueCalls: [],
|
|
@@ -167,7 +163,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
167
163
|
issues: [],
|
|
168
164
|
cacheUsed: false,
|
|
169
165
|
urlOfStoryView: 'https://example.com',
|
|
170
|
-
disabledStatus: 'Closed',
|
|
171
166
|
storyObjectMap: basicStoryObjectMap,
|
|
172
167
|
},
|
|
173
168
|
expectedThrowError: new Error('Story issue not found: Story 1'),
|
|
@@ -178,7 +173,7 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
178
173
|
},
|
|
179
174
|
|
|
180
175
|
{
|
|
181
|
-
name: 'should skip closed story issues or
|
|
176
|
+
name: 'should skip closed story issues or icebox status',
|
|
182
177
|
input: {
|
|
183
178
|
project: basicProject,
|
|
184
179
|
issues: [
|
|
@@ -189,12 +184,11 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
189
184
|
},
|
|
190
185
|
{
|
|
191
186
|
...basicStoryIssue2,
|
|
192
|
-
status: '
|
|
187
|
+
status: 'Icebox',
|
|
193
188
|
},
|
|
194
189
|
],
|
|
195
190
|
cacheUsed: false,
|
|
196
191
|
urlOfStoryView: 'https://example.com',
|
|
197
|
-
disabledStatus: 'Disabled',
|
|
198
192
|
storyObjectMap: basicStoryObjectMap,
|
|
199
193
|
},
|
|
200
194
|
expectedCreateNewIssueCalls: [],
|
|
@@ -209,7 +203,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
209
203
|
issues: [basicStoryIssue1, basicStoryIssue2],
|
|
210
204
|
cacheUsed: false,
|
|
211
205
|
urlOfStoryView: 'https://example.com',
|
|
212
|
-
disabledStatus: 'Closed',
|
|
213
206
|
storyObjectMap: basicStoryObjectMap,
|
|
214
207
|
},
|
|
215
208
|
expectedCreateNewIssueCalls: [
|
|
@@ -365,7 +358,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
365
358
|
],
|
|
366
359
|
cacheUsed: false,
|
|
367
360
|
urlOfStoryView: 'https://example.com',
|
|
368
|
-
disabledStatus: 'Closed',
|
|
369
361
|
storyObjectMap: new Map([['Story 1', basicStoryObject1]]),
|
|
370
362
|
},
|
|
371
363
|
expectedCreateNewIssueCalls: [
|
|
@@ -428,7 +420,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
|
|
|
428
420
|
],
|
|
429
421
|
cacheUsed: false,
|
|
430
422
|
urlOfStoryView: 'https://example.com',
|
|
431
|
-
disabledStatus: 'Closed',
|
|
432
423
|
storyObjectMap: new Map([
|
|
433
424
|
[
|
|
434
425
|
'Story 1',
|
|
@@ -470,7 +461,6 @@ Some description without checkboxes`,
|
|
|
470
461
|
],
|
|
471
462
|
cacheUsed: false,
|
|
472
463
|
urlOfStoryView: 'https://example.com',
|
|
473
|
-
disabledStatus: 'Closed',
|
|
474
464
|
storyObjectMap: basicStoryObjectMap,
|
|
475
465
|
},
|
|
476
466
|
expectedCreateNewIssueCalls: [
|
|
@@ -624,7 +614,6 @@ Some description without checkboxes`,
|
|
|
624
614
|
],
|
|
625
615
|
cacheUsed: false,
|
|
626
616
|
urlOfStoryView: 'https://example.com',
|
|
627
|
-
disabledStatus: 'Closed',
|
|
628
617
|
storyObjectMap: new Map([
|
|
629
618
|
[
|
|
630
619
|
'Story 1',
|
|
@@ -3,6 +3,7 @@ import { IssueRepository } from './adapter-interfaces/IssueRepository';
|
|
|
3
3
|
import { Project } from '../entities/Project';
|
|
4
4
|
import { StoryObjectMap } from '../entities/StoryObjectMap';
|
|
5
5
|
import { encodeForURI } from './utils';
|
|
6
|
+
import { ICEBOX_STATUS_NAME } from '../entities/WorkflowStatus';
|
|
6
7
|
|
|
7
8
|
export class ConvertCheckboxToIssueInStoryIssueUseCase {
|
|
8
9
|
constructor(
|
|
@@ -17,7 +18,6 @@ export class ConvertCheckboxToIssueInStoryIssueUseCase {
|
|
|
17
18
|
issues: Issue[];
|
|
18
19
|
cacheUsed: boolean;
|
|
19
20
|
urlOfStoryView: string;
|
|
20
|
-
disabledStatus: string;
|
|
21
21
|
storyObjectMap: StoryObjectMap;
|
|
22
22
|
}): Promise<void> => {
|
|
23
23
|
const story = input.project.story;
|
|
@@ -36,7 +36,7 @@ export class ConvertCheckboxToIssueInStoryIssueUseCase {
|
|
|
36
36
|
throw new Error(`Story issue not found: ${storyOption.name}`);
|
|
37
37
|
} else if (
|
|
38
38
|
storyIssue.isClosed ||
|
|
39
|
-
storyIssue.status ===
|
|
39
|
+
storyIssue.status === ICEBOX_STATUS_NAME
|
|
40
40
|
) {
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
@@ -5,6 +5,7 @@ import { Member } from '../entities/Member';
|
|
|
5
5
|
import { DateRepository } from './adapter-interfaces/DateRepository';
|
|
6
6
|
import { StoryObjectMap } from '../entities/StoryObjectMap';
|
|
7
7
|
import { encodeForURI } from './utils';
|
|
8
|
+
import { ICEBOX_STATUS_NAME } from '../entities/WorkflowStatus';
|
|
8
9
|
|
|
9
10
|
export class CreateEstimationIssueUseCase {
|
|
10
11
|
constructor(
|
|
@@ -24,7 +25,6 @@ export class CreateEstimationIssueUseCase {
|
|
|
24
25
|
org: string;
|
|
25
26
|
repo: string;
|
|
26
27
|
urlOfStoryView: string;
|
|
27
|
-
disabledStatus: string;
|
|
28
28
|
storyObjectMap: StoryObjectMap;
|
|
29
29
|
}): Promise<void> => {
|
|
30
30
|
const story = input.project.story;
|
|
@@ -66,7 +66,7 @@ export class CreateEstimationIssueUseCase {
|
|
|
66
66
|
issueInStory.isClosed ||
|
|
67
67
|
issueInStory.isPr ||
|
|
68
68
|
issueInStory.labels.includes('story') ||
|
|
69
|
-
issueInStory.status ===
|
|
69
|
+
issueInStory.status === ICEBOX_STATUS_NAME
|
|
70
70
|
) {
|
|
71
71
|
continue;
|
|
72
72
|
}
|
|
@@ -84,7 +84,6 @@ describe('CreateNewStoryByLabelUseCase', () => {
|
|
|
84
84
|
cacheUsed: false,
|
|
85
85
|
org: 'testOrg',
|
|
86
86
|
repo: 'testRepo',
|
|
87
|
-
disabledStatus: 'Icebox',
|
|
88
87
|
storyObjectMap: new Map([['Story 1', storyObjectWithNewStoryIssues]]),
|
|
89
88
|
});
|
|
90
89
|
|
|
@@ -105,7 +104,6 @@ describe('CreateNewStoryByLabelUseCase', () => {
|
|
|
105
104
|
cacheUsed: false,
|
|
106
105
|
org: 'testOrg',
|
|
107
106
|
repo: 'testRepo',
|
|
108
|
-
disabledStatus: 'Icebox',
|
|
109
107
|
storyObjectMap: new Map([
|
|
110
108
|
['Story 1', storyObjectWithoutNewStoryIssues],
|
|
111
109
|
]),
|
|
@@ -142,7 +140,6 @@ describe('CreateNewStoryByLabelUseCase', () => {
|
|
|
142
140
|
cacheUsed: false,
|
|
143
141
|
org: 'testOrg',
|
|
144
142
|
repo: 'testRepo',
|
|
145
|
-
disabledStatus: 'Icebox',
|
|
146
143
|
storyObjectMap: new Map([['Story 1', storyObjectWithNewStoryIssues]]),
|
|
147
144
|
});
|
|
148
145
|
|
|
@@ -239,7 +236,6 @@ describe('CreateNewStoryByLabelUseCase', () => {
|
|
|
239
236
|
cacheUsed: false,
|
|
240
237
|
org: 'testOrg',
|
|
241
238
|
repo: 'testRepo',
|
|
242
|
-
disabledStatus: 'Icebox',
|
|
243
239
|
storyObjectMap: new Map([['Story 1', storyObject]]),
|
|
244
240
|
});
|
|
245
241
|
|
|
@@ -22,6 +22,7 @@ import { UpdateIssueStatusByLabelUseCase } from './UpdateIssueStatusByLabelUseCa
|
|
|
22
22
|
import { StartPreparationUseCase } from './StartPreparationUseCase';
|
|
23
23
|
import { NotifyFinishedIssuePreparationUseCase } from './NotifyFinishedIssuePreparationUseCase';
|
|
24
24
|
import { RevertOrphanedPreparationUseCase } from './RevertOrphanedPreparationUseCase';
|
|
25
|
+
import { SetupTowerDefenceProjectUseCase } from './SetupTowerDefenceProjectUseCase';
|
|
25
26
|
|
|
26
27
|
describe('HandleScheduledEventUseCase', () => {
|
|
27
28
|
describe('createTargetDateTimes', () => {
|
|
@@ -80,6 +81,8 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
describe('run', () => {
|
|
84
|
+
const mockSetupTowerDefenceProjectUseCase =
|
|
85
|
+
mock<SetupTowerDefenceProjectUseCase>();
|
|
83
86
|
const mockActionAnnouncementUseCase = mock<ActionAnnouncementUseCase>();
|
|
84
87
|
const mockSetWorkflowManagementIssueToStoryUseCase =
|
|
85
88
|
mock<SetWorkflowManagementIssueToStoryUseCase>();
|
|
@@ -115,6 +118,7 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
115
118
|
const mockIssueRepository = mock<IssueRepository>();
|
|
116
119
|
|
|
117
120
|
const useCase = new HandleScheduledEventUseCase(
|
|
121
|
+
mockSetupTowerDefenceProjectUseCase,
|
|
118
122
|
mockActionAnnouncementUseCase,
|
|
119
123
|
mockSetWorkflowManagementIssueToStoryUseCase,
|
|
120
124
|
mockClearPastNextActionDateHourUseCase,
|
|
@@ -166,8 +170,6 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
166
170
|
spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
|
|
167
171
|
},
|
|
168
172
|
urlOfStoryView: 'https://github.com/test-org/test-project/issues',
|
|
169
|
-
disabledStatus: 'disabled',
|
|
170
|
-
defaultStatus: null,
|
|
171
173
|
disabled: false,
|
|
172
174
|
allowIssueCacheMinutes: 60,
|
|
173
175
|
};
|
|
@@ -190,8 +192,6 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
190
192
|
spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
|
|
191
193
|
},
|
|
192
194
|
urlOfStoryView: 'https://github.com/test-org/test-project/issues',
|
|
193
|
-
disabledStatus: 'disabled',
|
|
194
|
-
defaultStatus: 'ToDo',
|
|
195
195
|
disabled: false,
|
|
196
196
|
allowIssueCacheMinutes: 60,
|
|
197
197
|
};
|
|
@@ -202,35 +202,6 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
202
202
|
expect(mockUpdateIssueStatusByLabelUseCase.run).toHaveBeenCalledWith({
|
|
203
203
|
project: mockProject,
|
|
204
204
|
issues: [],
|
|
205
|
-
defaultStatus: 'ToDo',
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('should accept null for defaultStatus parameter', async () => {
|
|
210
|
-
const input = {
|
|
211
|
-
projectName: 'test-project',
|
|
212
|
-
org: 'test-org',
|
|
213
|
-
projectUrl: 'https://github.com/test-org/test-project',
|
|
214
|
-
manager: 'test-manager',
|
|
215
|
-
workingReport: {
|
|
216
|
-
repo: 'test-repo',
|
|
217
|
-
members: ['member1'],
|
|
218
|
-
spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
|
|
219
|
-
},
|
|
220
|
-
urlOfStoryView: 'https://github.com/test-org/test-project/issues',
|
|
221
|
-
disabledStatus: 'disabled',
|
|
222
|
-
defaultStatus: null,
|
|
223
|
-
disabled: false,
|
|
224
|
-
allowIssueCacheMinutes: 60,
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
const mockProject = mock<Project>();
|
|
228
|
-
mockProjectRepository.getProject.mockResolvedValue(mockProject);
|
|
229
|
-
await useCase.run(input);
|
|
230
|
-
expect(mockUpdateIssueStatusByLabelUseCase.run).toHaveBeenCalledWith({
|
|
231
|
-
project: mockProject,
|
|
232
|
-
issues: [],
|
|
233
|
-
defaultStatus: null,
|
|
234
205
|
});
|
|
235
206
|
});
|
|
236
207
|
|
|
@@ -246,8 +217,6 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
246
217
|
spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
|
|
247
218
|
},
|
|
248
219
|
urlOfStoryView: 'https://github.com/test-org/test-project/issues',
|
|
249
|
-
disabledStatus: 'disabled',
|
|
250
|
-
defaultStatus: null,
|
|
251
220
|
disabled: true,
|
|
252
221
|
allowIssueCacheMinutes: 60,
|
|
253
222
|
};
|
|
@@ -271,8 +240,6 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
271
240
|
spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
|
|
272
241
|
},
|
|
273
242
|
urlOfStoryView: 'https://github.com/test-org/test-project/issues',
|
|
274
|
-
disabledStatus: 'disabled',
|
|
275
|
-
defaultStatus: null,
|
|
276
243
|
disabled: false,
|
|
277
244
|
allowIssueCacheMinutes: 60,
|
|
278
245
|
};
|
|
@@ -296,8 +263,6 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
296
263
|
spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
|
|
297
264
|
},
|
|
298
265
|
urlOfStoryView: 'https://github.com/test-org/test-project/issues',
|
|
299
|
-
disabledStatus: 'disabled',
|
|
300
|
-
defaultStatus: null,
|
|
301
266
|
disabled: false,
|
|
302
267
|
allowIssueCacheMinutes: 120,
|
|
303
268
|
};
|
|
@@ -323,8 +288,6 @@ describe('HandleScheduledEventUseCase', () => {
|
|
|
323
288
|
spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
|
|
324
289
|
},
|
|
325
290
|
urlOfStoryView: 'https://github.com/test-org/test-project/issues',
|
|
326
|
-
disabledStatus: 'disabled',
|
|
327
|
-
defaultStatus: null,
|
|
328
291
|
disabled: false,
|
|
329
292
|
allowIssueCacheMinutes: 60,
|
|
330
293
|
};
|
|
@@ -22,6 +22,8 @@ import { UpdateIssueStatusByLabelUseCase } from './UpdateIssueStatusByLabelUseCa
|
|
|
22
22
|
import { StartPreparationUseCase } from './StartPreparationUseCase';
|
|
23
23
|
import { NotifyFinishedIssuePreparationUseCase } from './NotifyFinishedIssuePreparationUseCase';
|
|
24
24
|
import { RevertOrphanedPreparationUseCase } from './RevertOrphanedPreparationUseCase';
|
|
25
|
+
import { SetupTowerDefenceProjectUseCase } from './SetupTowerDefenceProjectUseCase';
|
|
26
|
+
import { PREPARATION_STATUS_NAME } from '../entities/WorkflowStatus';
|
|
25
27
|
|
|
26
28
|
export class ProjectNotFoundError extends Error {
|
|
27
29
|
constructor(message: string) {
|
|
@@ -32,6 +34,7 @@ export class ProjectNotFoundError extends Error {
|
|
|
32
34
|
|
|
33
35
|
export class HandleScheduledEventUseCase {
|
|
34
36
|
constructor(
|
|
37
|
+
readonly setupTowerDefenceProjectUseCase: SetupTowerDefenceProjectUseCase,
|
|
35
38
|
readonly actionAnnouncementUseCase: ActionAnnouncementUseCase,
|
|
36
39
|
readonly setWorkflowManagementIssueToStoryUseCase: SetWorkflowManagementIssueToStoryUseCase,
|
|
37
40
|
readonly clearPastNextActionUseCase: ClearPastNextActionDateHourUseCase,
|
|
@@ -65,13 +68,9 @@ export class HandleScheduledEventUseCase {
|
|
|
65
68
|
spreadsheetUrl: string;
|
|
66
69
|
};
|
|
67
70
|
urlOfStoryView: string;
|
|
68
|
-
disabledStatus: string;
|
|
69
|
-
defaultStatus: string | null;
|
|
70
71
|
disabled: boolean;
|
|
71
72
|
allowIssueCacheMinutes: number;
|
|
72
73
|
startPreparation?: {
|
|
73
|
-
awaitingWorkspaceStatus: string;
|
|
74
|
-
preparationStatus: string;
|
|
75
74
|
defaultAgentName: string;
|
|
76
75
|
defaultLlmModelName?: string | null;
|
|
77
76
|
defaultLlmAgentName?: string | null;
|
|
@@ -85,9 +84,6 @@ export class HandleScheduledEventUseCase {
|
|
|
85
84
|
awLogStaleThresholdMinutes?: number;
|
|
86
85
|
} | null;
|
|
87
86
|
notifyFinishedPreparation?: {
|
|
88
|
-
preparationStatus: string;
|
|
89
|
-
awaitingWorkspaceStatus: string;
|
|
90
|
-
awaitingQualityCheckStatus: string;
|
|
91
87
|
thresholdForAutoReject: number;
|
|
92
88
|
workflowBlockerResolvedWebhookUrl: string | null;
|
|
93
89
|
} | null;
|
|
@@ -101,6 +97,9 @@ export class HandleScheduledEventUseCase {
|
|
|
101
97
|
if (input.disabled) {
|
|
102
98
|
return null;
|
|
103
99
|
}
|
|
100
|
+
await this.setupTowerDefenceProjectUseCase.run({
|
|
101
|
+
projectUrl: input.projectUrl,
|
|
102
|
+
});
|
|
104
103
|
const projectId = await this.projectRepository.findProjectIdByUrl(
|
|
105
104
|
input.projectUrl,
|
|
106
105
|
);
|
|
@@ -297,7 +296,6 @@ ${JSON.stringify(e)}
|
|
|
297
296
|
org: input.org,
|
|
298
297
|
repo: input.workingReport.repo,
|
|
299
298
|
urlOfStoryView: input.urlOfStoryView,
|
|
300
|
-
disabledStatus: input.disabledStatus,
|
|
301
299
|
storyObjectMap: storyObjectMap,
|
|
302
300
|
});
|
|
303
301
|
await this.convertCheckboxToIssueInStoryIssueUseCase.run({
|
|
@@ -305,7 +303,6 @@ ${JSON.stringify(e)}
|
|
|
305
303
|
issues,
|
|
306
304
|
cacheUsed,
|
|
307
305
|
urlOfStoryView: input.urlOfStoryView,
|
|
308
|
-
disabledStatus: input.disabledStatus,
|
|
309
306
|
storyObjectMap: storyObjectMap,
|
|
310
307
|
});
|
|
311
308
|
await this.changeStatusByStoryColorUseCase.run({
|
|
@@ -313,7 +310,6 @@ ${JSON.stringify(e)}
|
|
|
313
310
|
cacheUsed,
|
|
314
311
|
org: input.org,
|
|
315
312
|
repo: input.workingReport.repo,
|
|
316
|
-
disabledStatus: input.disabledStatus,
|
|
317
313
|
storyObjectMap: storyObjectMap,
|
|
318
314
|
});
|
|
319
315
|
await this.createNewStoryByLabelUseCase.run({
|
|
@@ -321,7 +317,6 @@ ${JSON.stringify(e)}
|
|
|
321
317
|
cacheUsed,
|
|
322
318
|
org: input.org,
|
|
323
319
|
repo: input.workingReport.repo,
|
|
324
|
-
disabledStatus: input.disabledStatus,
|
|
325
320
|
storyObjectMap: storyObjectMap,
|
|
326
321
|
});
|
|
327
322
|
await this.assignNoAssigneeIssueToManagerUseCase.run({
|
|
@@ -332,17 +327,11 @@ ${JSON.stringify(e)}
|
|
|
332
327
|
await this.updateIssueStatusByLabelUseCase.run({
|
|
333
328
|
project,
|
|
334
329
|
issues,
|
|
335
|
-
defaultStatus: input.defaultStatus,
|
|
336
330
|
});
|
|
337
331
|
if (input.startPreparation) {
|
|
338
332
|
if (input.startPreparation.preparationProcessCheckCommand) {
|
|
339
333
|
await this.revertOrphanedPreparationUseCase.run({
|
|
340
334
|
projectUrl: input.projectUrl,
|
|
341
|
-
preparationStatus: input.startPreparation.preparationStatus,
|
|
342
|
-
awaitingWorkspaceStatus:
|
|
343
|
-
input.startPreparation.awaitingWorkspaceStatus,
|
|
344
|
-
awaitingQualityCheckStatus:
|
|
345
|
-
input.notifyFinishedPreparation?.awaitingQualityCheckStatus,
|
|
346
335
|
allowIssueCacheMinutes: input.allowIssueCacheMinutes,
|
|
347
336
|
preparationProcessCheckCommand:
|
|
348
337
|
input.startPreparation.preparationProcessCheckCommand,
|
|
@@ -353,8 +342,6 @@ ${JSON.stringify(e)}
|
|
|
353
342
|
}
|
|
354
343
|
await this.startPreparationUseCase.run({
|
|
355
344
|
projectUrl: input.projectUrl,
|
|
356
|
-
awaitingWorkspaceStatus: input.startPreparation.awaitingWorkspaceStatus,
|
|
357
|
-
preparationStatus: input.startPreparation.preparationStatus,
|
|
358
345
|
defaultAgentName: input.startPreparation.defaultAgentName,
|
|
359
346
|
defaultLlmModelName: input.startPreparation.defaultLlmModelName ?? null,
|
|
360
347
|
defaultLlmAgentName: input.startPreparation.defaultLlmAgentName ?? null,
|
|
@@ -371,21 +358,16 @@ ${JSON.stringify(e)}
|
|
|
371
358
|
if (input.notifyFinishedPreparation) {
|
|
372
359
|
const notifyFinishedPreparation = input.notifyFinishedPreparation;
|
|
373
360
|
const preparationIssues = issues.filter(
|
|
374
|
-
(issue) => issue.status ===
|
|
361
|
+
(issue) => issue.status === PREPARATION_STATUS_NAME,
|
|
375
362
|
);
|
|
376
363
|
for (const issue of preparationIssues) {
|
|
377
364
|
await this.notifyFinishedIssuePreparationUseCase.run({
|
|
378
365
|
projectUrl: input.projectUrl,
|
|
379
366
|
issueUrl: issue.url,
|
|
380
|
-
preparationStatus: input.notifyFinishedPreparation.preparationStatus,
|
|
381
|
-
awaitingWorkspaceStatus:
|
|
382
|
-
input.notifyFinishedPreparation.awaitingWorkspaceStatus,
|
|
383
|
-
awaitingQualityCheckStatus:
|
|
384
|
-
input.notifyFinishedPreparation.awaitingQualityCheckStatus,
|
|
385
367
|
thresholdForAutoReject:
|
|
386
|
-
|
|
368
|
+
notifyFinishedPreparation.thresholdForAutoReject,
|
|
387
369
|
workflowBlockerResolvedWebhookUrl:
|
|
388
|
-
|
|
370
|
+
notifyFinishedPreparation.workflowBlockerResolvedWebhookUrl,
|
|
389
371
|
});
|
|
390
372
|
}
|
|
391
373
|
}
|