semantic update

This commit is contained in:
2026-02-08 22:53:54 +03:00
parent e6087bd3c1
commit 235b0e3c9f
71 changed files with 68034 additions and 62417 deletions

View File

@@ -58,6 +58,8 @@ async function createUser(userData) {
// [DEF:getRoles:Function]
/**
* @purpose Fetches all available system roles.
* @pre User must be authenticated with Admin privileges.
* @post Returns an array of role objects.
* @returns {Promise<Array>}
* @relation CALLS -> backend.src.api.routes.admin.list_roles
*/
@@ -77,6 +79,8 @@ async function getRoles() {
// [DEF:getADGroupMappings:Function]
/**
* @purpose Fetches mappings between AD groups and local roles.
* @pre User must be authenticated with Admin privileges.
* @post Returns an array of AD group mapping objects.
* @returns {Promise<Array>}
*/
async function getADGroupMappings() {
@@ -95,6 +99,8 @@ async function getADGroupMappings() {
// [DEF:createADGroupMapping:Function]
/**
* @purpose Creates or updates an AD group to Role mapping.
* @pre User must be authenticated with Admin privileges.
* @post New or updated mapping created in auth.db.
* @param {Object} mappingData - Mapping details (ad_group, role_id).
* @returns {Promise<Object>}
*/
@@ -114,6 +120,8 @@ async function createADGroupMapping(mappingData) {
// [DEF:updateUser:Function]
/**
* @purpose Updates an existing user.
* @pre User must be authenticated with Admin privileges.
* @post User record updated in auth.db.
* @param {string} userId - Target user ID.
* @param {Object} userData - Updated user data.
* @returns {Promise<Object>}
@@ -134,6 +142,8 @@ async function updateUser(userId, userData) {
// [DEF:deleteUser:Function]
/**
* @purpose Deletes a user.
* @pre User must be authenticated with Admin privileges.
* @post User record removed from auth.db.
* @param {string} userId - Target user ID.
* @returns {Promise<void>}
*/
@@ -152,6 +162,8 @@ async function deleteUser(userId) {
// [DEF:createRole:Function]
/**
* @purpose Creates a new role.
* @pre User must be authenticated with Admin privileges.
* @post New role created in auth.db.
* @param {Object} roleData - Role details (name, description, permissions).
* @returns {Promise<Object>}
*/
@@ -224,6 +236,45 @@ async function getPermissions() {
}
// [/DEF:getPermissions:Function]
// [DEF:getLoggingConfig:Function]
/**
* @purpose Fetches current logging configuration.
* @returns {Promise<Object>} - Logging config with level, task_log_level, enable_belief_state.
* @relation CALLS -> backend.src.api.routes.settings.get_logging_config
*/
async function getLoggingConfig() {
console.log('[getLoggingConfig][Entry]');
try {
const config = await api.requestApi('/settings/logging', 'GET');
console.log('[getLoggingConfig][Coherence:OK]');
return config;
} catch (e) {
console.error('[getLoggingConfig][Coherence:Failed]', e);
throw e;
}
}
// [/DEF:getLoggingConfig:Function]
// [DEF:updateLoggingConfig:Function]
/**
* @purpose Updates logging configuration.
* @param {Object} configData - Logging config (level, task_log_level, enable_belief_state).
* @returns {Promise<Object>}
* @relation CALLS -> backend.src.api.routes.settings.update_logging_config
*/
async function updateLoggingConfig(configData) {
console.log('[updateLoggingConfig][Entry]');
try {
const config = await api.requestApi('/settings/logging', 'PATCH', configData);
console.log('[updateLoggingConfig][Coherence:OK]');
return config;
} catch (e) {
console.error('[updateLoggingConfig][Coherence:Failed]', e);
throw e;
}
}
// [/DEF:updateLoggingConfig:Function]
export const adminService = {
getUsers,
createUser,
@@ -235,7 +286,9 @@ export const adminService = {
deleteRole,
getPermissions,
getADGroupMappings,
createADGroupMapping
createADGroupMapping,
getLoggingConfig,
updateLoggingConfig
};
// [/DEF:adminService:Module]