Skip to main content
POST
/
api
/
v1
/
ventanas
Create Ventana
curl --request POST \
  --url https://api.example.com/api/v1/ventanas \
  --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": {
    "settings.print": {
      "settings.print.name": "<string>",
      "settings.print.phone": "<string>",
      "settings.print.width": 123,
      "settings.print.footer": "<string>",
      "settings.print.barcode": true,
      "settings.print.bluetoothMacAddress": "<string>"
    },
    "settings.theme": "<string>"
  }
}
'
{
  "success": true,
  "message": "Listero y usuario creados correctamente",
  "data": {
    "id": "660e8400-e29b-41d4-a716-446655440000",
    "bancaId": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Ventana Norte",
    "code": "VN001",
    "commissionMarginX": 1.5,
    "address": "789 North Avenue",
    "phone": "+1-234-567-8910",
    "email": "[email protected]",
    "isActive": true,
    "settings": {
      "print": {
        "width": 58,
        "barcode": true
      },
      "theme": "light"
    },
    "deletedAt": null,
    "deletedBy": null,
    "deletedReason": null,
    "createdAt": "2024-03-15T11:00:00Z",
    "updatedAt": "2024-03-15T11:00:00Z"
  },
  "meta": {
    "userCreated": true
  }
}

Overview

Creates a new ventana (betting window) in the system. Automatically creates an associated VENTANA user account. Part of the hierarchy: Banca → Ventana → Vendedor.

Authorization

Required role: ADMIN

Request Body

bancaId
string
required
UUID of the parent banca
name
string
required
Ventana name (2-100 characters)
code
string
Unique ventana code (2-10 characters, optional but recommended)
username
string
required
Username for the VENTANA user account (3-100 characters, alphanumeric, underscores, and hyphens only)
password
string
required
Password for the 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
default:"true"
Whether the ventana is active
settings
object
Ventana-specific settings

Response

success
boolean
Indicates if the request was successful
message
string
Success message
data
object
The created ventana object
meta
object
Metadata about the operation
{
  "success": true,
  "message": "Listero y usuario creados correctamente",
  "data": {
    "id": "660e8400-e29b-41d4-a716-446655440000",
    "bancaId": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Ventana Norte",
    "code": "VN001",
    "commissionMarginX": 1.5,
    "address": "789 North Avenue",
    "phone": "+1-234-567-8910",
    "email": "[email protected]",
    "isActive": true,
    "settings": {
      "print": {
        "width": 58,
        "barcode": true
      },
      "theme": "light"
    },
    "deletedAt": null,
    "deletedBy": null,
    "deletedReason": null,
    "createdAt": "2024-03-15T11:00:00Z",
    "updatedAt": "2024-03-15T11:00:00Z"
  },
  "meta": {
    "userCreated": true
  }
}

Notes

  • Automatically creates a VENTANA role user with the provided username/password
  • Code must be unique across all ventanas
  • Parent banca must exist and be active
  • Username validation: alphanumeric, underscores, and hyphens only (see src/api/v1/validators/ventana.validator.ts:89-94)
  • Activity is logged for audit purposes (see src/api/v1/controllers/ventana.controller.ts:6-15)

Build docs developers (and LLMs) love