Updated via schema editor on 2025-09-16 21:12
This commit is contained in:
parent
402aa82086
commit
85d404dd4d
File diff suppressed because one or more lines are too long
@ -134,40 +134,40 @@ module.exports = class OrganizationsDBApi {
|
|||||||
|
|
||||||
const output = organizations.get({ plain: true });
|
const output = organizations.get({ plain: true });
|
||||||
|
|
||||||
output.users_organizations = await organizations.getUsers_organizations({
|
|
||||||
transaction,
|
|
||||||
});
|
|
||||||
|
|
||||||
output.categories_organizations =
|
output.categories_organizations =
|
||||||
await organizations.getCategories_organizations({
|
await organizations.getCategories_organizations({
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
output.customers_organizations =
|
|
||||||
await organizations.getCustomers_organizations({
|
|
||||||
transaction,
|
|
||||||
});
|
|
||||||
|
|
||||||
output.furniture_types_organizations =
|
|
||||||
await organizations.getFurniture_types_organizations({
|
|
||||||
transaction,
|
|
||||||
});
|
|
||||||
|
|
||||||
output.orders_organizations = await organizations.getOrders_organizations({
|
|
||||||
transaction,
|
|
||||||
});
|
|
||||||
|
|
||||||
output.payments_organizations =
|
output.payments_organizations =
|
||||||
await organizations.getPayments_organizations({
|
await organizations.getPayments_organizations({
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
output.furniture_types_organizations =
|
||||||
|
await organizations.getFurniture_types_organizations({
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
output.reports_organizations = await organizations.getReports_organizations(
|
output.reports_organizations = await organizations.getReports_organizations(
|
||||||
{
|
{
|
||||||
transaction,
|
transaction,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
output.customers_organizations =
|
||||||
|
await organizations.getCustomers_organizations({
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
output.orders_organizations = await organizations.getOrders_organizations({
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
output.users_organizations = await organizations.getUsers_organizations({
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
backend/src/db/migrations/1758057086747.js
Normal file
36
backend/src/db/migrations/1758057086747.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
module.exports = {
|
||||||
|
/**
|
||||||
|
* @param {QueryInterface} queryInterface
|
||||||
|
* @param {Sequelize} Sequelize
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async up(queryInterface, Sequelize) {
|
||||||
|
/**
|
||||||
|
* @type {Transaction}
|
||||||
|
*/
|
||||||
|
const transaction = await queryInterface.sequelize.transaction();
|
||||||
|
try {
|
||||||
|
await transaction.commit();
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @param {QueryInterface} queryInterface
|
||||||
|
* @param {Sequelize} Sequelize
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async down(queryInterface, Sequelize) {
|
||||||
|
/**
|
||||||
|
* @type {Transaction}
|
||||||
|
*/
|
||||||
|
const transaction = await queryInterface.sequelize.transaction();
|
||||||
|
try {
|
||||||
|
await transaction.commit();
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -34,14 +34,6 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
organizations.associate = (db) => {
|
organizations.associate = (db) => {
|
||||||
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
|
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
|
||||||
|
|
||||||
db.organizations.hasMany(db.users, {
|
|
||||||
as: 'users_organizations',
|
|
||||||
foreignKey: {
|
|
||||||
name: 'organizationsId',
|
|
||||||
},
|
|
||||||
constraints: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
db.organizations.hasMany(db.categories, {
|
db.organizations.hasMany(db.categories, {
|
||||||
as: 'categories_organizations',
|
as: 'categories_organizations',
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
@ -50,30 +42,6 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
constraints: false,
|
constraints: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
db.organizations.hasMany(db.customers, {
|
|
||||||
as: 'customers_organizations',
|
|
||||||
foreignKey: {
|
|
||||||
name: 'organizationsId',
|
|
||||||
},
|
|
||||||
constraints: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
db.organizations.hasMany(db.furniture_types, {
|
|
||||||
as: 'furniture_types_organizations',
|
|
||||||
foreignKey: {
|
|
||||||
name: 'organizationsId',
|
|
||||||
},
|
|
||||||
constraints: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
db.organizations.hasMany(db.orders, {
|
|
||||||
as: 'orders_organizations',
|
|
||||||
foreignKey: {
|
|
||||||
name: 'organizationsId',
|
|
||||||
},
|
|
||||||
constraints: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
db.organizations.hasMany(db.payments, {
|
db.organizations.hasMany(db.payments, {
|
||||||
as: 'payments_organizations',
|
as: 'payments_organizations',
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
@ -82,6 +50,14 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
constraints: false,
|
constraints: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
db.organizations.hasMany(db.furniture_types, {
|
||||||
|
as: 'furniture_types_organizations',
|
||||||
|
foreignKey: {
|
||||||
|
name: 'organizationsId',
|
||||||
|
},
|
||||||
|
constraints: false,
|
||||||
|
});
|
||||||
|
|
||||||
db.organizations.hasMany(db.reports, {
|
db.organizations.hasMany(db.reports, {
|
||||||
as: 'reports_organizations',
|
as: 'reports_organizations',
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
@ -90,6 +66,30 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
constraints: false,
|
constraints: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
db.organizations.hasMany(db.customers, {
|
||||||
|
as: 'customers_organizations',
|
||||||
|
foreignKey: {
|
||||||
|
name: 'organizationsId',
|
||||||
|
},
|
||||||
|
constraints: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
db.organizations.hasMany(db.orders, {
|
||||||
|
as: 'orders_organizations',
|
||||||
|
foreignKey: {
|
||||||
|
name: 'organizationsId',
|
||||||
|
},
|
||||||
|
constraints: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
db.organizations.hasMany(db.users, {
|
||||||
|
as: 'users_organizations',
|
||||||
|
foreignKey: {
|
||||||
|
name: 'organizationsId',
|
||||||
|
},
|
||||||
|
constraints: false,
|
||||||
|
});
|
||||||
|
|
||||||
//end loop
|
//end loop
|
||||||
|
|
||||||
db.organizations.belongsTo(db.users, {
|
db.organizations.belongsTo(db.users, {
|
||||||
|
|||||||
@ -101,15 +101,15 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const entities = [
|
const entities = [
|
||||||
'users',
|
|
||||||
'categories',
|
'categories',
|
||||||
'customers',
|
|
||||||
'furniture_types',
|
|
||||||
'orders',
|
|
||||||
'roles',
|
|
||||||
'payments',
|
'payments',
|
||||||
|
'furniture_types',
|
||||||
'reports',
|
'reports',
|
||||||
'permissions',
|
'permissions',
|
||||||
|
'customers',
|
||||||
|
'orders',
|
||||||
|
'users',
|
||||||
|
'roles',
|
||||||
'organizations',
|
'organizations',
|
||||||
,
|
,
|
||||||
];
|
];
|
||||||
@ -151,34 +151,6 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
);`);
|
);`);
|
||||||
|
|
||||||
await queryInterface.bulkInsert('rolesPermissionsPermissions', [
|
await queryInterface.bulkInsert('rolesPermissionsPermissions', [
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('CREATE_USERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('READ_USERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('UPDATE_USERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('DELETE_USERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
@ -260,70 +232,70 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
permissionId: getId('CREATE_CUSTOMERS'),
|
permissionId: getId('CREATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
permissionId: getId('READ_CUSTOMERS'),
|
permissionId: getId('READ_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
permissionId: getId('UPDATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
permissionId: getId('DELETE_CUSTOMERS'),
|
permissionId: getId('DELETE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SalesLead'),
|
roles_permissionsId: getId('SalesLead'),
|
||||||
permissionId: getId('READ_CUSTOMERS'),
|
permissionId: getId('READ_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SalesLead'),
|
roles_permissionsId: getId('SalesLead'),
|
||||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
permissionId: getId('UPDATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('CustomerSupport'),
|
roles_permissionsId: getId('CustomerSupport'),
|
||||||
permissionId: getId('READ_CUSTOMERS'),
|
permissionId: getId('READ_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('CustomerSupport'),
|
roles_permissionsId: getId('CustomerSupport'),
|
||||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
permissionId: getId('UPDATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('DataAnalyst'),
|
roles_permissionsId: getId('DataAnalyst'),
|
||||||
permissionId: getId('READ_CUSTOMERS'),
|
permissionId: getId('READ_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('DataAnalyst'),
|
roles_permissionsId: getId('DataAnalyst'),
|
||||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
permissionId: getId('UPDATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -403,167 +375,6 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
permissionId: getId('UPDATE_FURNITURE_TYPES'),
|
permissionId: getId('UPDATE_FURNITURE_TYPES'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('CREATE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('READ_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('UPDATE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('DELETE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SalesLead'),
|
|
||||||
permissionId: getId('CREATE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SalesLead'),
|
|
||||||
permissionId: getId('READ_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SalesLead'),
|
|
||||||
permissionId: getId('UPDATE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('InventorySpecialist'),
|
|
||||||
permissionId: getId('READ_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('InventorySpecialist'),
|
|
||||||
permissionId: getId('UPDATE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('CustomerSupport'),
|
|
||||||
permissionId: getId('READ_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('CustomerSupport'),
|
|
||||||
permissionId: getId('UPDATE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('DataAnalyst'),
|
|
||||||
permissionId: getId('READ_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('DataAnalyst'),
|
|
||||||
permissionId: getId('UPDATE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('CREATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('READ_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('UPDATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('OperationsManager'),
|
|
||||||
permissionId: getId('DELETE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SalesLead'),
|
|
||||||
permissionId: getId('READ_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SalesLead'),
|
|
||||||
permissionId: getId('UPDATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('CustomerSupport'),
|
|
||||||
permissionId: getId('READ_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('CustomerSupport'),
|
|
||||||
permissionId: getId('UPDATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('DataAnalyst'),
|
|
||||||
permissionId: getId('READ_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('DataAnalyst'),
|
|
||||||
permissionId: getId('UPDATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
@ -648,6 +459,195 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
permissionId: getId('UPDATE_REPORTS'),
|
permissionId: getId('UPDATE_REPORTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('CREATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('READ_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('DELETE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SalesLead'),
|
||||||
|
permissionId: getId('READ_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SalesLead'),
|
||||||
|
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('CustomerSupport'),
|
||||||
|
permissionId: getId('READ_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('CustomerSupport'),
|
||||||
|
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('DataAnalyst'),
|
||||||
|
permissionId: getId('READ_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('DataAnalyst'),
|
||||||
|
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('CREATE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('READ_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('UPDATE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('DELETE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SalesLead'),
|
||||||
|
permissionId: getId('CREATE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SalesLead'),
|
||||||
|
permissionId: getId('READ_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SalesLead'),
|
||||||
|
permissionId: getId('UPDATE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('InventorySpecialist'),
|
||||||
|
permissionId: getId('READ_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('InventorySpecialist'),
|
||||||
|
permissionId: getId('UPDATE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('CustomerSupport'),
|
||||||
|
permissionId: getId('READ_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('CustomerSupport'),
|
||||||
|
permissionId: getId('UPDATE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('DataAnalyst'),
|
||||||
|
permissionId: getId('READ_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('DataAnalyst'),
|
||||||
|
permissionId: getId('UPDATE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('CREATE_USERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('READ_USERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('UPDATE_USERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('OperationsManager'),
|
||||||
|
permissionId: getId('DELETE_USERS'),
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
@ -683,31 +683,6 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
permissionId: getId('CREATE_SEARCH'),
|
permissionId: getId('CREATE_SEARCH'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('CREATE_USERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('READ_USERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('UPDATE_USERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('DELETE_USERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
@ -737,25 +712,25 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('Administrator'),
|
roles_permissionsId: getId('Administrator'),
|
||||||
permissionId: getId('CREATE_CUSTOMERS'),
|
permissionId: getId('CREATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('Administrator'),
|
roles_permissionsId: getId('Administrator'),
|
||||||
permissionId: getId('READ_CUSTOMERS'),
|
permissionId: getId('READ_PAYMENTS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('Administrator'),
|
roles_permissionsId: getId('Administrator'),
|
||||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
permissionId: getId('UPDATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('Administrator'),
|
roles_permissionsId: getId('Administrator'),
|
||||||
permissionId: getId('DELETE_CUSTOMERS'),
|
permissionId: getId('DELETE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -783,56 +758,6 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
permissionId: getId('DELETE_FURNITURE_TYPES'),
|
permissionId: getId('DELETE_FURNITURE_TYPES'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('CREATE_ORDERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('READ_ORDERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('UPDATE_ORDERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('DELETE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('CREATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('READ_PAYMENTS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('UPDATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('Administrator'),
|
|
||||||
permissionId: getId('DELETE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
@ -861,25 +786,75 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
roles_permissionsId: getId('Administrator'),
|
||||||
|
permissionId: getId('CREATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('Administrator'),
|
||||||
|
permissionId: getId('READ_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('Administrator'),
|
||||||
|
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('Administrator'),
|
||||||
|
permissionId: getId('DELETE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('Administrator'),
|
||||||
|
permissionId: getId('CREATE_ORDERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('Administrator'),
|
||||||
|
permissionId: getId('READ_ORDERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('Administrator'),
|
||||||
|
permissionId: getId('UPDATE_ORDERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('Administrator'),
|
||||||
|
permissionId: getId('DELETE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('Administrator'),
|
||||||
permissionId: getId('CREATE_USERS'),
|
permissionId: getId('CREATE_USERS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
roles_permissionsId: getId('Administrator'),
|
||||||
permissionId: getId('READ_USERS'),
|
permissionId: getId('READ_USERS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
roles_permissionsId: getId('Administrator'),
|
||||||
permissionId: getId('UPDATE_USERS'),
|
permissionId: getId('UPDATE_USERS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
roles_permissionsId: getId('Administrator'),
|
||||||
permissionId: getId('DELETE_USERS'),
|
permissionId: getId('DELETE_USERS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -912,25 +887,25 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
permissionId: getId('CREATE_CUSTOMERS'),
|
permissionId: getId('CREATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
permissionId: getId('READ_CUSTOMERS'),
|
permissionId: getId('READ_PAYMENTS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
permissionId: getId('UPDATE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
permissionId: getId('DELETE_CUSTOMERS'),
|
permissionId: getId('DELETE_PAYMENTS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -958,81 +933,6 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
permissionId: getId('DELETE_FURNITURE_TYPES'),
|
permissionId: getId('DELETE_FURNITURE_TYPES'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('CREATE_ORDERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('READ_ORDERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('UPDATE_ORDERS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('DELETE_ORDERS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('CREATE_ROLES'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('READ_ROLES'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('UPDATE_ROLES'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('DELETE_ROLES'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('CREATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('READ_PAYMENTS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('UPDATE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
roles_permissionsId: getId('SuperAdmin'),
|
|
||||||
permissionId: getId('DELETE_PAYMENTS'),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
@ -1083,6 +983,106 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
permissionId: getId('DELETE_PERMISSIONS'),
|
permissionId: getId('DELETE_PERMISSIONS'),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('CREATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('READ_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('DELETE_CUSTOMERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('CREATE_ORDERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('READ_ORDERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('UPDATE_ORDERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('DELETE_ORDERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('CREATE_USERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('READ_USERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('UPDATE_USERS'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('DELETE_USERS'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('CREATE_ROLES'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('READ_ROLES'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('UPDATE_ROLES'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
roles_permissionsId: getId('SuperAdmin'),
|
||||||
|
permissionId: getId('DELETE_ROLES'),
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
|
|||||||
@ -3,16 +3,16 @@ const Users = db.users;
|
|||||||
|
|
||||||
const Categories = db.categories;
|
const Categories = db.categories;
|
||||||
|
|
||||||
const Customers = db.customers;
|
const Payments = db.payments;
|
||||||
|
|
||||||
const FurnitureTypes = db.furniture_types;
|
const FurnitureTypes = db.furniture_types;
|
||||||
|
|
||||||
const Orders = db.orders;
|
|
||||||
|
|
||||||
const Payments = db.payments;
|
|
||||||
|
|
||||||
const Reports = db.reports;
|
const Reports = db.reports;
|
||||||
|
|
||||||
|
const Customers = db.customers;
|
||||||
|
|
||||||
|
const Orders = db.orders;
|
||||||
|
|
||||||
const Organizations = db.organizations;
|
const Organizations = db.organizations;
|
||||||
|
|
||||||
const CategoriesData = [
|
const CategoriesData = [
|
||||||
@ -33,35 +33,59 @@ const CategoriesData = [
|
|||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'Benches',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const CustomersData = [
|
const PaymentsData = [
|
||||||
{
|
{
|
||||||
first_name: 'John',
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
last_name: 'Doe',
|
amount: 300,
|
||||||
|
|
||||||
email: 'john.doe@example.com',
|
method: 'CreditCard',
|
||||||
|
|
||||||
|
verified: true,
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
first_name: 'Jane',
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
last_name: 'Smith',
|
amount: 120,
|
||||||
|
|
||||||
email: 'jane.smith@example.com',
|
method: 'CreditCard',
|
||||||
|
|
||||||
|
verified: true,
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
first_name: 'Alice',
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
last_name: 'Johnson',
|
amount: 480,
|
||||||
|
|
||||||
email: 'alice.johnson@example.com',
|
method: 'CreditCard',
|
||||||
|
|
||||||
|
verified: true,
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
|
amount: 270,
|
||||||
|
|
||||||
|
method: 'CreditCard',
|
||||||
|
|
||||||
|
verified: true,
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
@ -103,80 +127,16 @@ const FurnitureTypesData = [
|
|||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
];
|
|
||||||
|
|
||||||
const OrdersData = [
|
|
||||||
{
|
{
|
||||||
// type code here for "relation_one" field
|
name: 'Rustic Bench',
|
||||||
|
|
||||||
|
price: 180,
|
||||||
|
|
||||||
|
stock_level: 10,
|
||||||
|
|
||||||
// type code here for "relation_many" field
|
// type code here for "relation_many" field
|
||||||
|
|
||||||
order_date: new Date('2023-10-01T10:00:00Z'),
|
|
||||||
|
|
||||||
status: 'Delivered',
|
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
// type code here for "relation_many" field
|
|
||||||
|
|
||||||
order_date: new Date('2023-10-02T11:30:00Z'),
|
|
||||||
|
|
||||||
status: 'Pending',
|
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
// type code here for "relation_many" field
|
|
||||||
|
|
||||||
order_date: new Date('2023-10-03T14:00:00Z'),
|
|
||||||
|
|
||||||
status: 'Pending',
|
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const PaymentsData = [
|
|
||||||
{
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
amount: 300,
|
|
||||||
|
|
||||||
method: 'CreditCard',
|
|
||||||
|
|
||||||
verified: true,
|
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
amount: 120,
|
|
||||||
|
|
||||||
method: 'PhonePe',
|
|
||||||
|
|
||||||
verified: true,
|
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
amount: 480,
|
|
||||||
|
|
||||||
method: 'CreditCard',
|
|
||||||
|
|
||||||
verified: true,
|
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -205,6 +165,106 @@ const ReportsData = [
|
|||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: 'Order Fulfillment Efficiency',
|
||||||
|
|
||||||
|
generated_at: new Date('2023-10-04T11:00:00Z'),
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const CustomersData = [
|
||||||
|
{
|
||||||
|
first_name: 'John',
|
||||||
|
|
||||||
|
last_name: 'Doe',
|
||||||
|
|
||||||
|
email: 'john.doe@example.com',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
first_name: 'Jane',
|
||||||
|
|
||||||
|
last_name: 'Smith',
|
||||||
|
|
||||||
|
email: 'jane.smith@example.com',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
first_name: 'Alice',
|
||||||
|
|
||||||
|
last_name: 'Johnson',
|
||||||
|
|
||||||
|
email: 'alice.johnson@example.com',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
first_name: 'Bob',
|
||||||
|
|
||||||
|
last_name: 'Brown',
|
||||||
|
|
||||||
|
email: 'bob.brown@example.com',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const OrdersData = [
|
||||||
|
{
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
|
// type code here for "relation_many" field
|
||||||
|
|
||||||
|
order_date: new Date('2023-10-01T10:00:00Z'),
|
||||||
|
|
||||||
|
status: 'Shipped',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
|
// type code here for "relation_many" field
|
||||||
|
|
||||||
|
order_date: new Date('2023-10-02T11:30:00Z'),
|
||||||
|
|
||||||
|
status: 'Pending',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
|
// type code here for "relation_many" field
|
||||||
|
|
||||||
|
order_date: new Date('2023-10-03T14:00:00Z'),
|
||||||
|
|
||||||
|
status: 'Delivered',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
|
// type code here for "relation_many" field
|
||||||
|
|
||||||
|
order_date: new Date('2023-10-04T09:00:00Z'),
|
||||||
|
|
||||||
|
status: 'Delivered',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const OrganizationsData = [
|
const OrganizationsData = [
|
||||||
@ -219,45 +279,12 @@ const OrganizationsData = [
|
|||||||
{
|
{
|
||||||
name: 'HomeStyle Ltd.',
|
name: 'HomeStyle Ltd.',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'UrbanDesigns',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// Similar logic for "relation_many"
|
|
||||||
|
|
||||||
async function associateUserWithOrganization() {
|
|
||||||
const relatedOrganization0 = await Organizations.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
||||||
});
|
|
||||||
const User0 = await Users.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 0,
|
|
||||||
});
|
|
||||||
if (User0?.setOrganization) {
|
|
||||||
await User0.setOrganization(relatedOrganization0);
|
|
||||||
}
|
|
||||||
|
|
||||||
const relatedOrganization1 = await Organizations.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
||||||
});
|
|
||||||
const User1 = await Users.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 1,
|
|
||||||
});
|
|
||||||
if (User1?.setOrganization) {
|
|
||||||
await User1.setOrganization(relatedOrganization1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const relatedOrganization2 = await Organizations.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
||||||
});
|
|
||||||
const User2 = await Users.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 2,
|
|
||||||
});
|
|
||||||
if (User2?.setOrganization) {
|
|
||||||
await User2.setOrganization(relatedOrganization2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function associateCategoryWithOrganization() {
|
async function associateCategoryWithOrganization() {
|
||||||
const relatedOrganization0 = await Organizations.findOne({
|
const relatedOrganization0 = await Organizations.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
@ -291,40 +318,108 @@ async function associateCategoryWithOrganization() {
|
|||||||
if (Category2?.setOrganization) {
|
if (Category2?.setOrganization) {
|
||||||
await Category2.setOrganization(relatedOrganization2);
|
await Category2.setOrganization(relatedOrganization2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async function associateCustomerWithOrganization() {
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
const relatedOrganization0 = await Organizations.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Customer0 = await Customers.findOne({
|
const Category3 = await Categories.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (Category3?.setOrganization) {
|
||||||
|
await Category3.setOrganization(relatedOrganization3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function associatePaymentWithOrder() {
|
||||||
|
const relatedOrder0 = await Orders.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||||
|
});
|
||||||
|
const Payment0 = await Payments.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 0,
|
offset: 0,
|
||||||
});
|
});
|
||||||
if (Customer0?.setOrganization) {
|
if (Payment0?.setOrder) {
|
||||||
await Customer0.setOrganization(relatedOrganization0);
|
await Payment0.setOrder(relatedOrder0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrder1 = await Orders.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||||
|
});
|
||||||
|
const Payment1 = await Payments.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 1,
|
||||||
|
});
|
||||||
|
if (Payment1?.setOrder) {
|
||||||
|
await Payment1.setOrder(relatedOrder1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrder2 = await Orders.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||||
|
});
|
||||||
|
const Payment2 = await Payments.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 2,
|
||||||
|
});
|
||||||
|
if (Payment2?.setOrder) {
|
||||||
|
await Payment2.setOrder(relatedOrder2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrder3 = await Orders.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||||
|
});
|
||||||
|
const Payment3 = await Payments.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (Payment3?.setOrder) {
|
||||||
|
await Payment3.setOrder(relatedOrder3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function associatePaymentWithOrganization() {
|
||||||
|
const relatedOrganization0 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Payment0 = await Payments.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 0,
|
||||||
|
});
|
||||||
|
if (Payment0?.setOrganization) {
|
||||||
|
await Payment0.setOrganization(relatedOrganization0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedOrganization1 = await Organizations.findOne({
|
const relatedOrganization1 = await Organizations.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Customer1 = await Customers.findOne({
|
const Payment1 = await Payments.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 1,
|
offset: 1,
|
||||||
});
|
});
|
||||||
if (Customer1?.setOrganization) {
|
if (Payment1?.setOrganization) {
|
||||||
await Customer1.setOrganization(relatedOrganization1);
|
await Payment1.setOrganization(relatedOrganization1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedOrganization2 = await Organizations.findOne({
|
const relatedOrganization2 = await Organizations.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Customer2 = await Customers.findOne({
|
const Payment2 = await Payments.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 2,
|
offset: 2,
|
||||||
});
|
});
|
||||||
if (Customer2?.setOrganization) {
|
if (Payment2?.setOrganization) {
|
||||||
await Customer2.setOrganization(relatedOrganization2);
|
await Payment2.setOrganization(relatedOrganization2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Payment3 = await Payments.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (Payment3?.setOrganization) {
|
||||||
|
await Payment3.setOrganization(relatedOrganization3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,6 +458,109 @@ async function associateFurnitureTypeWithOrganization() {
|
|||||||
if (FurnitureType2?.setOrganization) {
|
if (FurnitureType2?.setOrganization) {
|
||||||
await FurnitureType2.setOrganization(relatedOrganization2);
|
await FurnitureType2.setOrganization(relatedOrganization2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const FurnitureType3 = await FurnitureTypes.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (FurnitureType3?.setOrganization) {
|
||||||
|
await FurnitureType3.setOrganization(relatedOrganization3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function associateReportWithOrganization() {
|
||||||
|
const relatedOrganization0 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Report0 = await Reports.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 0,
|
||||||
|
});
|
||||||
|
if (Report0?.setOrganization) {
|
||||||
|
await Report0.setOrganization(relatedOrganization0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization1 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Report1 = await Reports.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 1,
|
||||||
|
});
|
||||||
|
if (Report1?.setOrganization) {
|
||||||
|
await Report1.setOrganization(relatedOrganization1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization2 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Report2 = await Reports.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 2,
|
||||||
|
});
|
||||||
|
if (Report2?.setOrganization) {
|
||||||
|
await Report2.setOrganization(relatedOrganization2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Report3 = await Reports.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (Report3?.setOrganization) {
|
||||||
|
await Report3.setOrganization(relatedOrganization3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function associateCustomerWithOrganization() {
|
||||||
|
const relatedOrganization0 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Customer0 = await Customers.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 0,
|
||||||
|
});
|
||||||
|
if (Customer0?.setOrganization) {
|
||||||
|
await Customer0.setOrganization(relatedOrganization0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization1 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Customer1 = await Customers.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 1,
|
||||||
|
});
|
||||||
|
if (Customer1?.setOrganization) {
|
||||||
|
await Customer1.setOrganization(relatedOrganization1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization2 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Customer2 = await Customers.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 2,
|
||||||
|
});
|
||||||
|
if (Customer2?.setOrganization) {
|
||||||
|
await Customer2.setOrganization(relatedOrganization2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Customer3 = await Customers.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (Customer3?.setOrganization) {
|
||||||
|
await Customer3.setOrganization(relatedOrganization3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function associateOrderWithCustomer() {
|
async function associateOrderWithCustomer() {
|
||||||
@ -398,6 +596,17 @@ async function associateOrderWithCustomer() {
|
|||||||
if (Order2?.setCustomer) {
|
if (Order2?.setCustomer) {
|
||||||
await Order2.setCustomer(relatedCustomer2);
|
await Order2.setCustomer(relatedCustomer2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const relatedCustomer3 = await Customers.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
||||||
|
});
|
||||||
|
const Order3 = await Orders.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (Order3?.setCustomer) {
|
||||||
|
await Order3.setCustomer(relatedCustomer3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Similar logic for "relation_many"
|
// Similar logic for "relation_many"
|
||||||
@ -435,110 +644,64 @@ async function associateOrderWithOrganization() {
|
|||||||
if (Order2?.setOrganization) {
|
if (Order2?.setOrganization) {
|
||||||
await Order2.setOrganization(relatedOrganization2);
|
await Order2.setOrganization(relatedOrganization2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async function associatePaymentWithOrder() {
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
const relatedOrder0 = await Orders.findOne({
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
||||||
});
|
});
|
||||||
const Payment0 = await Payments.findOne({
|
const Order3 = await Orders.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 0,
|
offset: 3,
|
||||||
});
|
});
|
||||||
if (Payment0?.setOrder) {
|
if (Order3?.setOrganization) {
|
||||||
await Payment0.setOrder(relatedOrder0);
|
await Order3.setOrganization(relatedOrganization3);
|
||||||
}
|
|
||||||
|
|
||||||
const relatedOrder1 = await Orders.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
||||||
});
|
|
||||||
const Payment1 = await Payments.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 1,
|
|
||||||
});
|
|
||||||
if (Payment1?.setOrder) {
|
|
||||||
await Payment1.setOrder(relatedOrder1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const relatedOrder2 = await Orders.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
||||||
});
|
|
||||||
const Payment2 = await Payments.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 2,
|
|
||||||
});
|
|
||||||
if (Payment2?.setOrder) {
|
|
||||||
await Payment2.setOrder(relatedOrder2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function associatePaymentWithOrganization() {
|
// Similar logic for "relation_many"
|
||||||
|
|
||||||
|
async function associateUserWithOrganization() {
|
||||||
const relatedOrganization0 = await Organizations.findOne({
|
const relatedOrganization0 = await Organizations.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Payment0 = await Payments.findOne({
|
const User0 = await Users.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 0,
|
offset: 0,
|
||||||
});
|
});
|
||||||
if (Payment0?.setOrganization) {
|
if (User0?.setOrganization) {
|
||||||
await Payment0.setOrganization(relatedOrganization0);
|
await User0.setOrganization(relatedOrganization0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedOrganization1 = await Organizations.findOne({
|
const relatedOrganization1 = await Organizations.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Payment1 = await Payments.findOne({
|
const User1 = await Users.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 1,
|
offset: 1,
|
||||||
});
|
});
|
||||||
if (Payment1?.setOrganization) {
|
if (User1?.setOrganization) {
|
||||||
await Payment1.setOrganization(relatedOrganization1);
|
await User1.setOrganization(relatedOrganization1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedOrganization2 = await Organizations.findOne({
|
const relatedOrganization2 = await Organizations.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Payment2 = await Payments.findOne({
|
const User2 = await Users.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 2,
|
offset: 2,
|
||||||
});
|
});
|
||||||
if (Payment2?.setOrganization) {
|
if (User2?.setOrganization) {
|
||||||
await Payment2.setOrganization(relatedOrganization2);
|
await User2.setOrganization(relatedOrganization2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function associateReportWithOrganization() {
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
const relatedOrganization0 = await Organizations.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Report0 = await Reports.findOne({
|
const User3 = await Users.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 0,
|
offset: 3,
|
||||||
});
|
});
|
||||||
if (Report0?.setOrganization) {
|
if (User3?.setOrganization) {
|
||||||
await Report0.setOrganization(relatedOrganization0);
|
await User3.setOrganization(relatedOrganization3);
|
||||||
}
|
|
||||||
|
|
||||||
const relatedOrganization1 = await Organizations.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
||||||
});
|
|
||||||
const Report1 = await Reports.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 1,
|
|
||||||
});
|
|
||||||
if (Report1?.setOrganization) {
|
|
||||||
await Report1.setOrganization(relatedOrganization1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const relatedOrganization2 = await Organizations.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
||||||
});
|
|
||||||
const Report2 = await Reports.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 2,
|
|
||||||
});
|
|
||||||
if (Report2?.setOrganization) {
|
|
||||||
await Report2.setOrganization(relatedOrganization2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,58 +709,58 @@ module.exports = {
|
|||||||
up: async (queryInterface, Sequelize) => {
|
up: async (queryInterface, Sequelize) => {
|
||||||
await Categories.bulkCreate(CategoriesData);
|
await Categories.bulkCreate(CategoriesData);
|
||||||
|
|
||||||
await Customers.bulkCreate(CustomersData);
|
await Payments.bulkCreate(PaymentsData);
|
||||||
|
|
||||||
await FurnitureTypes.bulkCreate(FurnitureTypesData);
|
await FurnitureTypes.bulkCreate(FurnitureTypesData);
|
||||||
|
|
||||||
await Orders.bulkCreate(OrdersData);
|
|
||||||
|
|
||||||
await Payments.bulkCreate(PaymentsData);
|
|
||||||
|
|
||||||
await Reports.bulkCreate(ReportsData);
|
await Reports.bulkCreate(ReportsData);
|
||||||
|
|
||||||
|
await Customers.bulkCreate(CustomersData);
|
||||||
|
|
||||||
|
await Orders.bulkCreate(OrdersData);
|
||||||
|
|
||||||
await Organizations.bulkCreate(OrganizationsData);
|
await Organizations.bulkCreate(OrganizationsData);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
// Similar logic for "relation_many"
|
|
||||||
|
|
||||||
await associateUserWithOrganization(),
|
|
||||||
|
|
||||||
await associateCategoryWithOrganization(),
|
await associateCategoryWithOrganization(),
|
||||||
|
|
||||||
await associateCustomerWithOrganization(),
|
await associatePaymentWithOrder(),
|
||||||
|
|
||||||
|
await associatePaymentWithOrganization(),
|
||||||
|
|
||||||
// Similar logic for "relation_many"
|
// Similar logic for "relation_many"
|
||||||
|
|
||||||
await associateFurnitureTypeWithOrganization(),
|
await associateFurnitureTypeWithOrganization(),
|
||||||
|
|
||||||
|
await associateReportWithOrganization(),
|
||||||
|
|
||||||
|
await associateCustomerWithOrganization(),
|
||||||
|
|
||||||
await associateOrderWithCustomer(),
|
await associateOrderWithCustomer(),
|
||||||
|
|
||||||
// Similar logic for "relation_many"
|
// Similar logic for "relation_many"
|
||||||
|
|
||||||
await associateOrderWithOrganization(),
|
await associateOrderWithOrganization(),
|
||||||
|
|
||||||
await associatePaymentWithOrder(),
|
// Similar logic for "relation_many"
|
||||||
|
|
||||||
await associatePaymentWithOrganization(),
|
await associateUserWithOrganization(),
|
||||||
|
|
||||||
await associateReportWithOrganization(),
|
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
down: async (queryInterface, Sequelize) => {
|
down: async (queryInterface, Sequelize) => {
|
||||||
await queryInterface.bulkDelete('categories', null, {});
|
await queryInterface.bulkDelete('categories', null, {});
|
||||||
|
|
||||||
await queryInterface.bulkDelete('customers', null, {});
|
await queryInterface.bulkDelete('payments', null, {});
|
||||||
|
|
||||||
await queryInterface.bulkDelete('furniture_types', null, {});
|
await queryInterface.bulkDelete('furniture_types', null, {});
|
||||||
|
|
||||||
await queryInterface.bulkDelete('orders', null, {});
|
|
||||||
|
|
||||||
await queryInterface.bulkDelete('payments', null, {});
|
|
||||||
|
|
||||||
await queryInterface.bulkDelete('reports', null, {});
|
await queryInterface.bulkDelete('reports', null, {});
|
||||||
|
|
||||||
|
await queryInterface.bulkDelete('customers', null, {});
|
||||||
|
|
||||||
|
await queryInterface.bulkDelete('orders', null, {});
|
||||||
|
|
||||||
await queryInterface.bulkDelete('organizations', null, {});
|
await queryInterface.bulkDelete('organizations', null, {});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -21,24 +21,24 @@ const openaiRoutes = require('./routes/openai');
|
|||||||
|
|
||||||
const contactFormRoutes = require('./routes/contactForm');
|
const contactFormRoutes = require('./routes/contactForm');
|
||||||
|
|
||||||
const usersRoutes = require('./routes/users');
|
|
||||||
|
|
||||||
const categoriesRoutes = require('./routes/categories');
|
const categoriesRoutes = require('./routes/categories');
|
||||||
|
|
||||||
const customersRoutes = require('./routes/customers');
|
const paymentsRoutes = require('./routes/payments');
|
||||||
|
|
||||||
const furniture_typesRoutes = require('./routes/furniture_types');
|
const furniture_typesRoutes = require('./routes/furniture_types');
|
||||||
|
|
||||||
const ordersRoutes = require('./routes/orders');
|
|
||||||
|
|
||||||
const rolesRoutes = require('./routes/roles');
|
|
||||||
|
|
||||||
const paymentsRoutes = require('./routes/payments');
|
|
||||||
|
|
||||||
const reportsRoutes = require('./routes/reports');
|
const reportsRoutes = require('./routes/reports');
|
||||||
|
|
||||||
const permissionsRoutes = require('./routes/permissions');
|
const permissionsRoutes = require('./routes/permissions');
|
||||||
|
|
||||||
|
const customersRoutes = require('./routes/customers');
|
||||||
|
|
||||||
|
const ordersRoutes = require('./routes/orders');
|
||||||
|
|
||||||
|
const usersRoutes = require('./routes/users');
|
||||||
|
|
||||||
|
const rolesRoutes = require('./routes/roles');
|
||||||
|
|
||||||
const organizationsRoutes = require('./routes/organizations');
|
const organizationsRoutes = require('./routes/organizations');
|
||||||
|
|
||||||
const getBaseUrl = (url) => {
|
const getBaseUrl = (url) => {
|
||||||
@ -106,12 +106,6 @@ app.use('/api/file', fileRoutes);
|
|||||||
app.use('/api/pexels', pexelsRoutes);
|
app.use('/api/pexels', pexelsRoutes);
|
||||||
app.enable('trust proxy');
|
app.enable('trust proxy');
|
||||||
|
|
||||||
app.use(
|
|
||||||
'/api/users',
|
|
||||||
passport.authenticate('jwt', { session: false }),
|
|
||||||
usersRoutes,
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/categories',
|
'/api/categories',
|
||||||
passport.authenticate('jwt', { session: false }),
|
passport.authenticate('jwt', { session: false }),
|
||||||
@ -119,9 +113,9 @@ app.use(
|
|||||||
);
|
);
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/customers',
|
'/api/payments',
|
||||||
passport.authenticate('jwt', { session: false }),
|
passport.authenticate('jwt', { session: false }),
|
||||||
customersRoutes,
|
paymentsRoutes,
|
||||||
);
|
);
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
@ -130,24 +124,6 @@ app.use(
|
|||||||
furniture_typesRoutes,
|
furniture_typesRoutes,
|
||||||
);
|
);
|
||||||
|
|
||||||
app.use(
|
|
||||||
'/api/orders',
|
|
||||||
passport.authenticate('jwt', { session: false }),
|
|
||||||
ordersRoutes,
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(
|
|
||||||
'/api/roles',
|
|
||||||
passport.authenticate('jwt', { session: false }),
|
|
||||||
rolesRoutes,
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(
|
|
||||||
'/api/payments',
|
|
||||||
passport.authenticate('jwt', { session: false }),
|
|
||||||
paymentsRoutes,
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/reports',
|
'/api/reports',
|
||||||
passport.authenticate('jwt', { session: false }),
|
passport.authenticate('jwt', { session: false }),
|
||||||
@ -160,6 +136,30 @@ app.use(
|
|||||||
permissionsRoutes,
|
permissionsRoutes,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
'/api/customers',
|
||||||
|
passport.authenticate('jwt', { session: false }),
|
||||||
|
customersRoutes,
|
||||||
|
);
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
'/api/orders',
|
||||||
|
passport.authenticate('jwt', { session: false }),
|
||||||
|
ordersRoutes,
|
||||||
|
);
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
'/api/users',
|
||||||
|
passport.authenticate('jwt', { session: false }),
|
||||||
|
usersRoutes,
|
||||||
|
);
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
'/api/roles',
|
||||||
|
passport.authenticate('jwt', { session: false }),
|
||||||
|
rolesRoutes,
|
||||||
|
);
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/organizations',
|
'/api/organizations',
|
||||||
passport.authenticate('jwt', { session: false }),
|
passport.authenticate('jwt', { session: false }),
|
||||||
|
|||||||
@ -41,22 +41,22 @@ module.exports = class SearchService {
|
|||||||
throw new ValidationError('iam.errors.searchQueryRequired');
|
throw new ValidationError('iam.errors.searchQueryRequired');
|
||||||
}
|
}
|
||||||
const tableColumns = {
|
const tableColumns = {
|
||||||
users: ['firstName', 'lastName', 'phoneNumber', 'email'],
|
|
||||||
|
|
||||||
categories: ['name'],
|
categories: ['name'],
|
||||||
|
|
||||||
customers: ['first_name', 'last_name', 'email'],
|
|
||||||
|
|
||||||
furniture_types: ['name'],
|
furniture_types: ['name'],
|
||||||
|
|
||||||
reports: ['title'],
|
reports: ['title'],
|
||||||
|
|
||||||
|
customers: ['first_name', 'last_name', 'email'],
|
||||||
|
|
||||||
|
users: ['firstName', 'lastName', 'phoneNumber', 'email'],
|
||||||
|
|
||||||
organizations: ['name'],
|
organizations: ['name'],
|
||||||
};
|
};
|
||||||
const columnsInt = {
|
const columnsInt = {
|
||||||
furniture_types: ['price', 'stock_level'],
|
|
||||||
|
|
||||||
payments: ['amount'],
|
payments: ['amount'],
|
||||||
|
|
||||||
|
furniture_types: ['price', 'stock_level'],
|
||||||
};
|
};
|
||||||
|
|
||||||
let allFoundRecords = [];
|
let allFoundRecords = [];
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export default function WebSiteFooter({ projectName }: WebSiteFooterProps) {
|
|||||||
|
|
||||||
const style = FooterStyle.WITH_PROJECT_NAME;
|
const style = FooterStyle.WITH_PROJECT_NAME;
|
||||||
|
|
||||||
const design = FooterDesigns.DESIGN_DIVERSITY;
|
const design = FooterDesigns.DEFAULT_DESIGN;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -17,9 +17,9 @@ export default function WebSiteHeader({ projectName }: WebSiteHeaderProps) {
|
|||||||
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
||||||
const borders = useAppSelector((state) => state.style.borders);
|
const borders = useAppSelector((state) => state.style.borders);
|
||||||
|
|
||||||
const style = HeaderStyle.PAGES_LEFT;
|
const style = HeaderStyle.PAGES_RIGHT;
|
||||||
|
|
||||||
const design = HeaderDesigns.DESIGN_DIVERSITY;
|
const design = HeaderDesigns.DEFAULT_DESIGN;
|
||||||
return (
|
return (
|
||||||
<header id='websiteHeader' className='overflow-hidden'>
|
<header id='websiteHeader' className='overflow-hidden'>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -58,25 +58,6 @@ export default {
|
|||||||
return { label: val.name, id: val.id };
|
return { label: val.name, id: val.id };
|
||||||
},
|
},
|
||||||
|
|
||||||
customersManyListFormatter(val) {
|
|
||||||
if (!val || !val.length) return [];
|
|
||||||
return val.map((item) => item.first_name);
|
|
||||||
},
|
|
||||||
customersOneListFormatter(val) {
|
|
||||||
if (!val) return '';
|
|
||||||
return val.first_name;
|
|
||||||
},
|
|
||||||
customersManyListFormatterEdit(val) {
|
|
||||||
if (!val || !val.length) return [];
|
|
||||||
return val.map((item) => {
|
|
||||||
return { id: item.id, label: item.first_name };
|
|
||||||
});
|
|
||||||
},
|
|
||||||
customersOneListFormatterEdit(val) {
|
|
||||||
if (!val) return '';
|
|
||||||
return { label: val.first_name, id: val.id };
|
|
||||||
},
|
|
||||||
|
|
||||||
furniture_typesManyListFormatter(val) {
|
furniture_typesManyListFormatter(val) {
|
||||||
if (!val || !val.length) return [];
|
if (!val || !val.length) return [];
|
||||||
return val.map((item) => item.name);
|
return val.map((item) => item.name);
|
||||||
@ -96,6 +77,44 @@ export default {
|
|||||||
return { label: val.name, id: val.id };
|
return { label: val.name, id: val.id };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
permissionsManyListFormatter(val) {
|
||||||
|
if (!val || !val.length) return [];
|
||||||
|
return val.map((item) => item.name);
|
||||||
|
},
|
||||||
|
permissionsOneListFormatter(val) {
|
||||||
|
if (!val) return '';
|
||||||
|
return val.name;
|
||||||
|
},
|
||||||
|
permissionsManyListFormatterEdit(val) {
|
||||||
|
if (!val || !val.length) return [];
|
||||||
|
return val.map((item) => {
|
||||||
|
return { id: item.id, label: item.name };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
permissionsOneListFormatterEdit(val) {
|
||||||
|
if (!val) return '';
|
||||||
|
return { label: val.name, id: val.id };
|
||||||
|
},
|
||||||
|
|
||||||
|
customersManyListFormatter(val) {
|
||||||
|
if (!val || !val.length) return [];
|
||||||
|
return val.map((item) => item.first_name);
|
||||||
|
},
|
||||||
|
customersOneListFormatter(val) {
|
||||||
|
if (!val) return '';
|
||||||
|
return val.first_name;
|
||||||
|
},
|
||||||
|
customersManyListFormatterEdit(val) {
|
||||||
|
if (!val || !val.length) return [];
|
||||||
|
return val.map((item) => {
|
||||||
|
return { id: item.id, label: item.first_name };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
customersOneListFormatterEdit(val) {
|
||||||
|
if (!val) return '';
|
||||||
|
return { label: val.first_name, id: val.id };
|
||||||
|
},
|
||||||
|
|
||||||
ordersManyListFormatter(val) {
|
ordersManyListFormatter(val) {
|
||||||
if (!val || !val.length) return [];
|
if (!val || !val.length) return [];
|
||||||
return val.map((item) => item.order_date);
|
return val.map((item) => item.order_date);
|
||||||
@ -134,25 +153,6 @@ export default {
|
|||||||
return { label: val.name, id: val.id };
|
return { label: val.name, id: val.id };
|
||||||
},
|
},
|
||||||
|
|
||||||
permissionsManyListFormatter(val) {
|
|
||||||
if (!val || !val.length) return [];
|
|
||||||
return val.map((item) => item.name);
|
|
||||||
},
|
|
||||||
permissionsOneListFormatter(val) {
|
|
||||||
if (!val) return '';
|
|
||||||
return val.name;
|
|
||||||
},
|
|
||||||
permissionsManyListFormatterEdit(val) {
|
|
||||||
if (!val || !val.length) return [];
|
|
||||||
return val.map((item) => {
|
|
||||||
return { id: item.id, label: item.name };
|
|
||||||
});
|
|
||||||
},
|
|
||||||
permissionsOneListFormatterEdit(val) {
|
|
||||||
if (!val) return '';
|
|
||||||
return { label: val.name, id: val.id };
|
|
||||||
},
|
|
||||||
|
|
||||||
organizationsManyListFormatter(val) {
|
organizationsManyListFormatter(val) {
|
||||||
if (!val || !val.length) return [];
|
if (!val || !val.length) return [];
|
||||||
return val.map((item) => item.name);
|
return val.map((item) => item.name);
|
||||||
|
|||||||
@ -8,14 +8,6 @@ const menuAside: MenuAsideItem[] = [
|
|||||||
label: 'Dashboard',
|
label: 'Dashboard',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
href: '/users/users-list',
|
|
||||||
label: 'Users',
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
icon: icon.mdiAccountGroup ?? icon.mdiTable,
|
|
||||||
permissions: 'READ_USERS',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
href: '/categories/categories-list',
|
href: '/categories/categories-list',
|
||||||
label: 'Categories',
|
label: 'Categories',
|
||||||
@ -28,15 +20,15 @@ const menuAside: MenuAsideItem[] = [
|
|||||||
permissions: 'READ_CATEGORIES',
|
permissions: 'READ_CATEGORIES',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: '/customers/customers-list',
|
href: '/payments/payments-list',
|
||||||
label: 'Customers',
|
label: 'Payments',
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
icon:
|
icon:
|
||||||
'mdiAccount' in icon
|
'mdiCreditCardOutline' in icon
|
||||||
? icon['mdiAccount' as keyof typeof icon]
|
? icon['mdiCreditCardOutline' as keyof typeof icon]
|
||||||
: icon.mdiTable ?? icon.mdiTable,
|
: icon.mdiTable ?? icon.mdiTable,
|
||||||
permissions: 'READ_CUSTOMERS',
|
permissions: 'READ_PAYMENTS',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: '/furniture_types/furniture_types-list',
|
href: '/furniture_types/furniture_types-list',
|
||||||
@ -49,36 +41,6 @@ const menuAside: MenuAsideItem[] = [
|
|||||||
: icon.mdiTable ?? icon.mdiTable,
|
: icon.mdiTable ?? icon.mdiTable,
|
||||||
permissions: 'READ_FURNITURE_TYPES',
|
permissions: 'READ_FURNITURE_TYPES',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
href: '/orders/orders-list',
|
|
||||||
label: 'Orders',
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
icon:
|
|
||||||
'mdiPackageVariantClosed' in icon
|
|
||||||
? icon['mdiPackageVariantClosed' as keyof typeof icon]
|
|
||||||
: icon.mdiTable ?? icon.mdiTable,
|
|
||||||
permissions: 'READ_ORDERS',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
href: '/roles/roles-list',
|
|
||||||
label: 'Roles',
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
icon: icon.mdiShieldAccountVariantOutline ?? icon.mdiTable,
|
|
||||||
permissions: 'READ_ROLES',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
href: '/payments/payments-list',
|
|
||||||
label: 'Payments',
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
icon:
|
|
||||||
'mdiCreditCardOutline' in icon
|
|
||||||
? icon['mdiCreditCardOutline' as keyof typeof icon]
|
|
||||||
: icon.mdiTable ?? icon.mdiTable,
|
|
||||||
permissions: 'READ_PAYMENTS',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
href: '/reports/reports-list',
|
href: '/reports/reports-list',
|
||||||
label: 'Reports',
|
label: 'Reports',
|
||||||
@ -98,6 +60,44 @@ const menuAside: MenuAsideItem[] = [
|
|||||||
icon: icon.mdiShieldAccountOutline ?? icon.mdiTable,
|
icon: icon.mdiShieldAccountOutline ?? icon.mdiTable,
|
||||||
permissions: 'READ_PERMISSIONS',
|
permissions: 'READ_PERMISSIONS',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
href: '/customers/customers-list',
|
||||||
|
label: 'Customers',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
icon:
|
||||||
|
'mdiAccount' in icon
|
||||||
|
? icon['mdiAccount' as keyof typeof icon]
|
||||||
|
: icon.mdiTable ?? icon.mdiTable,
|
||||||
|
permissions: 'READ_CUSTOMERS',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: '/orders/orders-list',
|
||||||
|
label: 'Orders',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
icon:
|
||||||
|
'mdiPackageVariantClosed' in icon
|
||||||
|
? icon['mdiPackageVariantClosed' as keyof typeof icon]
|
||||||
|
: icon.mdiTable ?? icon.mdiTable,
|
||||||
|
permissions: 'READ_ORDERS',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: '/users/users-list',
|
||||||
|
label: 'Users',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
icon: icon.mdiAccountGroup ?? icon.mdiTable,
|
||||||
|
permissions: 'READ_USERS',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: '/roles/roles-list',
|
||||||
|
label: 'Roles',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
icon: icon.mdiShieldAccountVariantOutline ?? icon.mdiTable,
|
||||||
|
permissions: 'READ_ROLES',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
href: '/organizations/organizations-list',
|
href: '/organizations/organizations-list',
|
||||||
label: 'Organizations',
|
label: 'Organizations',
|
||||||
|
|||||||
@ -28,15 +28,15 @@ const Dashboard = () => {
|
|||||||
defaultValue: 'Loading...',
|
defaultValue: 'Loading...',
|
||||||
});
|
});
|
||||||
|
|
||||||
const [users, setUsers] = React.useState(loadingMessage);
|
|
||||||
const [categories, setCategories] = React.useState(loadingMessage);
|
const [categories, setCategories] = React.useState(loadingMessage);
|
||||||
const [customers, setCustomers] = React.useState(loadingMessage);
|
|
||||||
const [furniture_types, setFurniture_types] = React.useState(loadingMessage);
|
|
||||||
const [orders, setOrders] = React.useState(loadingMessage);
|
|
||||||
const [roles, setRoles] = React.useState(loadingMessage);
|
|
||||||
const [payments, setPayments] = React.useState(loadingMessage);
|
const [payments, setPayments] = React.useState(loadingMessage);
|
||||||
|
const [furniture_types, setFurniture_types] = React.useState(loadingMessage);
|
||||||
const [reports, setReports] = React.useState(loadingMessage);
|
const [reports, setReports] = React.useState(loadingMessage);
|
||||||
const [permissions, setPermissions] = React.useState(loadingMessage);
|
const [permissions, setPermissions] = React.useState(loadingMessage);
|
||||||
|
const [customers, setCustomers] = React.useState(loadingMessage);
|
||||||
|
const [orders, setOrders] = React.useState(loadingMessage);
|
||||||
|
const [users, setUsers] = React.useState(loadingMessage);
|
||||||
|
const [roles, setRoles] = React.useState(loadingMessage);
|
||||||
const [organizations, setOrganizations] = React.useState(loadingMessage);
|
const [organizations, setOrganizations] = React.useState(loadingMessage);
|
||||||
|
|
||||||
const [widgetsRole, setWidgetsRole] = React.useState({
|
const [widgetsRole, setWidgetsRole] = React.useState({
|
||||||
@ -51,27 +51,27 @@ const Dashboard = () => {
|
|||||||
|
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
const entities = [
|
const entities = [
|
||||||
'users',
|
|
||||||
'categories',
|
'categories',
|
||||||
'customers',
|
|
||||||
'furniture_types',
|
|
||||||
'orders',
|
|
||||||
'roles',
|
|
||||||
'payments',
|
'payments',
|
||||||
|
'furniture_types',
|
||||||
'reports',
|
'reports',
|
||||||
'permissions',
|
'permissions',
|
||||||
|
'customers',
|
||||||
|
'orders',
|
||||||
|
'users',
|
||||||
|
'roles',
|
||||||
'organizations',
|
'organizations',
|
||||||
];
|
];
|
||||||
const fns = [
|
const fns = [
|
||||||
setUsers,
|
|
||||||
setCategories,
|
setCategories,
|
||||||
setCustomers,
|
|
||||||
setFurniture_types,
|
|
||||||
setOrders,
|
|
||||||
setRoles,
|
|
||||||
setPayments,
|
setPayments,
|
||||||
|
setFurniture_types,
|
||||||
setReports,
|
setReports,
|
||||||
setPermissions,
|
setPermissions,
|
||||||
|
setCustomers,
|
||||||
|
setOrders,
|
||||||
|
setUsers,
|
||||||
|
setRoles,
|
||||||
setOrganizations,
|
setOrganizations,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -185,38 +185,6 @@ const Dashboard = () => {
|
|||||||
id='dashboard'
|
id='dashboard'
|
||||||
className='grid grid-cols-1 gap-6 lg:grid-cols-3 mb-6'
|
className='grid grid-cols-1 gap-6 lg:grid-cols-3 mb-6'
|
||||||
>
|
>
|
||||||
{hasPermission(currentUser, 'READ_USERS') && (
|
|
||||||
<Link href={'/users/users-list'}>
|
|
||||||
<div
|
|
||||||
className={`${
|
|
||||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
|
||||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
|
||||||
>
|
|
||||||
<div className='flex justify-between align-center'>
|
|
||||||
<div>
|
|
||||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
|
||||||
Users
|
|
||||||
</div>
|
|
||||||
<div className='text-3xl leading-tight font-semibold'>
|
|
||||||
{users}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<BaseIcon
|
|
||||||
className={`${iconsColor}`}
|
|
||||||
w='w-16'
|
|
||||||
h='h-16'
|
|
||||||
size={48}
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
path={icon.mdiAccountGroup || icon.mdiTable}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{hasPermission(currentUser, 'READ_CATEGORIES') && (
|
{hasPermission(currentUser, 'READ_CATEGORIES') && (
|
||||||
<Link href={'/categories/categories-list'}>
|
<Link href={'/categories/categories-list'}>
|
||||||
<div
|
<div
|
||||||
@ -253,8 +221,8 @@ const Dashboard = () => {
|
|||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{hasPermission(currentUser, 'READ_CUSTOMERS') && (
|
{hasPermission(currentUser, 'READ_PAYMENTS') && (
|
||||||
<Link href={'/customers/customers-list'}>
|
<Link href={'/payments/payments-list'}>
|
||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||||
@ -263,10 +231,10 @@ const Dashboard = () => {
|
|||||||
<div className='flex justify-between align-center'>
|
<div className='flex justify-between align-center'>
|
||||||
<div>
|
<div>
|
||||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||||
Customers
|
Payments
|
||||||
</div>
|
</div>
|
||||||
<div className='text-3xl leading-tight font-semibold'>
|
<div className='text-3xl leading-tight font-semibold'>
|
||||||
{customers}
|
{payments}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -278,8 +246,8 @@ const Dashboard = () => {
|
|||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
path={
|
path={
|
||||||
'mdiAccount' in icon
|
'mdiCreditCardOutline' in icon
|
||||||
? icon['mdiAccount' as keyof typeof icon]
|
? icon['mdiCreditCardOutline' as keyof typeof icon]
|
||||||
: icon.mdiTable || icon.mdiTable
|
: icon.mdiTable || icon.mdiTable
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -325,112 +293,6 @@ const Dashboard = () => {
|
|||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{hasPermission(currentUser, 'READ_ORDERS') && (
|
|
||||||
<Link href={'/orders/orders-list'}>
|
|
||||||
<div
|
|
||||||
className={`${
|
|
||||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
|
||||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
|
||||||
>
|
|
||||||
<div className='flex justify-between align-center'>
|
|
||||||
<div>
|
|
||||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
|
||||||
Orders
|
|
||||||
</div>
|
|
||||||
<div className='text-3xl leading-tight font-semibold'>
|
|
||||||
{orders}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<BaseIcon
|
|
||||||
className={`${iconsColor}`}
|
|
||||||
w='w-16'
|
|
||||||
h='h-16'
|
|
||||||
size={48}
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
path={
|
|
||||||
'mdiPackageVariantClosed' in icon
|
|
||||||
? icon['mdiPackageVariantClosed' as keyof typeof icon]
|
|
||||||
: icon.mdiTable || icon.mdiTable
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{hasPermission(currentUser, 'READ_ROLES') && (
|
|
||||||
<Link href={'/roles/roles-list'}>
|
|
||||||
<div
|
|
||||||
className={`${
|
|
||||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
|
||||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
|
||||||
>
|
|
||||||
<div className='flex justify-between align-center'>
|
|
||||||
<div>
|
|
||||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
|
||||||
Roles
|
|
||||||
</div>
|
|
||||||
<div className='text-3xl leading-tight font-semibold'>
|
|
||||||
{roles}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<BaseIcon
|
|
||||||
className={`${iconsColor}`}
|
|
||||||
w='w-16'
|
|
||||||
h='h-16'
|
|
||||||
size={48}
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
path={
|
|
||||||
icon.mdiShieldAccountVariantOutline || icon.mdiTable
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{hasPermission(currentUser, 'READ_PAYMENTS') && (
|
|
||||||
<Link href={'/payments/payments-list'}>
|
|
||||||
<div
|
|
||||||
className={`${
|
|
||||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
|
||||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
|
||||||
>
|
|
||||||
<div className='flex justify-between align-center'>
|
|
||||||
<div>
|
|
||||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
|
||||||
Payments
|
|
||||||
</div>
|
|
||||||
<div className='text-3xl leading-tight font-semibold'>
|
|
||||||
{payments}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<BaseIcon
|
|
||||||
className={`${iconsColor}`}
|
|
||||||
w='w-16'
|
|
||||||
h='h-16'
|
|
||||||
size={48}
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
path={
|
|
||||||
'mdiCreditCardOutline' in icon
|
|
||||||
? icon['mdiCreditCardOutline' as keyof typeof icon]
|
|
||||||
: icon.mdiTable || icon.mdiTable
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{hasPermission(currentUser, 'READ_REPORTS') && (
|
{hasPermission(currentUser, 'READ_REPORTS') && (
|
||||||
<Link href={'/reports/reports-list'}>
|
<Link href={'/reports/reports-list'}>
|
||||||
<div
|
<div
|
||||||
@ -499,6 +361,144 @@ const Dashboard = () => {
|
|||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{hasPermission(currentUser, 'READ_CUSTOMERS') && (
|
||||||
|
<Link href={'/customers/customers-list'}>
|
||||||
|
<div
|
||||||
|
className={`${
|
||||||
|
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||||
|
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||||
|
>
|
||||||
|
<div className='flex justify-between align-center'>
|
||||||
|
<div>
|
||||||
|
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||||
|
Customers
|
||||||
|
</div>
|
||||||
|
<div className='text-3xl leading-tight font-semibold'>
|
||||||
|
{customers}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<BaseIcon
|
||||||
|
className={`${iconsColor}`}
|
||||||
|
w='w-16'
|
||||||
|
h='h-16'
|
||||||
|
size={48}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
path={
|
||||||
|
'mdiAccount' in icon
|
||||||
|
? icon['mdiAccount' as keyof typeof icon]
|
||||||
|
: icon.mdiTable || icon.mdiTable
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{hasPermission(currentUser, 'READ_ORDERS') && (
|
||||||
|
<Link href={'/orders/orders-list'}>
|
||||||
|
<div
|
||||||
|
className={`${
|
||||||
|
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||||
|
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||||
|
>
|
||||||
|
<div className='flex justify-between align-center'>
|
||||||
|
<div>
|
||||||
|
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||||
|
Orders
|
||||||
|
</div>
|
||||||
|
<div className='text-3xl leading-tight font-semibold'>
|
||||||
|
{orders}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<BaseIcon
|
||||||
|
className={`${iconsColor}`}
|
||||||
|
w='w-16'
|
||||||
|
h='h-16'
|
||||||
|
size={48}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
path={
|
||||||
|
'mdiPackageVariantClosed' in icon
|
||||||
|
? icon['mdiPackageVariantClosed' as keyof typeof icon]
|
||||||
|
: icon.mdiTable || icon.mdiTable
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{hasPermission(currentUser, 'READ_USERS') && (
|
||||||
|
<Link href={'/users/users-list'}>
|
||||||
|
<div
|
||||||
|
className={`${
|
||||||
|
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||||
|
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||||
|
>
|
||||||
|
<div className='flex justify-between align-center'>
|
||||||
|
<div>
|
||||||
|
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||||
|
Users
|
||||||
|
</div>
|
||||||
|
<div className='text-3xl leading-tight font-semibold'>
|
||||||
|
{users}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<BaseIcon
|
||||||
|
className={`${iconsColor}`}
|
||||||
|
w='w-16'
|
||||||
|
h='h-16'
|
||||||
|
size={48}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
path={icon.mdiAccountGroup || icon.mdiTable}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{hasPermission(currentUser, 'READ_ROLES') && (
|
||||||
|
<Link href={'/roles/roles-list'}>
|
||||||
|
<div
|
||||||
|
className={`${
|
||||||
|
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||||
|
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||||
|
>
|
||||||
|
<div className='flex justify-between align-center'>
|
||||||
|
<div>
|
||||||
|
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||||
|
Roles
|
||||||
|
</div>
|
||||||
|
<div className='text-3xl leading-tight font-semibold'>
|
||||||
|
{roles}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<BaseIcon
|
||||||
|
className={`${iconsColor}`}
|
||||||
|
w='w-16'
|
||||||
|
h='h-16'
|
||||||
|
size={48}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
path={
|
||||||
|
icon.mdiShieldAccountVariantOutline || icon.mdiTable
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
|
||||||
{hasPermission(currentUser, 'READ_ORGANIZATIONS') && (
|
{hasPermission(currentUser, 'READ_ORGANIZATIONS') && (
|
||||||
<Link href={'/organizations/organizations-list'}>
|
<Link href={'/organizations/organizations-list'}>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -63,59 +63,6 @@ const OrganizationsView = () => {
|
|||||||
<p>{organizations?.name}</p>
|
<p>{organizations?.name}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<>
|
|
||||||
<p className={'block font-bold mb-2'}>Users Organizations</p>
|
|
||||||
<CardBox
|
|
||||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
|
||||||
hasTable
|
|
||||||
>
|
|
||||||
<div className='overflow-x-auto'>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>First Name</th>
|
|
||||||
|
|
||||||
<th>Last Name</th>
|
|
||||||
|
|
||||||
<th>Phone Number</th>
|
|
||||||
|
|
||||||
<th>E-Mail</th>
|
|
||||||
|
|
||||||
<th>Disabled</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{organizations.users_organizations &&
|
|
||||||
Array.isArray(organizations.users_organizations) &&
|
|
||||||
organizations.users_organizations.map((item: any) => (
|
|
||||||
<tr
|
|
||||||
key={item.id}
|
|
||||||
onClick={() =>
|
|
||||||
router.push(`/users/users-view/?id=${item.id}`)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<td data-label='firstName'>{item.firstName}</td>
|
|
||||||
|
|
||||||
<td data-label='lastName'>{item.lastName}</td>
|
|
||||||
|
|
||||||
<td data-label='phoneNumber'>{item.phoneNumber}</td>
|
|
||||||
|
|
||||||
<td data-label='email'>{item.email}</td>
|
|
||||||
|
|
||||||
<td data-label='disabled'>
|
|
||||||
{dataFormatter.booleanFormatter(item.disabled)}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
{!organizations?.users_organizations?.length && (
|
|
||||||
<div className={'text-center py-4'}>No data</div>
|
|
||||||
)}
|
|
||||||
</CardBox>
|
|
||||||
</>
|
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<p className={'block font-bold mb-2'}>Categories organizations</p>
|
<p className={'block font-bold mb-2'}>Categories organizations</p>
|
||||||
<CardBox
|
<CardBox
|
||||||
@ -156,7 +103,7 @@ const OrganizationsView = () => {
|
|||||||
</>
|
</>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<p className={'block font-bold mb-2'}>Customers organizations</p>
|
<p className={'block font-bold mb-2'}>Payments organizations</p>
|
||||||
<CardBox
|
<CardBox
|
||||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||||
hasTable
|
hasTable
|
||||||
@ -165,36 +112,38 @@ const OrganizationsView = () => {
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>FirstName</th>
|
<th>Amount</th>
|
||||||
|
|
||||||
<th>LastName</th>
|
<th>Method</th>
|
||||||
|
|
||||||
<th>Email</th>
|
<th>Verified</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{organizations.customers_organizations &&
|
{organizations.payments_organizations &&
|
||||||
Array.isArray(organizations.customers_organizations) &&
|
Array.isArray(organizations.payments_organizations) &&
|
||||||
organizations.customers_organizations.map((item: any) => (
|
organizations.payments_organizations.map((item: any) => (
|
||||||
<tr
|
<tr
|
||||||
key={item.id}
|
key={item.id}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
router.push(
|
router.push(
|
||||||
`/customers/customers-view/?id=${item.id}`,
|
`/payments/payments-view/?id=${item.id}`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<td data-label='first_name'>{item.first_name}</td>
|
<td data-label='amount'>{item.amount}</td>
|
||||||
|
|
||||||
<td data-label='last_name'>{item.last_name}</td>
|
<td data-label='method'>{item.method}</td>
|
||||||
|
|
||||||
<td data-label='email'>{item.email}</td>
|
<td data-label='verified'>
|
||||||
|
{dataFormatter.booleanFormatter(item.verified)}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{!organizations?.customers_organizations?.length && (
|
{!organizations?.payments_organizations?.length && (
|
||||||
<div className={'text-center py-4'}>No data</div>
|
<div className={'text-center py-4'}>No data</div>
|
||||||
)}
|
)}
|
||||||
</CardBox>
|
</CardBox>
|
||||||
@ -251,6 +200,92 @@ const OrganizationsView = () => {
|
|||||||
</CardBox>
|
</CardBox>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
|
<>
|
||||||
|
<p className={'block font-bold mb-2'}>Reports organizations</p>
|
||||||
|
<CardBox
|
||||||
|
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||||
|
hasTable
|
||||||
|
>
|
||||||
|
<div className='overflow-x-auto'>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Title</th>
|
||||||
|
|
||||||
|
<th>GeneratedAt</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{organizations.reports_organizations &&
|
||||||
|
Array.isArray(organizations.reports_organizations) &&
|
||||||
|
organizations.reports_organizations.map((item: any) => (
|
||||||
|
<tr
|
||||||
|
key={item.id}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(`/reports/reports-view/?id=${item.id}`)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<td data-label='title'>{item.title}</td>
|
||||||
|
|
||||||
|
<td data-label='generated_at'>
|
||||||
|
{dataFormatter.dateTimeFormatter(item.generated_at)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{!organizations?.reports_organizations?.length && (
|
||||||
|
<div className={'text-center py-4'}>No data</div>
|
||||||
|
)}
|
||||||
|
</CardBox>
|
||||||
|
</>
|
||||||
|
|
||||||
|
<>
|
||||||
|
<p className={'block font-bold mb-2'}>Customers organizations</p>
|
||||||
|
<CardBox
|
||||||
|
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||||
|
hasTable
|
||||||
|
>
|
||||||
|
<div className='overflow-x-auto'>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>FirstName</th>
|
||||||
|
|
||||||
|
<th>LastName</th>
|
||||||
|
|
||||||
|
<th>Email</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{organizations.customers_organizations &&
|
||||||
|
Array.isArray(organizations.customers_organizations) &&
|
||||||
|
organizations.customers_organizations.map((item: any) => (
|
||||||
|
<tr
|
||||||
|
key={item.id}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/customers/customers-view/?id=${item.id}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<td data-label='first_name'>{item.first_name}</td>
|
||||||
|
|
||||||
|
<td data-label='last_name'>{item.last_name}</td>
|
||||||
|
|
||||||
|
<td data-label='email'>{item.email}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{!organizations?.customers_organizations?.length && (
|
||||||
|
<div className={'text-center py-4'}>No data</div>
|
||||||
|
)}
|
||||||
|
</CardBox>
|
||||||
|
</>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<p className={'block font-bold mb-2'}>Orders organizations</p>
|
<p className={'block font-bold mb-2'}>Orders organizations</p>
|
||||||
<CardBox
|
<CardBox
|
||||||
@ -293,7 +328,7 @@ const OrganizationsView = () => {
|
|||||||
</>
|
</>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<p className={'block font-bold mb-2'}>Payments organizations</p>
|
<p className={'block font-bold mb-2'}>Users Organizations</p>
|
||||||
<CardBox
|
<CardBox
|
||||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||||
hasTable
|
hasTable
|
||||||
@ -302,79 +337,44 @@ const OrganizationsView = () => {
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Amount</th>
|
<th>First Name</th>
|
||||||
|
|
||||||
<th>Method</th>
|
<th>Last Name</th>
|
||||||
|
|
||||||
<th>Verified</th>
|
<th>Phone Number</th>
|
||||||
|
|
||||||
|
<th>E-Mail</th>
|
||||||
|
|
||||||
|
<th>Disabled</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{organizations.payments_organizations &&
|
{organizations.users_organizations &&
|
||||||
Array.isArray(organizations.payments_organizations) &&
|
Array.isArray(organizations.users_organizations) &&
|
||||||
organizations.payments_organizations.map((item: any) => (
|
organizations.users_organizations.map((item: any) => (
|
||||||
<tr
|
<tr
|
||||||
key={item.id}
|
key={item.id}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
router.push(
|
router.push(`/users/users-view/?id=${item.id}`)
|
||||||
`/payments/payments-view/?id=${item.id}`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<td data-label='amount'>{item.amount}</td>
|
<td data-label='firstName'>{item.firstName}</td>
|
||||||
|
|
||||||
<td data-label='method'>{item.method}</td>
|
<td data-label='lastName'>{item.lastName}</td>
|
||||||
|
|
||||||
<td data-label='verified'>
|
<td data-label='phoneNumber'>{item.phoneNumber}</td>
|
||||||
{dataFormatter.booleanFormatter(item.verified)}
|
|
||||||
|
<td data-label='email'>{item.email}</td>
|
||||||
|
|
||||||
|
<td data-label='disabled'>
|
||||||
|
{dataFormatter.booleanFormatter(item.disabled)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{!organizations?.payments_organizations?.length && (
|
{!organizations?.users_organizations?.length && (
|
||||||
<div className={'text-center py-4'}>No data</div>
|
|
||||||
)}
|
|
||||||
</CardBox>
|
|
||||||
</>
|
|
||||||
|
|
||||||
<>
|
|
||||||
<p className={'block font-bold mb-2'}>Reports organizations</p>
|
|
||||||
<CardBox
|
|
||||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
|
||||||
hasTable
|
|
||||||
>
|
|
||||||
<div className='overflow-x-auto'>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Title</th>
|
|
||||||
|
|
||||||
<th>GeneratedAt</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{organizations.reports_organizations &&
|
|
||||||
Array.isArray(organizations.reports_organizations) &&
|
|
||||||
organizations.reports_organizations.map((item: any) => (
|
|
||||||
<tr
|
|
||||||
key={item.id}
|
|
||||||
onClick={() =>
|
|
||||||
router.push(`/reports/reports-view/?id=${item.id}`)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<td data-label='title'>{item.title}</td>
|
|
||||||
|
|
||||||
<td data-label='generated_at'>
|
|
||||||
{dataFormatter.dateTimeFormatter(item.generated_at)}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
{!organizations?.reports_organizations?.length && (
|
|
||||||
<div className={'text-center py-4'}>No data</div>
|
<div className={'text-center py-4'}>No data</div>
|
||||||
)}
|
)}
|
||||||
</CardBox>
|
</CardBox>
|
||||||
|
|||||||
@ -4,15 +4,15 @@ import mainReducer from './mainSlice';
|
|||||||
import authSlice from './authSlice';
|
import authSlice from './authSlice';
|
||||||
import openAiSlice from './openAiSlice';
|
import openAiSlice from './openAiSlice';
|
||||||
|
|
||||||
import usersSlice from './users/usersSlice';
|
|
||||||
import categoriesSlice from './categories/categoriesSlice';
|
import categoriesSlice from './categories/categoriesSlice';
|
||||||
import customersSlice from './customers/customersSlice';
|
|
||||||
import furniture_typesSlice from './furniture_types/furniture_typesSlice';
|
|
||||||
import ordersSlice from './orders/ordersSlice';
|
|
||||||
import rolesSlice from './roles/rolesSlice';
|
|
||||||
import paymentsSlice from './payments/paymentsSlice';
|
import paymentsSlice from './payments/paymentsSlice';
|
||||||
|
import furniture_typesSlice from './furniture_types/furniture_typesSlice';
|
||||||
import reportsSlice from './reports/reportsSlice';
|
import reportsSlice from './reports/reportsSlice';
|
||||||
import permissionsSlice from './permissions/permissionsSlice';
|
import permissionsSlice from './permissions/permissionsSlice';
|
||||||
|
import customersSlice from './customers/customersSlice';
|
||||||
|
import ordersSlice from './orders/ordersSlice';
|
||||||
|
import usersSlice from './users/usersSlice';
|
||||||
|
import rolesSlice from './roles/rolesSlice';
|
||||||
import organizationsSlice from './organizations/organizationsSlice';
|
import organizationsSlice from './organizations/organizationsSlice';
|
||||||
|
|
||||||
export const store = configureStore({
|
export const store = configureStore({
|
||||||
@ -22,15 +22,15 @@ export const store = configureStore({
|
|||||||
auth: authSlice,
|
auth: authSlice,
|
||||||
openAi: openAiSlice,
|
openAi: openAiSlice,
|
||||||
|
|
||||||
users: usersSlice,
|
|
||||||
categories: categoriesSlice,
|
categories: categoriesSlice,
|
||||||
customers: customersSlice,
|
|
||||||
furniture_types: furniture_typesSlice,
|
|
||||||
orders: ordersSlice,
|
|
||||||
roles: rolesSlice,
|
|
||||||
payments: paymentsSlice,
|
payments: paymentsSlice,
|
||||||
|
furniture_types: furniture_typesSlice,
|
||||||
reports: reportsSlice,
|
reports: reportsSlice,
|
||||||
permissions: permissionsSlice,
|
permissions: permissionsSlice,
|
||||||
|
customers: customersSlice,
|
||||||
|
orders: ordersSlice,
|
||||||
|
users: usersSlice,
|
||||||
|
roles: rolesSlice,
|
||||||
organizations: organizationsSlice,
|
organizations: organizationsSlice,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user