models/communities/UserVotes.js

import User from './User.js';

export default class UserVotes {
    /**
     * Creates a new UserVotes instance from the provider parameters.
     *
     * @constructor UserVotes
     * @param {Object} votesMap - User votes parameters
     * @param {User} votesMap.user - User
     * @param {string[]} [votesMap.votes=[]] - Votes
     */
    constructor(votesMap) {
        const rawUser = votesMap.user;
        if (rawUser !== undefined && rawUser != null) {
            this.user = User.create(rawUser);
        }

        this.votes = votesMap.votes;

        Object.freeze(this);
    }
}