[PR #1317] [MERGED] feat: return fields in GET /documents/:id endpoint #1553

Closed
opened 2026-02-26 19:33:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/1317
Author: @Etrenak
Created: 9/2/2024
Status: Merged
Merged: 12/5/2024
Merged by: @Mythie

Base: mainHead: feat/1178-document-fields


📝 Commits (6)

  • 389c530 feat: /documents and /documents/:id GET endpoints return fields
  • e25fce4 fix: broken other routes
  • 35502c4 feat: add fieldMeta in documents/:id
  • 7f314e1 Merge branch 'main' into feat/1178-document-fields
  • 2c54328 Merge branch 'main' into feat/1178-document-fields
  • 6dc3257 Merge branch 'main' into feat/1178-document-fields

📊 Changes

2 files changed (+43 additions, -1 deletions)

View changed files

📝 packages/api/v1/implementation.ts (+26 -0)
📝 packages/api/v1/schema.ts (+17 -1)

📄 Description

Description

To be able to use the PATCH /api/v1/documents/{id}/fields/{fieldId} endpoint, we need to know the fields ID of a particular document. The issue #1178 suggested to create a new endpoint for this. To be consistent with the /templates endpoint, I propose in this PR to directly add the fields field to the /documents/:id endpoint.

This is related to #1178 but it might still be interesting to create a new endpoint which could also return the fieldMeta.

Changes Made

Added fields to ZSuccessfulGetDocumentResponseSchema in the API contract, and changed the implementation accordingly.

Testing Performed

  • Tested on a document with and without fields.
  • Full production build (npm run build)

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced API response to include additional field data associated with documents.
    • Introduced a new schema for field objects, improving data validation and structure in API responses.
  • Chores

    • Restructured schema definitions for better organization and readability.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/1317 **Author:** [@Etrenak](https://github.com/Etrenak) **Created:** 9/2/2024 **Status:** ✅ Merged **Merged:** 12/5/2024 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `feat/1178-document-fields` --- ### 📝 Commits (6) - [`389c530`](https://github.com/documenso/documenso/commit/389c5305f168c1f41ff41948a931763a03548c11) feat: /documents and /documents/:id GET endpoints return fields - [`e25fce4`](https://github.com/documenso/documenso/commit/e25fce4a76131979b33d86a4f0ffcdb75063d4c7) fix: broken other routes - [`35502c4`](https://github.com/documenso/documenso/commit/35502c4f75ecf0478deaccc0d24ae547cc493f85) feat: add fieldMeta in documents/:id - [`7f314e1`](https://github.com/documenso/documenso/commit/7f314e137f1cdde69c95ec861f66b03c1b5ce9f7) Merge branch 'main' into feat/1178-document-fields - [`2c54328`](https://github.com/documenso/documenso/commit/2c543287fae5f446f7b7fc36982fe22b06010e0a) Merge branch 'main' into feat/1178-document-fields - [`6dc3257`](https://github.com/documenso/documenso/commit/6dc3257634b140da85f7b882015b9953e75db999) Merge branch 'main' into feat/1178-document-fields ### 📊 Changes **2 files changed** (+43 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/api/v1/implementation.ts` (+26 -0) 📝 `packages/api/v1/schema.ts` (+17 -1) </details> ### 📄 Description ## Description To be able to use the PATCH `/api/v1/documents/{id}/fields/{fieldId}` endpoint, we need to know the fields ID of a particular document. The issue #1178 suggested to create a new endpoint for this. To be consistent with the `/templates` endpoint, I propose in this PR to directly add the `fields` field to the `/documents/:id` endpoint. ## Related Issue This is related to #1178 but it might still be interesting to create a new endpoint which could also return the `fieldMeta`. ## Changes Made Added `fields` to `ZSuccessfulGetDocumentResponseSchema` in the API contract, and changed the implementation accordingly. ## Testing Performed - Tested on a document with and without fields. - Full production build (`npm run build`) ## Checklist - [x] I have tested these changes locally and they work as expected. - [ ] I have added/updated tests that prove the effectiveness of these changes. - [ ] I have updated the documentation to reflect these changes, if applicable. - [x] I have followed the project's coding style guidelines. - [ ] I have addressed the code review feedback from the previous submission, if applicable. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced API response to include additional field data associated with documents. - Introduced a new schema for field objects, improving data validation and structure in API responses. - **Chores** - Restructured schema definitions for better organization and readability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 19:33:45 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#1553
No description provided.