Endpoint
Description
Creates a new employee background evaluation or resumes an existing one for the current year. The system automatically checks if an active evaluation already exists for the employee in the current year. If found, it redirects to the existing evaluation. Otherwise, it creates a new evaluation and generates an encrypted evaluation ID.Authentication
This endpoint requires session-based authentication via theisLoggedIn middleware. Users must be authenticated before accessing this endpoint.
Request Parameters
The type of evaluation to create:
1- Permanencia (Permanent employee evaluation)2- Nuevo Ingreso (New hire evaluation)
The unique identifier of the employee being evaluated.
How It Works
Evaluation Validation Process
-
Check for Existing Evaluation: The system queries for an active evaluation matching:
- Employee ID (
empID) - Current year (
evalAnio) - Active status (
evalActivo = 1)
- Employee ID (
-
Resume Existing Evaluation: If an evaluation exists:
- Returns the existing evaluation with its encrypted ID
- Flash message: “Retomado evaluación …”
- Redirects to the evaluation view
-
Create New Evaluation: If no evaluation exists:
- Inserts a new evaluation record with
empID, current year, andtipo_eval - Generates encrypted evaluation ID using
ncrypt-jswith keykey_cecc - Updates the evaluation record with the encrypted ID
- Flash message: “Evaluación creada con exito”
- Redirects to the evaluation view
- Inserts a new evaluation record with
Encryption Details
The evaluation ID is encrypted using the
ncrypt-js library with the key "key_cecc". This encrypted value is used throughout the application to securely reference the evaluation in URLs and subsequent API calls.Response
This endpoint performs a redirect rather than returning JSON data.Success Response
Status Code:302 Found
Redirect URL: /evaluacionvLife/evaluacionView/{encryptedData}
Flash Message:
- “Retomado evaluación …” (if resuming existing evaluation)
- “Evaluación creada con exito” (if creating new evaluation)
{encryptedData} is the encrypted evaluation ID that will be used for all subsequent operations.
Error Response
Errors are logged to the console. No specific error response is returned to the client.Database Operations
Queries Used
Example Request
Example Usage Flow
User initiates evaluation
Employee or administrator submits a request to create an evaluation with the employee ID and evaluation type.
System validates
The system checks if an evaluation already exists for the employee in the current year.
Create or resume
- If exists: Redirects to existing evaluation
- If new: Creates evaluation, encrypts the ID, and redirects to the new evaluation
Important Notes
After successful creation or resumption, proceed to View Evaluation to access and complete the evaluation sections.
Related Endpoints
- View Evaluation - Retrieve full evaluation data
- Finalize Evaluation - Mark evaluation as complete