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

    A bank dashboard's roster, authorized by joining the caller's ACTIVE membership to their role's grants. A member is addressed by bank and user. Role, status and name live only in the rows.

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

    The process service: the shared database and the internal event bus.

    • One page of the members the caller may see, with the roles they may assign. Members of an internal role are invisible unless the caller is internal, whatever the filters say.

      Parameters

      • args: (BankDashboardCaller | BankDashboardStaffCaller) & {
            createdAt?: DbTimestampCriteria;
            includeDeleted?: boolean;
            orderBy?: OrderBy[];
            page?: number;
            pageSize?: number;
            query?: string;
            roleIds?: string[];
            statuses?: ("ACTIVE" | "DELETED" | "DISABLED")[];
            updatedAt?: DbTimestampCriteria;
            userIds?: string[];
        }
        • OptionalcreatedAt?: DbTimestampCriteria
        • OptionalincludeDeleted?: boolean
        • OptionalorderBy?: OrderBy[]

          Defaults to name ASC, email ASC.

        • Optionalpage?: number
        • OptionalpageSize?: number
        • Optionalquery?: string

          Case-insensitive substring over email, first and last name.

        • OptionalroleIds?: string[]
        • Optionalstatuses?: ("ACTIVE" | "DELETED" | "DISABLED")[]
        • OptionalupdatedAt?: DbTimestampCriteria
        • OptionaluserIds?: string[]

      Returns Promise<
          | { error: ServiceError; ok: false }
          | {
              ok: true;
              value: {
                  assignableRoles: Pick<BankDashboardRole, "id" | "name">[];
                  hasNext: boolean;
                  items: BankDashboardMember[];
                  total: number;
              };
          },
      >

    • The caller's own live memberships across every bank, by bank name, with each one's grants and their user row. Needs no permission. q matches the bank's search document.

      Parameters

      • args: {
            bankIds?: string[];
            dashboardEnabled?: boolean;
            dashboardUserId: string;
            enterable?: boolean;
            page?: number;
            pageSize?: number;
            q?: string;
            statuses?: ("ACTIVE" | "DELETED" | "DISABLED")[];
        }
        • OptionalbankIds?: string[]
        • OptionaldashboardEnabled?: boolean

          Only banks whose dashboard is open.

        • dashboardUserId: string
        • Optionalenterable?: boolean

          Only memberships a session can enter: ACTIVE, of a bank whose dashboard is open.

        • Optionalpage?: number
        • OptionalpageSize?: number
        • Optionalq?: string
        • Optionalstatuses?: ("ACTIVE" | "DELETED" | "DISABLED")[]

      Returns Promise<
          {
              ok: true;
              value: {
                  hasNext: boolean;
                  items: BankDashboardOwnMembership[];
                  total: number;
                  user: BankDashboardOwnUser
                  | null;
              };
          },
      >

    • roleId and status need team/role:w, a member within the caller's reach who isn't the caller, and a target role within reach. firstName / lastName rename the caller's OWN user only. A status that changes is recorded as user.workspaceStatusChanged in the same transaction. With a caller's tx nothing is published: the caller publishes after its commit.

      Parameters

      • args: (BankDashboardCaller | BankDashboardStaffCaller) & {
            data: {
                firstName?: string;
                lastName?: string;
                roleId?: string;
                status?: "ACTIVE" | "DISABLED";
            };
            requestMetadata?: {
                geoLocation?: {
                    city?: string;
                    country?: string;
                    countryRegion?: string;
                    flag?: string;
                    latitude?: string;
                    longitude?: string;
                    postalCode?: string;
                    region?: string;
                };
                ipAddress?: string;
                userAgent?: {
                    browser: { name?: string; version?: string };
                    cpu: { architecture?: string };
                    device: { model?: string; type?: string; vendor?: string };
                    engine: { name?: string; version?: string };
                    isBot: boolean;
                    os: { name?: string; version?: string };
                    ua: string;
                };
            };
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
            userId: string;
        }
        • data: {
              firstName?: string;
              lastName?: string;
              roleId?: string;
              status?: "ACTIVE" | "DISABLED";
          }
        • OptionalrequestMetadata?: {
              geoLocation?: {
                  city?: string;
                  country?: string;
                  countryRegion?: string;
                  flag?: string;
                  latitude?: string;
                  longitude?: string;
                  postalCode?: string;
                  region?: string;
              };
              ipAddress?: string;
              userAgent?: {
                  browser: { name?: string; version?: string };
                  cpu: { architecture?: string };
                  device: { model?: string; type?: string; vendor?: string };
                  engine: { name?: string; version?: string };
                  isBot: boolean;
                  os: { name?: string; version?: string };
                  ua: string;
              };
          }

          The request's IP, location and agent, stored on the activity a status change records.

          • OptionalgeoLocation?: {
                city?: string;
                country?: string;
                countryRegion?: string;
                flag?: string;
                latitude?: string;
                longitude?: string;
                postalCode?: string;
                region?: string;
            }

            Geolocation information from the request

          • OptionalipAddress?: string

            IP address of the request

          • OptionaluserAgent?: {
                browser: { name?: string; version?: string };
                cpu: { architecture?: string };
                device: { model?: string; type?: string; vendor?: string };
                engine: { name?: string; version?: string };
                isBot: boolean;
                os: { name?: string; version?: string };
                ua: string;
            }
        • Optionaltx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>
        • userId: string

      Returns Promise<
          | {
              ok: true;
              value: MemberSnapshot & { previousRoleName: string
              | null };
          }
          | { error: UpdateError; ok: false },
      >