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:
Shahed Nasser
2023-09-06 17:39:19 +03:00
committed by GitHub
parent 46e224dcb4
commit 9781089ca3
7 changed files with 20 additions and 5 deletions
+6
View File
@@ -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 {
/**
* 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
}
@@ -5,7 +5,7 @@ import { SetRelation, Merge } from "../core/ModelUtils"
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
}
@@ -12,5 +12,9 @@ export interface AdminUploadsRes {
* The URL of the uploaded file.
*/
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
* properties:
* 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
*/
export class AdminDeleteUploadsReq {
@@ -76,7 +76,7 @@ export default async (req, res) => {
* - file_key
* properties:
* 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
*/
export class AdminPostUploadsDownloadUrlReq {
@@ -5,6 +5,7 @@ import { DeleteResponse } from "../../../../types/common"
import middlewares, { transformBody } from "../../../middlewares"
import { AdminDeleteUploadsReq } from "./delete-upload"
import { AdminPostUploadsDownloadUrlReq } from "./get-download-url"
import { FileServiceUploadResult } from "@medusajs/types"
const route = Router()
const upload = multer({ dest: "uploads/" })
@@ -52,14 +53,18 @@ export default (app) => {
* type: object
* required:
* - url
* - key
* properties:
* url:
* description: The URL of the uploaded file.
* type: string
* 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 = {
uploads: { url: string }[]
uploads: FileServiceUploadResult[]
}
/**