Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions bruno/form-response/draftResponse.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
meta {
name: draftResponse
type: http
seq: 2
}

post {
url: http://localhost:8000/responses/draft/:formId
body: json
auth: inherit
}

params:path {
formId: 4a386821-772f-4928-b01f-034daf8dc456
}

body:json {
{
"answers":{
"14ba7ca4-8db7-48d7-8d40-d6a2d43ecc75": "8282476890"
}
}
}

settings {
encodeUrl: true
timeout: 0
}

docs {
# Save Draft Response

## Endpoint
`POST /forms/:formId/draft`

## Description
Saves or updates a draft response for a form. If a response already exists, it is updated. If the response has already been submitted, saving a draft is not allowed.

## Controller
`saveDraftResponse`

## Auth Required
✅ Yes (User must be logged in)

## Path Parameters

| Name | Type | Required | Description |
|--------|--------|----------|-------------|
| formId | string | Yes | ID of the form |

## Request Body

```json
{
"answers": {
"fieldId1": "Partial Answer 1",
"fieldId2": "Partial Answer 2"
}
}

Responses
Success Response
Status: 200 OK

{
"success": true,
"message": "Draft response saved successfully",
"data": {
"id": "response_123",
"formId": "form_456",
"respondentId": "user_789",
"answers": {
"fieldId1": "Partial Answer 1",
"fieldId2": "Partial Answer 2"
},
"isSubmitted": false,
"submittedAt": null,
"updatedAt": "2026-02-07T10:30:00.000Z"
}
}

Error Responses
Status: 404 Not Found

{
"success": false,
"message": "Form not found"
}

Status: 400 Bad Request

{
"success": false,
"message": "Response already submitted and cannot be edited"
}
}
76 changes: 76 additions & 0 deletions bruno/form-response/getDraftResponse.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
meta {
name: getDraftResponse
type: http
seq: 5
}

get {
url: http://localhost:8000/responses/draft/:formId
body: none
auth: inherit
}

params:path {
formId: 4a386821-772f-4928-b01f-034daf8dc456
}

settings {
encodeUrl: true
timeout: 0
}

docs {
# Get Draft Response

## Endpoint
`GET /forms/:formId/draft`

## Description
Fetches the current user's saved draft response for a specific form (i.e., a response that is not yet submitted).

Field IDs stored in the database are converted into human-readable field names before returning.

## Controller
`getDraftResponse`

## Auth Required
✅ Yes (User must be logged in)

## Path Parameters

| Name | Type | Required | Description |
|--------|--------|----------|-------------|
| formId | string | Yes | ID of the form |

## Request Body
None

## Responses

### Success Response

#### Status: 200 OK

```json
{
"success": true,
"data": {
"id": "response_123",
"formId": "form_456",
"formTitle": "Job Application Form",
"answers": {
"Full Name": "John Doe",
"Email": "john@example.com",
"Experience": "2 years"
}
}
}

Error Responses
Status: 404 Not Found

{
"success": false,
"message": "No draft found"
}
}
4 changes: 2 additions & 2 deletions bruno/form-response/getFormResponsesForFormOwner.bru
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
meta {
name: getFormResponsesForFormOwner
type: http
seq: 2
seq: 3
}

get {
Expand All @@ -11,7 +11,7 @@ get {
}

params:path {
formId: ef50e45d-d095-418d-ab49-7196900fa5c2
formId: 4a386821-772f-4928-b01f-034daf8dc456
}

settings {
Expand Down
2 changes: 1 addition & 1 deletion bruno/form-response/getSubmittedResponse.bru
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
meta {
name: getSubmittedResponse
type: http
seq: 3
seq: 4
}

get {
Expand Down
86 changes: 0 additions & 86 deletions bruno/form-response/resumeResponse.bru

This file was deleted.

Loading