docs: fixes to references for draft orders and files (#12693)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-06-10 18:33:53 +03:00
1 parent 5ba842bfb0
commit e5ec907aad
2 files changed
+12 -7

No files matched your search

@@ -15,11 +15,11 @@ import { TypeList, WorkflowDiagram } from "docs-ui"
This documentation provides a reference to the `deleteDraftOrdersWorkflow`. It belongs to the `@medusajs/medusa/core-flows` package.
This workflow deletes draft orders.
This workflow deletes draft orders. It's used by the [Delete Draft Order API route](https://docs.medusajs.com/api/admin#draft-orders\_deletedraftordersid).
You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around canceling an order.
You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around deleting a draft order.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/cab00ff2b8935fdd788157ee36402ae59b079268/packages/core/core-flows/src/draft-order/workflows/delete-draft-order.ts#L61" />
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1a7847660890ae84648123567ce8dc4c9a0eca03/packages/core/core-flows/src/draft-order/workflows/delete-draft-order.ts#L59" />
## Examples
@@ -123,23 +123,28 @@ deletes a product image, or other custom file deletions.
```ts
class MyFileProviderService extends AbstractFileProviderService {
// ...
async delete(file: ProviderDeleteFileDTO): Promise<void> {
async delete(
files: FileTypes.ProviderDeleteFileDTO | FileTypes.ProviderDeleteFileDTO[]
): Promise<void> {
// TODO logic to remove the file from storage
// Use the `file.fileKey` to delete the file, which is the identifier of the file
// in the provider's storage.
// for example:
this.client.delete(file.fileKey)
const fileArray = Array.isArray(files) ? files : [files]
for (const file of fileArray) {
this.client.delete(file.fileKey)
}
}
}
```
#### Parameters
<TypeList types={[{"name":"files","type":"[ProviderDeleteFileDTO](../../../types/FileTypes/interfaces/types.FileTypes.ProviderDeleteFileDTO/page.mdx) \\| [ProviderDeleteFileDTO](../../../types/FileTypes/interfaces/types.FileTypes.ProviderDeleteFileDTO/page.mdx)[]","description":"The details of the file(s) to delete.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"fileKey","type":"`string`","description":"The file's key. When uploading a file, the\nreturned key is used here.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
<TypeList types={[{"name":"files","type":"[ProviderDeleteFileDTO](../../../types/FileTypes/interfaces/types.FileTypes.ProviderDeleteFileDTO/page.mdx) \\| [ProviderDeleteFileDTO](../../../types/FileTypes/interfaces/types.FileTypes.ProviderDeleteFileDTO/page.mdx)[]","description":"The details of the files to delete.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"fileKey","type":"`string`","description":"The file's key. When uploading a file, the\nreturned key is used here.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
#### Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;void&#62;","optional":false,"defaultValue":"","description":"Resolves when the file is deleted.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
<TypeList types={[{"name":"Promise","type":"Promise&#60;void&#62;","optional":false,"defaultValue":"","description":"Resolves when the files are deleted.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
### getAsBuffer