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
countDocuments
- countDocuments(query?: FilterQuery<Host>): Promise<number>
Parameters
Optionalquery: FilterQuery<Host>
Returns Promise<number>
- A promise that resolves to the number of matching host documents.
create
- 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>
- A promise that resolves to the saved host entity.
findById
- findById(
id: string,
listQueryOptions?: ListQueryOptions<Host>,
): Promise<null | SavedHost> Parameters
- id: string
OptionallistQueryOptions: ListQueryOptions<Host>
Returns Promise<null | SavedHost>
- A promise that resolves to the found host or null if not found.
findByPagePath
- findByPagePath(
pagePath: string,
listQueryOptions?: ListQueryOptions<Host>,
): Promise<null | SavedHost> Parameters
- pagePath: string
OptionallistQueryOptions: ListQueryOptions<Host>
Returns Promise<null | SavedHost>
- A promise that resolves to the found host or null if not found.
findByUserId
- findByUserId(id: string): Promise<null | SavedHost>
Returns Promise<null | SavedHost>
- A promise that resolves to the found host or null if not found.
getHomeProgress
- getHomeProgress(userId: string): Promise<HostHomeProgressResponse>
- A promise that resolves to the home progress response of the host.
list
- list(
query: FilterQuery<Host>,
listQueryOptions?: ListQueryOptions<Host>,
): Promise<SavedHost[]> Parameters
- query: FilterQuery<Host>
OptionallistQueryOptions: ListQueryOptions<Host>
Returns Promise<SavedHost[]>
- A promise that resolves to an array of saved host entities.
updateById
- updateById(id: string, entity: Partial<Host>): Promise<null | SavedHost>
Parameters
- id: string
- entity: Partial<Host>
Returns Promise<null | SavedHost>
updateLevelForRenewalStatus
- updateLevelForRenewalStatus(userId: string): Promise<void>
Returns Promise<void>
updateLevelForSubmission
- updateLevelForSubmission(
host: SavedHost,
submissionCount: number,
): Promise<void> Returns Promise<void>
Counts the number of host documents that match the given query.