Issue도 Dynamic Table 사용하도록 공유
This commit is contained in:
@@ -1,34 +1,49 @@
|
||||
// src/services/issue.ts
|
||||
import { handleApiError } from "./error";
|
||||
|
||||
// API 응답에 대한 타입을 정의합니다.
|
||||
// 실제 API 명세에 따라 더 구체적으로 작성해야 합니다.
|
||||
export interface Issue {
|
||||
id: string;
|
||||
title: string;
|
||||
feedbackCount: number;
|
||||
name: string;
|
||||
description: string;
|
||||
status: string;
|
||||
category: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
category: string;
|
||||
[key: string]: unknown; // 그 외 다른 필드들
|
||||
|
||||
feedbackCount: number;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface IssueField {
|
||||
id: string;
|
||||
name: string;
|
||||
type: "text" | "textarea" | "number" | "select";
|
||||
readOnly?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이슈 목록에 표시할 필드 스키마를 반환합니다.
|
||||
* 순서: Status, ID, Name, Description, Category
|
||||
*/
|
||||
export const getIssueFields = async (): Promise<IssueField[]> => {
|
||||
const fields: IssueField[] = [
|
||||
{ id: "status", name: "Status", type: "text" },
|
||||
{ id: "id", name: "ID", type: "text" },
|
||||
{ id: "name", name: "Name", type: "text" },
|
||||
{ id: "description", name: "Description", type: "textarea" },
|
||||
{ id: "category", name: "Category", type: "text" },
|
||||
];
|
||||
return Promise.resolve(fields);
|
||||
};
|
||||
|
||||
/**
|
||||
* 특정 프로젝트의 모든 이슈를 검색합니다.
|
||||
* @param projectId 프로젝트 ID
|
||||
* @returns 이슈 목록 Promise
|
||||
*/
|
||||
export const getIssues = async (projectId: string): Promise<Issue[]> => {
|
||||
const url = `/api/projects/${projectId}/issues/search`;
|
||||
// body를 비워서 보내면 모든 이슈를 가져오는 것으로 가정합니다.
|
||||
// 실제 API 명세에 따라 수정이 필요할 수 있습니다.
|
||||
const response = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
|
||||
@@ -37,14 +52,12 @@ export const getIssues = async (projectId: string): Promise<Issue[]> => {
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
// API 응답을 그대로 사용합니다.
|
||||
return result.items || [];
|
||||
};
|
||||
|
||||
/**
|
||||
* 특정 프로젝트의 단일 이슈 상세 정보를 가져옵니다.
|
||||
* @param projectId 프로젝트 ID
|
||||
* @param issueId 이슈 ID
|
||||
* @returns 이슈 상세 정보 Promise
|
||||
*/
|
||||
export const getIssue = async (
|
||||
projectId: string,
|
||||
@@ -60,5 +73,6 @@ export const getIssue = async (
|
||||
);
|
||||
}
|
||||
|
||||
// API 응답을 그대로 사용합니다.
|
||||
return response.json();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user