feat(#4): Add versioning of application form

This commit is contained in:
2025-11-08 10:15:04 +01:00
parent a8eca965dc
commit 59da40d6c0
17 changed files with 1095 additions and 124 deletions

View File

@@ -275,6 +275,111 @@ paths:
"503":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
/application-forms/{id}/versions:
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
get:
summary: Get all versions of an application form
operationId: getApplicationFormVersions
tags:
- application-form-version
responses:
"200":
description: List of versions
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/ApplicationFormVersionListItemDto"
"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":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/NotFound"
"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"
/application-forms/{id}/versions/{versionNumber}:
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
- name: versionNumber
in: path
required: true
schema:
type: integer
get:
summary: Get specific version with full snapshot
operationId: getApplicationFormVersion
tags:
- application-form-version
responses:
"200":
description: Version details with snapshot
content:
application/json:
schema:
$ref: "#/components/schemas/ApplicationFormVersionDto"
"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":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/NotFound"
"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"
/application-forms/{id}/versions/{versionNumber}/restore:
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
- name: versionNumber
in: path
required: true
schema:
type: integer
post:
summary: Restore a specific version
operationId: restoreApplicationFormVersion
tags:
- application-form-version
responses:
"200":
description: Restored application form
content:
application/json:
schema:
$ref: "#/components/schemas/ApplicationFormDto"
"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":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/NotFound"
"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"
####### Application Form Templates #######
/application-form-templates:
get:
@@ -1017,6 +1122,92 @@ components:
items:
$ref: "#/components/schemas/ApplicationFormDto"
ApplicationFormSnapshotDto:
type: object
required:
- name
- status
- organizationId
- sections
properties:
name:
type: string
status:
$ref: "#/components/schemas/ApplicationFormStatus"
organizationId:
type: string
sections:
type: array
items:
$ref: "#/components/schemas/FormElementSectionSnapshotDto"
####### ApplicationFormVersion #######
ApplicationFormVersionDto:
type: object
required:
- id
- applicationFormId
- versionNumber
- name
- status
- organizationId
- snapshot
- createdBy
- createdAt
properties:
id:
type: string
format: uuid
applicationFormId:
type: string
format: uuid
versionNumber:
type: integer
name:
type: string
status:
$ref: "#/components/schemas/ApplicationFormStatus"
organizationId:
type: string
snapshot:
$ref: "#/components/schemas/ApplicationFormSnapshotDto"
createdBy:
$ref: "#/components/schemas/UserDto"
createdAt:
type: string
format: date-time
ApplicationFormVersionListItemDto:
type: object
required:
- id
- applicationFormId
- versionNumber
- name
- status
- organizationId
- createdBy
- createdAt
properties:
id:
type: string
format: uuid
applicationFormId:
type: string
format: uuid
versionNumber:
type: integer
name:
type: string
status:
$ref: "#/components/schemas/ApplicationFormStatus"
organizationId:
type: string
createdBy:
$ref: "#/components/schemas/UserDto"
createdAt:
type: string
format: date-time
####### Form #######
FormElementSectionDto:
@@ -1044,6 +1235,23 @@ components:
type: string
format: uuid
FormElementSectionSnapshotDto:
type: object
required:
- title
- elements
properties:
title:
type: string
shortTitle:
type: string
description:
type: string
elements:
type: array
items:
$ref: "#/components/schemas/FormElementSnapshotDto"
CreateFormElementSectionDto:
type: object
required:
@@ -1089,6 +1297,23 @@ components:
type: string
format: uuid
FormElementSnapshotDto:
type: object
required:
- type
- options
properties:
title:
type: string
description:
type: string
type:
$ref: "#/components/schemas/FormElementType"
options:
type: array
items:
$ref: "#/components/schemas/FormOptionDto"
CreateFormElementDto:
type: object
required: