Extends omsorgCore with full CRUD for Facility/Contract/Order plus configurable value lists and an audit trail, and wires the omsorgapp frontend up to the new facilities, settings, and audit-log modules; includes a sidebar active-nav-item highlight. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
28 lines
1.2 KiB
JavaScript
28 lines
1.2 KiB
JavaScript
const { EmployeesApi } = require('omsorgcore-client-ts');
|
|
const { configFor, callApi } = require('./apiClientHelpers.cjs');
|
|
|
|
// Kapselt /api/employees von omsorgCore (EmployeesController) über den generierten
|
|
// Client (omsorgcore-client-ts). Feldnamen sind camelCase, da ASP.NET Core
|
|
// standardmäßig camelCase-JSON ausgibt.
|
|
async function listEmployees(accessToken, { search, status, employmentType, page = 1, pageSize = 20 } = {}) {
|
|
const api = new EmployeesApi(configFor(accessToken));
|
|
return callApi(api.apiEmployeesGetRaw({ search, status, employmentType, page, pageSize }));
|
|
}
|
|
|
|
async function createEmployee(accessToken, payload) {
|
|
const api = new EmployeesApi(configFor(accessToken));
|
|
return callApi(api.apiEmployeesPostRaw({ createEmployeeRequest: payload }));
|
|
}
|
|
|
|
async function getEmployee(accessToken, id) {
|
|
const api = new EmployeesApi(configFor(accessToken));
|
|
return callApi(api.apiEmployeesIdGetRaw({ id }));
|
|
}
|
|
|
|
async function updateEmployee(accessToken, id, payload) {
|
|
const api = new EmployeesApi(configFor(accessToken));
|
|
return callApi(api.apiEmployeesIdPutRaw({ id, updateEmployeeRequest: payload }));
|
|
}
|
|
|
|
module.exports = { listEmployees, createEmployee, getEmployee, updateEmployee };
|