{
  "paths": {
    "/upload/": {
      "post": {
        "description": "Upload one or multiple files",
        "responses": {
          "200": {
            "description": "response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "hash": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "ext": {
                        "type": "string"
                      },
                      "mime": {
                        "type": "string"
                      },
                      "size": {
                        "type": "decimal"
                      },
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "provider": {
                        "type": "string"
                      },
                      "related": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "",
        "tags": [
          "Upload - File"
        ],
        "requestBody": {
          "description": "",
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": ["files"],
                "properties": {
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  },
                  "path": {
                    "type": "string",
                    "example": "/public/upload"
                  },
                  "refId": {
                    "type": "string",
                    "example": "5a993616b8e66660e8baf45c"
                  },
                  "ref": {
                    "type": "string",
                    "example": "user"
                  },
                  "source": {
                    "type": "string",
                    "example": "users-permissions"
                  },
                  "field": {
                    "type": "string",
                    "example": "avatar"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/upload/files/count": {
      "get": {
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/upload/files": {
      "get": {
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UploadFile"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/upload/search/{id}": {
      "get": {
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "",
            "deprecated": false,
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UploadFile"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/upload/files/{_id}": {
      "get": {
        "parameters": [
          {
            "name": "_id",
            "in": "path",
            "description": "",
            "deprecated": false,
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadFile"
                }
              }
            }
          }
        }
      },
      "delete": {
        "parameters": [
          {
            "name": "_id",
            "in": "path",
            "description": "",
            "deprecated": false,
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document deleted"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "UploadFile": {
        "properties": {
          "name": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          },
          "hash": {
            "type": "string"
          },
          "ext": {
            "type": "string"
          },
          "size": {
            "type": "decimal"
          },
          "mime": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "related": {
            "type": "array",
            "items": {
              "type":"string"
            }
          }
        }
      }
    }
  }
}
