models/communities/VotesQuery.js

import CommunitiesIds from './CommunitiesIds.js';

export default class VotesQuery {
    /**
     * Creates a VotesQuery
     *
     * @constructor VotesQuery
     * @param {CommunitiesIds} ids - Entity IDs.
     */
    constructor(ids) {
        this.ids = ids;
    }

    /**
     * Get all users voted to activity with ID.
     *
     * @memberof VotesQuery
     * @param {string} id - Activity ID.
     * @return {VotesQuery} - New query.
     */
    static forActivity(id) {
        return new VotesQuery(CommunitiesIds.activity(id));
    }

    /**
     * Get only users reacted with specific poll option.
     *
     * @memberof VotesQuery
     * @instance
     * @param {string} pollOptionId - Poll option ID to filter by.
     * @return {VotesQuery} - Same Query instance.
     */
    withPollOptionId(pollOptionId) {
        this.pollOptionId = pollOptionId;
        return this;
    }
}