UNPKG

create-adobug-azure-helper

Version:

A helper library for Azure DevOps automation functions (bug creation, test result update, step logging, etc.)

52 lines (51 loc) 1.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ModuleUserMapping = void 0; class ModuleUserMapping { constructor(initialMapping = {}) { // Initialize with an optional initial mapping this.moduleUserMap = { ...initialMapping }; } /** * Get the user assigned to a specific module. * @param moduleName The name of the module. * @returns The email of the user assigned to the module, or null if not found. */ getUserForModule(moduleName) { if (this.moduleUserMap[moduleName]) { return this.moduleUserMap[moduleName]; } console.warn(`No user found for module: ${moduleName}`); return null; } /** * Add or update a module-to-user mapping. * @param moduleName The name of the module. * @param userEmail The email of the user to assign to the module. */ setUserForModule(moduleName, userEmail) { this.moduleUserMap[moduleName] = userEmail; console.log(`Mapping updated: ${moduleName} -> ${userEmail}`); } /** * Get the entire module-to-user mapping. * @returns The module-to-user mapping object. */ getAllMappings() { return this.moduleUserMap; } /** * Remove a module-to-user mapping. * @param moduleName The name of the module to remove. */ removeModule(moduleName) { if (this.moduleUserMap[moduleName]) { delete this.moduleUserMap[moduleName]; console.log(`Mapping removed for module: ${moduleName}`); } else { console.warn(`No mapping found for module: ${moduleName}`); } } } exports.ModuleUserMapping = ModuleUserMapping;