interface HostsService {
    countDocuments(query?: FilterQuery<Host>): Promise<number>;
    create(
        entity: {
            _id?: string;
            categoryInterests: (undefined | string)[] | Category[];
            createdDate?: Date;
            defaultReviewsDisplayType: HostReviewsDisplayType;
            homeProgress?: HostHomeProgress;
            id?: string;
            level: HostLevel;
            modifiedDate?: Date;
            onboardingCompleted?: boolean;
            pagePath: string;
            previousExperience: PreviousExperience;
            publicProfileEnabled?: boolean;
            socialChannels: SocialChannels;
            socialEngagementUserId?: string;
            user: string | SavedUser;
        },
    ): Promise<SavedHost>;
    findById(
        id: string,
        listQueryOptions?: ListQueryOptions<Host>,
    ): Promise<null | SavedHost>;
    findByPagePath(
        pagePath: string,
        listQueryOptions?: ListQueryOptions<Host>,
    ): Promise<null | SavedHost>;
    findByUserId(id: string): Promise<null | SavedHost>;
    getHomeProgress(userId: string): Promise<HostHomeProgressResponse>;
    list(
        query: FilterQuery<Host>,
        listQueryOptions?: ListQueryOptions<Host>,
    ): Promise<SavedHost[]>;
    onboard(onboardingData: OnboardHost): Promise<SavedHost>;
    updateById(id: string, entity: Partial<Host>): Promise<null | SavedHost>;
    updateHomeProgress(
        userId: string,
        update: HostHomeProgressUpdate,
    ): Promise<HostHomeProgressResponse>;
    updateLevelForRenewalStatus(userId: string): Promise<void>;
    updateLevelForSubmission(
        host: SavedHost,
        submissionCount: number,
    ): Promise<void>;
}

Methods

  • Counts the number of host documents that match the given query.

    Parameters

    • Optionalquery: FilterQuery<Host>

      The query to filter the hosts.

    Returns Promise<number>

    • A promise that resolves to the number of matching host documents.
  • Creates a new host entity.

    Parameters

    • entity: {
          _id?: string;
          categoryInterests: (undefined | string)[] | Category[];
          createdDate?: Date;
          defaultReviewsDisplayType: HostReviewsDisplayType;
          homeProgress?: HostHomeProgress;
          id?: string;
          level: HostLevel;
          modifiedDate?: Date;
          onboardingCompleted?: boolean;
          pagePath: string;
          previousExperience: PreviousExperience;
          publicProfileEnabled?: boolean;
          socialChannels: SocialChannels;
          socialEngagementUserId?: string;
          user: string | SavedUser;
      }

      The host entity to create, with 'homeProgress' field optional.

    Returns Promise<SavedHost>

    • A promise that resolves to the saved host entity.
  • Finds a host by its ID.

    Parameters

    • id: string

      The ID of the host to find.

    • OptionallistQueryOptions: ListQueryOptions<Host>

      Additional query options.

    Returns Promise<null | SavedHost>

    • A promise that resolves to the found host or null if not found.
  • Finds a host by its page path.

    Parameters

    • pagePath: string

      The page path of the host to find.

    • OptionallistQueryOptions: ListQueryOptions<Host>

      Additional query options.

    Returns Promise<null | SavedHost>

    • A promise that resolves to the found host or null if not found.
  • Lists hosts that match the given query.

    Parameters

    • query: FilterQuery<Host>

      The query to filter the hosts.

    • OptionallistQueryOptions: ListQueryOptions<Host>

      Additional query options.

    Returns Promise<SavedHost[]>

    • A promise that resolves to an array of saved host entities.