-
Notifications
You must be signed in to change notification settings - Fork 2
wip #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
wip #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,11 @@ import type { | |
| ProcessDefinitionDetail, | ||
| ProcessDefinitionSimple, | ||
| ProcessDefinitionsPage, | ||
| CreateProcessDefinitionBody | ||
| } from '@base/openapi'; | ||
|
|
||
| import { createProcessDefinition as createProcessDefinitionApi } from '@base/openapi'; | ||
|
|
||
| export type { ProcessDefinitionDetail, ProcessDefinitionSimple, ProcessDefinitionsPage }; | ||
|
|
||
| // Statistics types | ||
|
|
@@ -82,8 +85,18 @@ export const getProcessDefinition = async ( | |
| * Deploy a process definition | ||
| */ | ||
| export const createProcessDefinition = async (xml: string): Promise<ProcessDefinitionDetail> => { | ||
| const response = await AXIOS_INSTANCE.post<ProcessDefinitionDetail>('/process-definitions', xml, { | ||
| headers: { 'Content-Type': 'application/xml' }, | ||
| }); | ||
| return response.data; | ||
| // Convert XML string to Blob | ||
| const blob = new Blob([xml], { type: 'application/xml' }); | ||
|
|
||
| // Create request body for the generated client | ||
| const requestBody: CreateProcessDefinitionBody = { | ||
| resource: blob | ||
| }; | ||
|
|
||
| // Call the generated client | ||
| const response = await createProcessDefinitionApi(requestBody); | ||
| const processDefinitionKey = response.processDefinitionKey; | ||
|
|
||
| const detailResponse = await getProcessDefinition(processDefinitionKey); | ||
| return detailResponse; | ||
| }; | ||
|
Comment on lines
87
to
102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This implementation makes two separate API calls: one to create the process definition and another to fetch its details. This is inefficient. To improve performance, consider modifying the backend |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,10 +16,10 @@ export default defineConfig({ | |
| server: { | ||
| port: 3000, | ||
| proxy: { | ||
| '/api': { | ||
| '/v1': { | ||
| target: 'http://localhost:8080', | ||
| changeOrigin: true, | ||
| rewrite: (path) => path.replace(/^\/api/, '/v1'), | ||
| // rewrite: (path) => path.replace(/^\/api/, '/v1'), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }, | ||
| }, | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Blobis created withtype: 'application/xml', but the OpenAPI specification for this endpoint (openapi/api.yamlline 497) specifiescontentType: application/octet-streamfor theresourcepart. While BPMN files are XML-based, it's best to align with the API contract to prevent potential issues.