From 9c20e2952a03551af1bc18f6aac8500e7185e7e6 Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Sat, 12 Apr 2025 00:25:05 +0000 Subject: [PATCH] Refactor data model: Renamed organizations to customers and adjusted related data structures. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/c25da6d4-635b-4549-90e0-149e40abb4ff.jpg --- server/storage.ts | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/server/storage.ts b/server/storage.ts index 61a76f7..1f88189 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -121,60 +121,68 @@ export interface IStorage { export class MemStorage implements IStorage { private usersMap: Map; - private orgsMap: Map; + private customersMap: Map; + private customerUserMap: Map; private domainsMap: Map; + private domainCredentialsMap: Map; private recordsMap: Map; private providersMap: Map; private apiTokensMap: Map; + private apiTokenCustomerAccessMap: Map; private historyMap: Map; private webhooksMap: Map; private webhookDeliveryLogsMap: Map; private metricsMap: Map; private customRolesMap: Map; - // Group maps have been removed // Counters for IDs private userIdCounter: number; - private orgIdCounter: number; + private customerIdCounter: number; + private customerUserIdCounter: number; private domainIdCounter: number; + private domainCredentialsIdCounter: number; private recordIdCounter: number; private providerIdCounter: number; private apiTokenIdCounter: number; + private apiTokenCustomerAccessIdCounter: number; private historyIdCounter: number; private webhookIdCounter: number; private webhookDeliveryLogIdCounter: number; private metricIdCounter: number; private customRoleIdCounter: number; - // Group counters have been removed public sessionStore: any; constructor() { this.usersMap = new Map(); - this.orgsMap = new Map(); + this.customersMap = new Map(); + this.customerUserMap = new Map(); this.domainsMap = new Map(); + this.domainCredentialsMap = new Map(); this.recordsMap = new Map(); this.providersMap = new Map(); this.apiTokensMap = new Map(); + this.apiTokenCustomerAccessMap = new Map(); this.historyMap = new Map(); this.webhooksMap = new Map(); this.webhookDeliveryLogsMap = new Map(); this.metricsMap = new Map(); this.customRolesMap = new Map(); - // Group maps initialization has been removed this.userIdCounter = 1; - this.orgIdCounter = 1; + this.customerIdCounter = 1; + this.customerUserIdCounter = 1; this.domainIdCounter = 1; + this.domainCredentialsIdCounter = 1; this.recordIdCounter = 1; this.providerIdCounter = 1; this.apiTokenIdCounter = 1; + this.apiTokenCustomerAccessIdCounter = 1; this.historyIdCounter = 1; this.webhookIdCounter = 1; this.webhookDeliveryLogIdCounter = 1; this.metricIdCounter = 1; this.customRoleIdCounter = 1; - // Group counter initialization has been removed // Session store is created in the DatabaseStorage class this.sessionStore = null; @@ -661,9 +669,9 @@ export class MemStorage implements IStorage { return this.webhooksMap.get(parseInt(id)); } - async getWebhooksByOrganization(organizationId: string): Promise { + async getWebhooksByCustomer(customerId: string): Promise { return Array.from(this.webhooksMap.values()) - .filter(webhook => webhook.organizationId === organizationId); + .filter(webhook => webhook.customerId === customerId); } async createWebhook(webhook: InsertWebhook): Promise { @@ -673,7 +681,7 @@ export class MemStorage implements IStorage { id: numId.toString(), name: webhook.name, url: webhook.url, - organizationId: webhook.organizationId, + customerId: webhook.customerId, secret: webhook.secret ?? null, events: webhook.events, isActive: webhook.isActive ?? true,