[PR #1842] [MERGED] feat: upload template via API #1882

Closed
opened 2026-02-26 20:31:30 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/1842
Author: @catalinpit
Created: 6/16/2025
Status: Merged
Merged: 7/23/2025
Merged by: @dguyen

Base: mainHead: feat/api-template-creation-and-editing


📝 Commits (10+)

  • 0377bae chore: upload template via API
  • daa6fc0 chore: add a new function for uploading templates via API
  • 42b3a16 chore: implement feedback
  • 7262672 chore: make data and meta optional
  • d8071f7 chore: add upload creation via api v1
  • 2f967c6 chore: self-review
  • cee93f2 chore: more self-review
  • bd945b6 Merge branch 'main' into feat/api-template-creation-and-editing
  • d835e31 Merge branch 'main' into feat/api-template-creation-and-editing
  • ec4ff24 fix: refactor

📊 Changes

9 files changed (+321 additions, -54 deletions)

View changed files

📝 packages/api/v1/contract.ts (+17 -0)
📝 packages/api/v1/implementation.ts (+104 -0)
📝 packages/lib/server-only/template/create-template.ts (+38 -10)
📝 packages/prisma/seed/documents.ts (+3 -1)
📝 packages/trpc/server/document-router/router.ts (+1 -1)
📝 packages/trpc/server/embedding-router/create-embedding-template.ts (+3 -1)
📝 packages/trpc/server/template-router/router.ts (+82 -1)
📝 packages/trpc/server/template-router/schema.ts (+71 -38)
📝 packages/ui/primitives/document-flow/add-subject.tsx (+2 -2)

📄 Description

Description

Allow users to upload templates via both v1 and v2 APIs. Similar to uploading documents.

Changes Made

  1. Updated the createTemplate function to support additional options like visibility, authentication, and metadata, integrating team settings and document auth.
  2. Added 2 endpoints:
  • /api/v1/templates and /api/v2-beta/template/create/beta

Testing Performed

  • I ran the E2E tests locally
  • I uploaded different templates in different scenarios

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.

🔄 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/1842 **Author:** [@catalinpit](https://github.com/catalinpit) **Created:** 6/16/2025 **Status:** ✅ Merged **Merged:** 7/23/2025 **Merged by:** [@dguyen](https://github.com/dguyen) **Base:** `main` ← **Head:** `feat/api-template-creation-and-editing` --- ### 📝 Commits (10+) - [`0377bae`](https://github.com/documenso/documenso/commit/0377baef0b6c1fb17f2236c91adaa6c00a658bfb) chore: upload template via API - [`daa6fc0`](https://github.com/documenso/documenso/commit/daa6fc0e9cc5f8caa545fd74e0e89d68946960a1) chore: add a new function for uploading templates via API - [`42b3a16`](https://github.com/documenso/documenso/commit/42b3a16c8cba0e7460c5bfccf58ae9b575a3161b) chore: implement feedback - [`7262672`](https://github.com/documenso/documenso/commit/7262672dee18db57859aaa0fccc5a98ffb9fcbfe) chore: make data and meta optional - [`d8071f7`](https://github.com/documenso/documenso/commit/d8071f76f9f67a08c13922f9690c447caa1bee95) chore: add upload creation via api v1 - [`2f967c6`](https://github.com/documenso/documenso/commit/2f967c65050f494810198de62e5a61852cbbddb5) chore: self-review - [`cee93f2`](https://github.com/documenso/documenso/commit/cee93f2924a9b8486d1af76a0e29b2a6d036b384) chore: more self-review - [`bd945b6`](https://github.com/documenso/documenso/commit/bd945b6098ab327272cb6bcbdf1646ac7f74a115) Merge branch 'main' into feat/api-template-creation-and-editing - [`d835e31`](https://github.com/documenso/documenso/commit/d835e3197334b40a701cd9d7c0800e496a4b8a0b) Merge branch 'main' into feat/api-template-creation-and-editing - [`ec4ff24`](https://github.com/documenso/documenso/commit/ec4ff24a279943fc95b219248c20ec5ad9dabb2b) fix: refactor ### 📊 Changes **9 files changed** (+321 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `packages/api/v1/contract.ts` (+17 -0) 📝 `packages/api/v1/implementation.ts` (+104 -0) 📝 `packages/lib/server-only/template/create-template.ts` (+38 -10) 📝 `packages/prisma/seed/documents.ts` (+3 -1) 📝 `packages/trpc/server/document-router/router.ts` (+1 -1) 📝 `packages/trpc/server/embedding-router/create-embedding-template.ts` (+3 -1) 📝 `packages/trpc/server/template-router/router.ts` (+82 -1) 📝 `packages/trpc/server/template-router/schema.ts` (+71 -38) 📝 `packages/ui/primitives/document-flow/add-subject.tsx` (+2 -2) </details> ### 📄 Description ## Description Allow users to upload templates via both v1 and v2 APIs. Similar to uploading documents. ## Changes Made 1. Updated the `createTemplate` function to support additional options like visibility, authentication, and metadata, integrating team settings and document auth. 2. Added 2 endpoints: - `/api/v1/templates` and `/api/v2-beta/template/create/beta` ## Testing Performed - I ran the E2E tests locally - I uploaded different templates in different scenarios ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:31:30 +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#1882
No description provided.