Skip to main content

AppUser

Represents a user account in the P.FLEX system.
id
string
required
Unique user identifier
name
string
required
Full name of the user
username
string
required
Login username (unique)
role
UserRole
required
User role (determines permissions)Available roles:
  • Jefatura - Management level with full access
  • Supervisor - Shift and task management
  • Asistente - Assistant role
  • Operario - Production operator
  • Encargado - Department manager
  • Sistemas - System administrator
active
boolean
required
Whether the user account is active
assignedAreas
string[]
Array of areas/departments assigned to the user

UserRole

Type definition for available user roles.
type UserRole = 'Jefatura' | 'Supervisor' | 'Asistente' | 'Operario' | 'Encargado' | 'Sistemas';
Jefatura
string
Management role with full system access including reports, KPIs, and approvals
Supervisor
string
Shift management role with task assignment and quality validation
Asistente
string
Assistant role with limited administrative access
Operario
string
Production operator with production registration access
Encargado
string
Department manager with area-specific permissions
Sistemas
string
System administrator with full technical configuration access

RoleDefinition

Defines a role with its associated permissions.
id
string
required
Unique role identifier
name
string
required
Role name (should match UserRole values)
description
string
required
Human-readable description of the role
permissions
string[]
required
Array of permission strings granted to this roleCommon permissions:
  • Ver Dashboard - View dashboard
  • Aprobar OTs - Approve work orders
  • Reportes - Access reports
  • Gestión Usuarios - User management
  • Asignar Tareas - Assign tasks
  • Cerrar Turno - Close shift
  • Validar Calidad - Validate quality
  • Ver OTs - View work orders
  • Registrar Producción - Register production
  • Admin Total - Full admin access

Machine

Represents a production machine in the plant.
id
string
required
Unique machine identifier
code
string
required
Machine code (e.g., IMP-01, TRQ-05, RBB-03)
name
string
required
Machine name
type
string
required
Machine type/categoryCommon types:
  • Impresión - Printing machines
  • Troquelado - Die-cutting machines
  • Acabado - Finishing machines (rewinders, blisters, etc.)
area
string
required
Physical area/location in the plant (e.g., Nave A, Nave B, Nave C, Nave D)
status
'Operativa' | 'Mantenimiento' | 'Detenida' | 'Sin Operador'
required
Current operational status
  • Operativa - Operational and running
  • Mantenimiento - Under maintenance
  • Detenida - Stopped/halted
  • Sin Operador - No operator assigned
active
boolean
required
Whether the machine is active in the system

SystemConfig

Global system configuration settings.
shiftName1
string
required
Name of the first shift (e.g., “Turno Día”)
shiftTime1
string
required
Start time of the first shift (24-hour format, e.g., “06:00”)
shiftName2
string
required
Name of the second shift (e.g., “Turno Noche”)
shiftTime2
string
required
Start time of the second shift (24-hour format, e.g., “18:00”)
passwordExpiryWarningDays
number
required
Number of days before password expiry to show warning
passwordPolicyDays
number
required
Number of days until password must be changed
plantName
string
required
Name of the production plant
autoLogoutMinutes
number
required
Minutes of inactivity before automatic logout
operatorMessage
string
required
Message displayed to operators (shift instructions, reminders, etc.)

AuditLog

System audit log entry for tracking user actions.
id
string
required
Unique log entry identifier
timestamp
Date
required
Date and time of the action
user
string
required
User who performed the action
role
string
required
Role of the user at the time of action
module
string
required
System module where action occurred (e.g., SISTEMA, ACCESO, OPERACIONES, CALIDAD)
action
string
required
Type of action performed (e.g., Inicio de Sesión, Cierre de Sesión, Estado Máquina)
details
string
required
Detailed description of the action
ip
string
required
IP address of the client

Usage Example

import { AppUser, RoleDefinition, Machine, SystemConfig, AuditLog } from './models/admin.models';

const user: AppUser = {
  id: 'u-12345',
  name: 'Juan Pérez',
  username: 'jperez',
  role: 'Supervisor',
  active: true,
  assignedAreas: ['Nave A', 'Nave B']
};

const role: RoleDefinition = {
  id: 'r-supervisor',
  name: 'Supervisor',
  description: 'Gestión de turno y asignación de tareas',
  permissions: [
    'Asignar Tareas',
    'Cerrar Turno',
    'Validar Calidad',
    'Ver OTs'
  ]
};

const machine: Machine = {
  id: 'p1',
  code: 'IMP-01',
  name: 'SUPERPRINT 1',
  type: 'Impresión',
  area: 'Nave A',
  status: 'Operativa',
  active: true
};

const config: SystemConfig = {
  shiftName1: 'Turno Día',
  shiftTime1: '06:00',
  shiftName2: 'Turno Noche',
  shiftTime2: '18:00',
  passwordExpiryWarningDays: 15,
  passwordPolicyDays: 90,
  plantName: 'Planta Central - Zona Industrial',
  autoLogoutMinutes: 30,
  operatorMessage: 'Recordar verificar el estado de los clichés al finalizar el turno.'
};

const auditLog: AuditLog = {
  id: 'log-67890',
  timestamp: new Date(),
  user: 'Juan Pérez',
  role: 'Supervisor',
  module: 'ACCESO',
  action: 'Inicio de Sesión',
  details: 'Usuario jperez inició sesión en Turno Día',
  ip: '192.168.1.105'
};

Build docs developers (and LLMs) love