{"size": 519, "ext": "js", "max_stars_repo_path": "api/lib/services/access-controll/access-control.validate.service.js", "max_stars_repo_name": "anniyanvr/articulate", "max_stars_repo_stars_event_min_datetime": "2018-01-17T13:38:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-25T06:42:52.000Z", "max_issues_repo_path": "api/lib/services/access-controll/access-control.validate.service.js", "max_issues_repo_name": "anniyanvr/articulate", "max_issues_repo_issues_event_min_datetime": "2018-01-09T03:53:14.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-15T00:46:45.000Z", "max_forks_repo_path": "api/lib/services/access-controll/access-control.validate.service.js", "max_forks_repo_name": "VinayaSathyanarayana/articulate", "max_forks_repo_forks_event_min_datetime": "2018-02-01T14:38:05.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-25T06:42:54.000Z"}
{"max_stars_count": 592, "max_issues_count": 1092, "max_forks_count": 175, "avg_line_length": 32.4375, "max_line_length": 73, "alphanum_fraction": 0.6608863198}
import { MODEL_ACCESS_POLICY } from '../../../util/constants';
import RedisErrorHandler from '../../errors/redis.error-handler';

module.exports = async function ({ data, returnModel = false }) {

    const { redis } = this.server.app;
    const AccessPolicy = await redis.factory(MODEL_ACCESS_POLICY);
    try {
        await AccessPolicy.createInstance({ data });
        return returnModel ? AccessPolicy : AccessPolicy.allProperties();
    }
    catch (error) {
        throw RedisErrorHandler({ error });
    }
};
