Skip to content

DSNPI - 1320 / Update specialist comment endpoint to new schema#15

Merged
apricot13 merged 2 commits intomainfrom
DSNPI-1320/update-specialist-comment-endpoint-to-new-schema
Sep 30, 2025
Merged

DSNPI - 1320 / Update specialist comment endpoint to new schema#15
apricot13 merged 2 commits intomainfrom
DSNPI-1320/update-specialist-comment-endpoint-to-new-schema

Conversation

@madz-lw
Copy link

@madz-lw madz-lw commented Jul 18, 2025

Description of change

This PR updates the specialist comment endpoint to use the new schema.

The response now returns a pagination, and a data object. Within the data object, the specialist summary, and also an array of specialists who have responded and have had their comments redacted, and within each specialist is their details, related constraint information (if applicable) and an array of all their comments which includes details such as their sentiment, any files and redacted comments.

Example payload:

{
  "pagination": {
    "resultsPerPage": 10,
    "currentPage": 1,
    "totalPages": 1,
    "totalResults": 10,
    "totalAvailableItems": 10
  },
  "data": {
    "summary": {
      "totalConsulted": 38,
      "totalComments": 6,
      "sentiment": {
        "approved": 5,
        "amendmentsNeeded": 1,
        "objected": 0
      }
    },
    "comments": [
      {
        "id": "2",
        "reason": "Constraint",
        "constraints": [
          [
            {
              "value": "designated_conservationarea",
              "category": "heritage_and_conservation",
              "description": "Conservation area",
              "intersects": true
            }
          ]
        ],
        "firstConsultedAt": "2025-07-14T12:05:58Z",
        "comments": [
          {
            "id": "45",
            "sentiment": "approved",
            "commentRedacted": "Now approved.",
            "files": [
              {
                "name": "test-file.pdf",
                "referencesInDocument": [],
                "url": "http://southwark.bops.localhost:3000/files/6i1b56qcwcs5q23bgwuqy19mvaje",
                "type": [],
                "createdAt": "2025-07-21T09:34:22.114+01:00",
                "applicantDescription": null,
                "metadata": {
                  "byteSize": 10345,
                  "contentType": "application/pdf"
                }
              }
            ],
            "metadata": {
              "submittedAt": "2025-07-21T08:34:22Z",
              "publishedAt": "2025-07-21T08:34:22Z"
            }
          },
          {
            "id": "44",
            "sentiment": "amendmentsNeeded",
            "commentRedacted": "Needs amendments",
            "files": [
              {
                "name": "test-file.pdf",
                "referencesInDocument": [],
                "url": "http://southwark.bops.localhost:3000/files/2sdq1454m8515ctuzzj6aitxxv8c",
                "type": [],
                "createdAt": "2025-07-18T16:37:17.829+01:00",
                "applicantDescription": null,
                "metadata": {
                  "byteSize": 10345,
                  "contentType": "application/pdf"
                }
              }
            ],
            "metadata": {
              "submittedAt": "2025-07-18T15:37:17Z",
              "publishedAt": "2025-07-18T15:37:17Z"
            }
          }
        ]
      },
      {
        "id": "33",
        "reason": "Other",
        "firstConsultedAt": "2025-07-11T11:53:13Z",
        "comments": [
          {
            "id": "12",
            "sentiment": "approved",
            "commentRedacted": "I like it *****",
            "metadata": {
              "submittedAt": "2025-07-18T11:53:13Z",
              "publishedAt": "2025-07-18T11:53:13Z"
            }
          }
        ]
      },
      {
        "id": "18",
        "reason": "Other",
        "firstConsultedAt": "2025-07-11T11:53:13Z",
        "comments": [
          {
            "id": "10",
            "sentiment": "approved",
            "commentRedacted": "I like it *****",
            "metadata": {
              "submittedAt": "2025-07-18T11:53:13Z",
              "publishedAt": "2025-07-18T11:53:13Z"
            }
          }
        ]
      },
      {
        "id": "8",
        "reason": "Other",
        "firstConsultedAt": "2025-07-11T11:53:13Z",
        "comments": [
          {
            "id": "9",
            "sentiment": "approved",
            "commentRedacted": "I like it *****",
            "metadata": {
              "submittedAt": "2025-07-18T11:53:13Z",
              "publishedAt": "2025-07-18T11:53:13Z"
            }
          },
          {
            "id": "7",
            "sentiment": "approved",
            "commentRedacted": "I like it *****",
            "metadata": {
              "submittedAt": "2025-07-18T11:53:13Z",
              "publishedAt": "2025-07-18T11:53:13Z"
            }
          }
        ]
      },
      {
        "id": "6",
        "reason": "Other",
        "firstConsultedAt": "2025-07-11T11:53:13Z",
        "comments": [
          {
            "id": "6",
            "sentiment": "approved",
            "commentRedacted": "I like it *****",
            "metadata": {
              "submittedAt": "2025-07-18T11:53:13Z",
              "publishedAt": "2025-07-18T11:53:13Z"
            }
          },
          {
            "id": "5",
            "sentiment": "approved",
            "commentRedacted": "I like it *****",
            "metadata": {
              "submittedAt": "2025-07-18T11:53:12Z",
              "publishedAt": "2025-07-18T11:53:13Z"
            }
          },
          {
            "id": "4",
            "sentiment": "approved",
            "commentRedacted": "I like it *****",
            "metadata": {
              "submittedAt": "2025-07-18T11:53:12Z",
              "publishedAt": "2025-07-18T11:53:13Z"
            }
          }
        ]
      },
      {
        "id": "1",
        "reason": "Constraint",
        "constraints": [
          [
            {
              "value": "listed",
              "category": "heritage_and_conservation",
              "description": "Listed building outline",
              "intersects": true
            }
          ]
        ],
        "firstConsultedAt": "2025-07-06T09:05:58Z",
        "comments": [
          {
            "id": "43",
            "sentiment": "amendmentsNeeded",
            "commentRedacted": "Great stuff. Just need more maps",
            "metadata": {
              "submittedAt": "2025-07-18T13:55:31Z",
              "publishedAt": "2025-07-18T13:55:31Z"
            }
          }
        ]
      }
    ]
  }
}

Story Link

DSNPI-1320

Decisions

  • The metadata section: there is no validated_at date in the current comment flow. Additionally, there is a redacted_at property but it doesn't seem to get set when a comment is redacted.

Known issues [OPTIONAL]

We have limited this ticket to not handle all of the constraint data we expect for now.

@madz-lw madz-lw marked this pull request as ready for review July 18, 2025 15:09
@madz-lw madz-lw requested a review from apricot13 July 18, 2025 15:09
@madz-lw madz-lw marked this pull request as draft July 18, 2025 15:40
@madz-lw madz-lw removed the request for review from apricot13 July 18, 2025 16:02
@madz-lw madz-lw marked this pull request as ready for review July 21, 2025 08:36
@madz-lw madz-lw requested a review from apricot13 July 21, 2025 08:36
@madz-lw madz-lw force-pushed the DSNPI-1320/update-specialist-comment-endpoint-to-new-schema branch from b2b0d18 to 8e27fe0 Compare September 18, 2025 10:56
Reduce diff
Adjust jbuilder and schema

Add files

Files

Files

restructure response data to be in ApiResponse format, adjustments to jbuilder and schema/swagger doc/tests
replace jbuilder logic with specialist presenter pattern

rebase fixes
@madz-lw madz-lw force-pushed the DSNPI-1320/update-specialist-comment-endpoint-to-new-schema branch from 8e27fe0 to adb5e91 Compare September 18, 2025 11:02
@madz-lw madz-lw requested a review from apricot13 September 18, 2025 11:04
@apricot13 apricot13 added the ready-for-bops-pr PR is approved internally, ready for PR in BOPS repo. Once BOPS PR is made this PR can be closed. label Sep 18, 2025
@apricot13 apricot13 merged commit 1b6fca5 into main Sep 30, 2025
81 of 82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-bops-pr PR is approved internally, ready for PR in BOPS repo. Once BOPS PR is made this PR can be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants