Skip to content

Commit 1a1ed53

Browse files
author
catlog22
committed
fix: resolve dashboard issue creation and GitHub pull failures
- Make description optional in issue creation schema to match frontend which sends {title, context, priority} without description field - Add projectPath parameter to pullIssuesFromGitHub so gh command runs in the correct git repo directory instead of process.cwd() - Fix issueDialogStore to send priority as string enum, add description field, and read correct response path (result.data?.issue?.id)
1 parent 6d1da06 commit 1a1ed53

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

ccw/frontend/src/lib/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,12 +1063,13 @@ export interface GitHubPullResponse {
10631063
total: number;
10641064
}
10651065

1066-
export async function pullIssuesFromGitHub(options: GitHubPullOptions = {}): Promise<GitHubPullResponse> {
1066+
export async function pullIssuesFromGitHub(options: GitHubPullOptions & { projectPath?: string } = {}): Promise<GitHubPullResponse> {
10671067
const params = new URLSearchParams();
10681068
if (options.state) params.set('state', options.state);
10691069
if (options.limit) params.set('limit', String(options.limit));
10701070
if (options.labels) params.set('labels', options.labels);
10711071
if (options.downloadImages) params.set('downloadImages', 'true');
1072+
if (options.projectPath) params.set('path', options.projectPath);
10721073

10731074
const url = `/api/issues/pull${params.toString() ? '?' + params.toString() : ''}`;
10741075
return fetchApi<GitHubPullResponse>(url, {

ccw/frontend/src/stores/issueDialogStore.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,11 @@ export const useIssueDialogStore = create<IssueDialogState>()(
238238
method: 'POST',
239239
headers: { 'Content-Type': 'application/json' },
240240
body: JSON.stringify({
241-
id: `ISSUE-${Date.now()}`,
242241
title: formData.title,
242+
description: formData.description,
243243
context: formData.description,
244-
priority: formData.priority === 'urgent' ? 1 :
245-
formData.priority === 'high' ? 2 :
246-
formData.priority === 'medium' ? 3 : 4,
244+
priority: formData.priority,
247245
tags: formData.tags,
248-
status: 'registered',
249246
}),
250247
});
251248

@@ -261,10 +258,10 @@ export const useIssueDialogStore = create<IssueDialogState>()(
261258

262259
set({
263260
isSubmitting: false,
264-
submittedIssueId: result.issue?.id
261+
submittedIssueId: result.data?.issue?.id
265262
});
266263

267-
return { success: true, issueId: result.issue?.id };
264+
return { success: true, issueId: result.data?.issue?.id };
268265
} catch (error) {
269266
const errorMessage = error instanceof Error ? error.message : '网络错误,请稍后重试';
270267
set({ isSubmitting: false, submitError: errorMessage });

ccw/src/core/schemas/issue-schema.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ export const CreateIssueRequestSchema = z.object({
4646
.trim(),
4747

4848
description: z.string()
49-
.min(1, 'Description is required')
50-
.max(10000, 'Description must be at most 10000 characters'),
49+
.max(10000, 'Description must be at most 10000 characters')
50+
.optional()
51+
.default(''),
5152

5253
type: IssueTypeSchema.optional()
5354
.default('other'),

0 commit comments

Comments
 (0)