Skip to main content
PATCH
/
api
/
v1
/
ventanas
/
:id
Update Ventana
curl --request PATCH \
  --url https://api.example.com/api/v1/ventanas/:id \
  --header 'Content-Type: application/json' \
  --data '
{
  "bancaId": "<string>",
  "name": "<string>",
  "code": "<string>",
  "username": "<string>",
  "password": "<string>",
  "commissionMarginX": 123,
  "address": "<string>",
  "phone": "<string>",
  "email": "<string>",
  "isActive": true,
  "settings": {}
}
'
{
  "success": true,
  "data": {
    "id": "660e8400-e29b-41d4-a716-446655440000",
    "bancaId": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Ventana Norte - Updated",
    "code": "VN001",
    "commissionMarginX": 2.0,
    "address": "789 North Avenue - New Location",
    "phone": "+1-234-567-8911",
    "email": "[email protected]",
    "isActive": true,
    "settings": {
      "print": {
        "width": 88,
        "barcode": true
      },
      "theme": "dark"
    },
    "createdAt": "2024-03-15T11:00:00Z",
    "updatedAt": "2024-03-15T15:30:00Z"
  }
}

Overview

Updates an existing ventana. All fields are optional - only provided fields will be updated. ADMIN can update any ventana, while VENTANA users can only update their own.

Authorization

Required role: ADMIN or self (VENTANA)
Permissions:
  • ADMIN: Can update any ventana
  • VENTANA: Can only update their own ventana (via restrictToAdminOrSelf middleware)

Path Parameters

id
string
required
UUID of the ventana to update

Request Body

bancaId
string
UUID of the parent banca
name
string
Ventana name (2-100 characters)
code
string
Unique ventana code (2-10 characters)
username
string
Username for the associated VENTANA user account (3-100 characters, alphanumeric, underscores, and hyphens only)
password
string
Password for the associated VENTANA user account (minimum 6 characters)
commissionMarginX
number
Commission margin multiplier (must be >= 0)
address
string
Physical address (max 255 characters)
phone
string
Contact phone number (max 20 characters)
email
string
Contact email address (must be valid email format)
isActive
boolean
Whether the ventana is active
settings
object
Ventana-specific settings (print configuration, theme)

Response

success
boolean
Indicates if the request was successful
data
object
The updated ventana object
{
  "success": true,
  "data": {
    "id": "660e8400-e29b-41d4-a716-446655440000",
    "bancaId": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Ventana Norte - Updated",
    "code": "VN001",
    "commissionMarginX": 2.0,
    "address": "789 North Avenue - New Location",
    "phone": "+1-234-567-8911",
    "email": "[email protected]",
    "isActive": true,
    "settings": {
      "print": {
        "width": 88,
        "barcode": true
      },
      "theme": "dark"
    },
    "createdAt": "2024-03-15T11:00:00Z",
    "updatedAt": "2024-03-15T15:30:00Z"
  }
}

Notes

  • Both PATCH and PUT methods are supported
  • PATCH uses restrictToAdminOrSelf middleware (see src/api/v1/routes/ventana.routes.ts:29-35)
  • PUT requires ADMIN role only (see src/api/v1/routes/ventana.routes.ts:21-27)
  • Code uniqueness is validated
  • Updating username/password also updates the associated VENTANA user account
  • Activity is logged for audit purposes (see src/api/v1/controllers/ventana.controller.ts:18-21)
  • Settings are merged (partial update) rather than replaced

Build docs developers (and LLMs) love