curaflow/backend/configManager.js

41 lines
1.4 KiB
JavaScript

/**
* configManager.js — In-memory fallback config for multi-tenant hospital settings.
* The server.js DB layer takes priority; this is the fallback for legacy/dev use.
*/
const TENANTS = {
'default': {
name: "Curio Clinic", logo: "C",
primaryColor: "#0F172A", secondaryColor: "#38BDF8",
consultationFee: 500, currency: "₹",
workingHours: [{ start: "09:00", end: "13:00" }, { start: "17:00", end: "22:00" }],
daysOff: [0], holidays: ["2024-12-25", "2025-01-01"]
},
'sharma-clinic': {
name: "Dr. Sharma's Cardiology", logo: "S",
primaryColor: "#1E3A8A", secondaryColor: "#60A5FA",
consultationFee: 800, currency: "₹",
workingHours: [{ start: "10:00", end: "14:00" }, { start: "18:00", end: "21:00" }],
daysOff: [0, 6], holidays: []
},
'apollo-hospitals': {
name: "Apollo Multispecialty", logo: "A",
primaryColor: "#065F46", secondaryColor: "#34D399",
consultationFee: 1200, currency: "₹",
workingHours: [{ start: "09:00", end: "22:00" }],
daysOff: [], holidays: ["2024-10-02"]
}
};
function getTenantConfig(tenantId) {
return TENANTS[tenantId] || TENANTS['default'];
}
function updateTenantConfig(tenantId, newConfig) {
if (!TENANTS[tenantId]) TENANTS[tenantId] = { ...TENANTS['default'] };
TENANTS[tenantId] = { ...TENANTS[tenantId], ...newConfig };
}
module.exports = { getTenantConfig, updateTenantConfig };