models/communities/Membership.js

export default class Membership {
    /**
     * Creates a Membership.
     *
     * @constructor Membership
     * @param {object} membershipMap - Membership parameters
     * @param {number} membershipMap.role - Role
     * @param {number} membershipMap.status - Status
     * @param {string} [membershipMap.invitationToken] - Token
     * @param {number} [membershipMap.createdAt] - Creation date
     */
    constructor(membershipMap) {
        this.role = membershipMap.role;
        this.status = membershipMap.status;
        this.invitationToken = membershipMap.invitationToken || null;
        this.createdAt = membershipMap.createdAt || null;
        Object.freeze(this);
    }
}