@cfxlabsinc/b2b-services
    Preparing search index...

    Operator-side writes to CUSTOMER dashboard workspaces, and staff's reads of them.

    Index
    instance: (...args: []) => CustomerDashboardWorkspaceAdminService = ...

    The process service, on the shared database.

    • A CUSTOMER workspace on the default role set, with no customer and no members yet. A customer later takes it (CustomerService.createIn).

      Parameters

      • __namedParameters: { tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations> } = {}

      Returns Promise<CreatedWorkspace>

    • create's workspace with userId as its owner: an ACTIVE member on the default role set's top non-internal role. On an error, a caller's tx must be rolled back by the caller.

      Parameters

      • __namedParameters: {
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
            userId: string;
        }

      Returns Promise<CreatedWorkspace>

    • The workspaces CFX staff may enter (user-shadow:r only): live ACTIVE customers with their main organization, each with its owner's keys as the caller may use them.

      Parameters

      • input: {
            customerIds?: string[];
            page?: number;
            pageSize?: number;
            q?: string;
            staff: Pick<DashboardStaff, "canShadowRead" | "canShadowWrite">;
            workspaceIds?: string[];
        }

      Returns Promise<
          | {
              ok: true;
              value: {
                  hasNext: boolean;
                  items: CustomerDashboardStaffWorkspace[];
                  total: number;
              };
          }
          | { error: ServiceError; ok: false },
      >

    • Replace the billing addresses (trimmed, lowercased and deduplicated), the contact line (trimmed; blank clears it), or both. A contact line over 200 characters or with a control character is refused and nothing is written.

      Parameters

      • input: CustomerDashboardWorkspaceBillingUpdate

      Returns Promise<
          | { ok: true; value: CustomerDashboardWorkspaceBilling }
          | {
              error:
                  | ServiceError<"CUSTOMER_NOT_FOUND", { customerId: string }>
                  | ServiceError<"INVALID_BILLING_EMAIL_ADDRESS", { emailAddress: string }>
                  | ServiceError<"INVALID_BILLING_ATTENTION", { attention: string }>;
              ok: false;
          },
      >