feat(fullstack): Add file upload
This commit is contained in:
@@ -1043,18 +1043,8 @@ paths:
|
||||
|
||||
####### Files #######
|
||||
/files:
|
||||
get:
|
||||
summary: Get all files
|
||||
operationId: getAllFiles
|
||||
tags:
|
||||
- file
|
||||
responses:
|
||||
"200":
|
||||
description: Successful response
|
||||
"500":
|
||||
description: Internal server error
|
||||
post:
|
||||
summary: Upload a new file
|
||||
summary: Upload a new file for a form element
|
||||
operationId: uploadFile
|
||||
tags:
|
||||
- file
|
||||
@@ -1063,18 +1053,24 @@ paths:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
$ref: "#/components/schemas/UploadFileDto"
|
||||
$ref: "#/components/schemas/UploadFileRequestDto"
|
||||
responses:
|
||||
"201":
|
||||
description: File uploaded
|
||||
description: File uploaded successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/UploadedFileDto"
|
||||
"400":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/BadRequest"
|
||||
"401":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
|
||||
"413":
|
||||
description: File too large (exceeds 10MB limit)
|
||||
"415":
|
||||
description: Unsupported file type
|
||||
"500":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
||||
"503":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
|
||||
|
||||
/files/{id}:
|
||||
parameters:
|
||||
@@ -1085,25 +1081,23 @@ paths:
|
||||
type: string
|
||||
format: uuid
|
||||
get:
|
||||
summary: Get a specific file
|
||||
summary: Get file metadata by ID
|
||||
operationId: getFileById
|
||||
tags:
|
||||
- file
|
||||
responses:
|
||||
"200":
|
||||
description: Get file by ID
|
||||
description: File metadata
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/FileDto"
|
||||
"400":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/BadRequest"
|
||||
$ref: "#/components/schemas/UploadedFileDto"
|
||||
"404":
|
||||
description: File not found
|
||||
"401":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
|
||||
"500":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
||||
"503":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
|
||||
delete:
|
||||
summary: Delete a file
|
||||
operationId: deleteFile
|
||||
@@ -1116,10 +1110,123 @@ paths:
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/BadRequest"
|
||||
"401":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
|
||||
"404":
|
||||
description: File not found
|
||||
"500":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
||||
|
||||
/files/{id}/content:
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
get:
|
||||
summary: Download file content
|
||||
operationId: downloadFileContent
|
||||
tags:
|
||||
- file
|
||||
parameters:
|
||||
- name: inline
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
default: false
|
||||
description: If true, return file with inline disposition for browser viewing
|
||||
responses:
|
||||
"200":
|
||||
description: File binary content
|
||||
content:
|
||||
application/octet-stream:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
headers:
|
||||
Content-Disposition:
|
||||
description: Attachment filename
|
||||
schema:
|
||||
type: string
|
||||
Content-Type:
|
||||
description: File MIME type
|
||||
schema:
|
||||
type: string
|
||||
"404":
|
||||
description: File not found
|
||||
"401":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
|
||||
"500":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
||||
|
||||
/application-forms/{applicationFormId}/files:
|
||||
parameters:
|
||||
- name: applicationFormId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
description: The application form ID
|
||||
get:
|
||||
summary: Get all files for an application form
|
||||
operationId: getFilesByApplicationForm
|
||||
tags:
|
||||
- file
|
||||
parameters:
|
||||
- name: formElementReference
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
description: Filter by form element reference key
|
||||
responses:
|
||||
"200":
|
||||
description: List of files for the application form
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/UploadedFileDto"
|
||||
"401":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
|
||||
"404":
|
||||
description: Application form not found
|
||||
"500":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
||||
post:
|
||||
summary: Associate files with an application form
|
||||
operationId: associateFilesWithApplicationForm
|
||||
tags:
|
||||
- file
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- fileIds
|
||||
properties:
|
||||
fileIds:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
format: uuid
|
||||
description: List of file IDs to associate with this application form
|
||||
responses:
|
||||
"204":
|
||||
description: Files successfully associated
|
||||
"400":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/BadRequest"
|
||||
"401":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
|
||||
"404":
|
||||
description: Application form or file not found
|
||||
"500":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
||||
"503":
|
||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
@@ -1177,6 +1284,14 @@ components:
|
||||
nullable: true
|
||||
readOnly: true
|
||||
description: Total number of comments associated with this application form.
|
||||
fileIds:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
format: uuid
|
||||
nullable: true
|
||||
writeOnly: true
|
||||
description: Temporary file IDs to associate atomically on creation (write-only, ignored on read)
|
||||
|
||||
PagedApplicationFormDto:
|
||||
type: object
|
||||
@@ -1574,6 +1689,7 @@ components:
|
||||
- RICH_TEXT
|
||||
- DATE
|
||||
- TABLE
|
||||
- FILE_UPLOAD
|
||||
|
||||
FormElementVisibilityCondition:
|
||||
type: object
|
||||
@@ -1880,41 +1996,79 @@ components:
|
||||
- WARNING
|
||||
- ERROR
|
||||
|
||||
####### FileDto #######
|
||||
FileDto:
|
||||
####### File Upload DTOs #######
|
||||
UploadedFileDto:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- file
|
||||
- createdAt
|
||||
- modifiedAt
|
||||
- filename
|
||||
- originalFilename
|
||||
- size
|
||||
- mimeType
|
||||
- formElementReference
|
||||
- uploadedAt
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
name:
|
||||
description: Unique identifier for the uploaded file
|
||||
filename:
|
||||
type: string
|
||||
file:
|
||||
description: Unique filename stored on disk (UUID-based)
|
||||
originalFilename:
|
||||
type: string
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
modifiedAt:
|
||||
description: Original filename provided by the user
|
||||
size:
|
||||
type: integer
|
||||
format: int64
|
||||
description: File size in bytes
|
||||
mimeType:
|
||||
type: string
|
||||
description: MIME type (e.g., application/pdf, image/jpeg)
|
||||
organizationId:
|
||||
type: string
|
||||
nullable: true
|
||||
description: Organization context (null for global forms)
|
||||
applicationFormId:
|
||||
type: string
|
||||
format: uuid
|
||||
nullable: true
|
||||
description: The application form this file belongs to (null for temporary uploads)
|
||||
formElementReference:
|
||||
type: string
|
||||
description: Reference key of the form element (e.g., grundrechte_folgenabschaetzung)
|
||||
uploadedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Timestamp when the file was uploaded
|
||||
uploadedBy:
|
||||
nullable: true
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/UserDto"
|
||||
description: User who uploaded the file
|
||||
|
||||
UploadFileDto:
|
||||
UploadFileRequestDto:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- file
|
||||
- formElementReference
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
file:
|
||||
type: string
|
||||
format: binary
|
||||
description: The file to upload
|
||||
organizationId:
|
||||
type: string
|
||||
nullable: true
|
||||
description: Organization context (null for global forms)
|
||||
applicationFormId:
|
||||
type: string
|
||||
format: uuid
|
||||
nullable: true
|
||||
description: The application form this file belongs to (null for temporary uploads before form is saved)
|
||||
formElementReference:
|
||||
type: string
|
||||
description: Reference key of the form element
|
||||
|
||||
####### Miscellaneous #######
|
||||
ProcessingPurpose:
|
||||
|
||||
Reference in New Issue
Block a user