first commit

This commit is contained in:
Noor E Ilahi
2026-01-09 12:54:53 +05:30
commit 7ccf44f7da
1070 changed files with 113036 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
import { store } from '@/store';
/**
* Gate Class
*/
class Gate {
/**
* @param {any} user
*/
auth(user) {
this.user = user;
}
/**
* @param action
* @param type
* @param model
* @returns {boolean|*}
*/
allow(action, type, model = null) {
if (!store.state['policies']['policies'][type]) {
throw new Error(`Cannot find policy ${type}`);
}
return store.state['policies']['policies'][type][action](this.user, model);
}
/**
* @param {*} action
* @param {*} type
* @param {*} model
*/
deny(action, type, model = null) {
return !this.allow(action, type, model);
}
}
export default {
install(Vue) {
Vue.prototype._gate = new Gate();
Object.defineProperty(Vue.prototype, '$gate', {
get() {
return Vue.prototype._gate;
},
});
Object.defineProperty(Vue.prototype, '$can', {
get() {
return this.$gate.allow.bind(this.$gate);
},
});
},
};

View File

@@ -0,0 +1,21 @@
import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';
import Vue from 'vue';
if (
process.env.NODE_ENV !== 'development' &&
'VUE_APP_SENTRY_DSN' in process.env &&
process.env.VUE_APP_SENTRY_DSN !== 'undefined'
) {
Sentry.init({
release: process.env.VUE_APP_VERSION,
environment: process.env.NODE_ENV,
dsn: process.env.VUE_APP_SENTRY_DSN,
integrations: [
new Integrations.Vue({
Vue,
attachProps: true,
}),
],
});
}

View File

@@ -0,0 +1,16 @@
import { extend, configure } from 'vee-validate';
import i18n from '@/i18n';
import * as validationRules from 'vee-validate/dist/rules';
import isEmail from 'validator/lib/isEmail';
for (const rule in validationRules) {
extend(rule, validationRules[rule]);
}
configure({
defaultMessage: (field, values) => {
return i18n.t(`validation.${values._rule_}`, values);
},
});
extend('email', value => isEmail(String(value), { require_tld: false }));