chore(oas): Update OAS for upload endpoints (#4953)
* chore(oas): Update OAS for upload endpoints * added changeset * address pr feedback
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/client-types": patch
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(medusa): fix types for upload endpoints
|
||||||
@@ -5,7 +5,7 @@ import { SetRelation, Merge } from "../core/ModelUtils"
|
|||||||
|
|
||||||
export interface AdminDeleteUploadsReq {
|
export interface AdminDeleteUploadsReq {
|
||||||
/**
|
/**
|
||||||
* key of the file to delete
|
* key of the file to delete. This is obtained when you first uploaded the file, or by the file service if you used it directly.
|
||||||
*/
|
*/
|
||||||
file_key: string
|
file_key: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { SetRelation, Merge } from "../core/ModelUtils"
|
|||||||
|
|
||||||
export interface AdminPostUploadsDownloadUrlReq {
|
export interface AdminPostUploadsDownloadUrlReq {
|
||||||
/**
|
/**
|
||||||
* key of the file to obtain the download link for
|
* key of the file to obtain the download link for. This is obtained when you first uploaded the file, or by the file service if you used it directly.
|
||||||
*/
|
*/
|
||||||
file_key: string
|
file_key: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,5 +12,9 @@ export interface AdminUploadsRes {
|
|||||||
* The URL of the uploaded file.
|
* The URL of the uploaded file.
|
||||||
*/
|
*/
|
||||||
url: string
|
url: string
|
||||||
|
/**
|
||||||
|
* The key of the file that is identifiable by the file service. It can be used later to retrieve or manipulate the file.
|
||||||
|
*/
|
||||||
|
key: string
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export default async (req, res) => {
|
|||||||
* - file_key
|
* - file_key
|
||||||
* properties:
|
* properties:
|
||||||
* file_key:
|
* file_key:
|
||||||
* description: "key of the file to delete"
|
* description: "key of the file to delete. This is obtained when you first uploaded the file, or by the file service if you used it directly."
|
||||||
* type: string
|
* type: string
|
||||||
*/
|
*/
|
||||||
export class AdminDeleteUploadsReq {
|
export class AdminDeleteUploadsReq {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export default async (req, res) => {
|
|||||||
* - file_key
|
* - file_key
|
||||||
* properties:
|
* properties:
|
||||||
* file_key:
|
* file_key:
|
||||||
* description: "key of the file to obtain the download link for"
|
* description: "key of the file to obtain the download link for. This is obtained when you first uploaded the file, or by the file service if you used it directly."
|
||||||
* type: string
|
* type: string
|
||||||
*/
|
*/
|
||||||
export class AdminPostUploadsDownloadUrlReq {
|
export class AdminPostUploadsDownloadUrlReq {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { DeleteResponse } from "../../../../types/common"
|
|||||||
import middlewares, { transformBody } from "../../../middlewares"
|
import middlewares, { transformBody } from "../../../middlewares"
|
||||||
import { AdminDeleteUploadsReq } from "./delete-upload"
|
import { AdminDeleteUploadsReq } from "./delete-upload"
|
||||||
import { AdminPostUploadsDownloadUrlReq } from "./get-download-url"
|
import { AdminPostUploadsDownloadUrlReq } from "./get-download-url"
|
||||||
|
import { FileServiceUploadResult } from "@medusajs/types"
|
||||||
|
|
||||||
const route = Router()
|
const route = Router()
|
||||||
const upload = multer({ dest: "uploads/" })
|
const upload = multer({ dest: "uploads/" })
|
||||||
@@ -52,14 +53,18 @@ export default (app) => {
|
|||||||
* type: object
|
* type: object
|
||||||
* required:
|
* required:
|
||||||
* - url
|
* - url
|
||||||
|
* - key
|
||||||
* properties:
|
* properties:
|
||||||
* url:
|
* url:
|
||||||
* description: The URL of the uploaded file.
|
* description: The URL of the uploaded file.
|
||||||
* type: string
|
* type: string
|
||||||
* format: uri
|
* format: uri
|
||||||
|
* key:
|
||||||
|
* description: The key of the file that is identifiable by the file service. It can be used later to retrieve or manipulate the file.
|
||||||
|
* type: string
|
||||||
*/
|
*/
|
||||||
export type AdminUploadsRes = {
|
export type AdminUploadsRes = {
|
||||||
uploads: { url: string }[]
|
uploads: FileServiceUploadResult[]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user