[PR #111] [MERGED] Accept optional note in POST /api/voucher and include note in GET /api/vouchers #122

Closed
opened 2026-05-07 00:19:01 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/glenndehaan/unifi-voucher-site/pull/111
Author: @nickelblack619
Created: 12/28/2025
Status: Merged
Merged: 12/30/2025
Merged by: @glenndehaan

Base: masterHead: api-note


📝 Commits (6)

  • e6a5d56 Add note input sanitization for voucher creation
  • f1901b7 Add notes utility to API GET vouchers response
  • 6cfae61 Update api.js
  • a61be44 Revert "Update api.js"
  • 122d2ae Remove sanitize
  • ea65b34 Ensure note field is always present within vouchers api call. Cleanup older comments. Simplify code. Implement separator check. Updated README.md

📊 Changes

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

View changed files

📝 README.md (+11 -0)
📝 controllers/api.js (+17 -1)

📄 Description

What changed

  • POST /api/voucher

    • Accepts an optional note (must be a string). If provided:
    • sanitized (internal separators ||;;|| removed),
    • trimmed and limited to 255 characters,
    • stored using the existing internal notes format: <note>||;;||api||;;||local||;;|| (passed as the voucher name to UniFi via unifi.create).
    • If note is omitted, behavior remains unchanged.
    • If note is present but not a string, the endpoint returns 400.
  • GET /api/vouchers

    • Each returned voucher object now includes note, parsed from the voucher name using utils/notes (string or null).

🔄 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/glenndehaan/unifi-voucher-site/pull/111 **Author:** [@nickelblack619](https://github.com/nickelblack619) **Created:** 12/28/2025 **Status:** ✅ Merged **Merged:** 12/30/2025 **Merged by:** [@glenndehaan](https://github.com/glenndehaan) **Base:** `master` ← **Head:** `api-note` --- ### 📝 Commits (6) - [`e6a5d56`](https://github.com/glenndehaan/unifi-voucher-site/commit/e6a5d56f4c8cdc40e25518856230aa4d1a039453) Add note input sanitization for voucher creation - [`f1901b7`](https://github.com/glenndehaan/unifi-voucher-site/commit/f1901b7e9e81b22c4e2612e117cb84544bbbcd96) Add notes utility to API GET vouchers response - [`6cfae61`](https://github.com/glenndehaan/unifi-voucher-site/commit/6cfae61e6db4745b09e920dd339b4a8f18dbf498) Update api.js - [`a61be44`](https://github.com/glenndehaan/unifi-voucher-site/commit/a61be4487e16834fa4a4e8cad1ed50fc3ae21d02) Revert "Update api.js" - [`122d2ae`](https://github.com/glenndehaan/unifi-voucher-site/commit/122d2aebdef3099699af87b503924ab90518bd89) Remove sanitize - [`ea65b34`](https://github.com/glenndehaan/unifi-voucher-site/commit/ea65b34a805c2de92986550ee1d9d55fe3d27265) Ensure note field is always present within vouchers api call. Cleanup older comments. Simplify code. Implement separator check. Updated README.md ### 📊 Changes **2 files changed** (+28 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+11 -0) 📝 `controllers/api.js` (+17 -1) </details> ### 📄 Description # What changed - **POST /api/voucher** - Accepts an optional `note` (must be a string). If provided: - sanitized (internal separators ``||;;||`` removed), - trimmed and limited to 255 characters, - stored using the existing internal notes format: `<note>||;;||api||;;||local||;;||` (passed as the voucher `name` to UniFi via `unifi.create`). - If `note` is omitted, behavior remains unchanged. - If `note` is present but not a string, the endpoint returns `400`. - **GET /api/vouchers** - Each returned voucher object now includes `note`, parsed from the voucher `name` using `utils/notes` (string or `null`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:19:01 +02: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/unifi-voucher-site#122
No description provided.