API · v1 · estable
CODEMETA OSDeveloper Center
ES
Abrir la consola
Entidad · position_assignments

Position Assignment Schema

ID del esquema
position_assignment
Colección
position_assignments
Permisos
  • Leerposition_assignment_view
  • Crearposition_assignment_create
  • Modificarposition_assignment_edit
  • Eliminarposition_assignment_delete

Campos

Position Assignment Schema

position_assignments4 permisos

Schema for the assignment of an employee to a position (Spec docs/specs/org-chart-v2.md, ADR 0097b + ADR 0136a). The canonical subject is `employeeProfileId` — this allows assigning employees who do not (yet) have a linked user account. Resolvers (manager / settings / required-documents) derive the userId via employee_profile.userId when needed; employee-only assignments are simply skipped where a user is required.

positionIduuidobligatorio

FK position._id

employeeProfileIduuidobligatorio

FK employee_profile._id. One employee can hold multiple positions. If the employee has a linked user (employee_profile.userId), resolvers map back to that user for authorization / approver / settings flows.

assignmentKindstringobligatorio

PRIMARY: regular full assignment. SECONDARY: parallel role. ACTING/INTERIM: temporary, validTo required. DEPUTY: standing-deputy mapping.

PRIMARYSECONDARYACTINGDEPUTYINTERIM
isPrimaryForEmployeebooleanobligatorio

Settings inheritance anchor. Exactly one active assignment per employee MUST have isPrimaryForEmployee=true (validated in middleware + DB unique partial index).

Valor por defecto: false
validFromdateobligatorio

First day this assignment is effective (ISO date).

validTodateopcional

Last day this assignment is effective. NULL = open-ended. Required when assignmentKind ∈ {ACTING, INTERIM}.

admite null
backdatedReasonstringopcional

Required reason when validFrom is in the past (audit trail). Enforced by middleware, not schema.

máx. 1000 caracteresadmite null
notesstringopcional

Free-text HR note for this assignment.

máx. 2000 caracteresadmite null

Endpoints estándar

Este recurso sigue el contrato CRUD genérico de la plataforma. Lea las convenciones sobre paginación, idempotencia, bloqueo optimista y auditoría. Los endpoints principales:

  • GET /api/v1/position_assignments — Lista, paginada y filtrable
  • GET /api/v1/position_assignments/<id> — Una entidad
  • POST /api/v1/position_assignments — Crear
  • PATCH /api/v1/position_assignments/<id> — Actualización parcial
  • DELETE /api/v1/position_assignments/<id> — Eliminación lógica
  • GET /api/v1/position_assignments/<id>/timeline — Auditoría y actividades

Búsqueda