@ozdao/prometheus-framework 0.2.137 → 0.2.139
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +29 -14
- package/dist/auth.server.mjs +29 -14
- package/dist/community.server.js +3 -3
- package/dist/community.server.mjs +3 -3
- package/dist/events.server.js +3 -3
- package/dist/events.server.mjs +3 -3
- package/dist/files.server.js +3 -3
- package/dist/files.server.mjs +3 -3
- package/dist/gallery.server.js +4 -4
- package/dist/gallery.server.mjs +4 -4
- package/dist/index-DNI4aUP2.js +259 -0
- package/dist/index-Tcyehi73.mjs +260 -0
- package/dist/main-DTHFR7H_.mjs +14510 -0
- package/dist/main-wXdocsbd.js +92 -0
- package/dist/main.css +1 -1
- package/dist/orders.server.js +9 -8
- package/dist/orders.server.mjs +9 -8
- package/dist/organizations.server.js +32 -17
- package/dist/organizations.server.mjs +32 -17
- package/dist/products.server.js +37 -5
- package/dist/products.server.mjs +37 -5
- package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
- package/dist/prometheus-framework/src/components/Completion/Completion.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Completion/Completion.vue.js +19 -19
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/components/Map/Map.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Map/Map.vue.js +3 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +32 -31
- package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/store/auth.js +50 -47
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.cjs +1 -1
- package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +12 -12
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +41 -38
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +123 -114
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +51 -52
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +16 -15
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +120 -60
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/invites.js +25 -24
- package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.js +7 -7
- package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.js +65 -66
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +81 -76
- package/dist/prometheus-framework/src/modules/spots/router/spots.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/router/spots.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +78 -74
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +2 -2
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +1 -1
- package/dist/reports.server.js +0 -3
- package/dist/reports.server.mjs +0 -3
- package/dist/spots.server.js +3 -3
- package/dist/spots.server.mjs +3 -3
- package/dist/style.css +1 -1
- package/dist/wallet.server.js +5 -5
- package/dist/wallet.server.mjs +8 -8
- package/dist/web-Dh669DqQ.mjs +54 -0
- package/dist/web-Dt2RCU54.js +1 -0
- package/package.json +1 -1
- package/src/components/Completion/Completion.vue +29 -30
- package/src/components/Map/Map.vue +2 -2
- package/src/modules/auth/components/pages/Invite.vue +4 -2
- package/src/modules/auth/controllers/auth.controller.js +30 -12
- package/src/modules/auth/middlewares/authJwt.js +80 -0
- package/src/modules/{middlewares/server → auth/middlewares}/index.js +1 -3
- package/src/modules/{middlewares/server → auth/middlewares}/verifyAccesses.js +1 -1
- package/src/modules/auth/routes/auth.routes.js +2 -2
- package/src/modules/auth/routes/twofa.routes.js +1 -1
- package/src/modules/auth/store/auth.js +9 -0
- package/src/modules/chats/routes/chats.routes.js +1 -1
- package/src/modules/community/routes/blog.routes.js +2 -2
- package/src/modules/events/routes/events.routes.js +2 -2
- package/src/modules/files/routes/files.routes.js +2 -2
- package/src/modules/gallery/routes/gallery.routes.js +4 -5
- package/src/modules/globals/services/globals.crud.js +2 -2
- package/src/modules/marketplace/store/marketplace.js +1 -1
- package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +2 -2
- package/src/modules/orders/components/sections/FormAddCustomer.vue +2 -2
- package/src/modules/orders/controllers/orders.controller.js +1 -0
- package/src/modules/orders/routes/applications.routes.js +2 -2
- package/src/modules/orders/routes/orders.routes.js +2 -2
- package/src/modules/organizations/components/blocks/CardOrganization.vue +9 -7
- package/src/modules/organizations/components/pages/Members.vue +26 -15
- package/src/modules/organizations/components/pages/Organization.vue +3 -3
- package/src/modules/organizations/components/sections/DetailsTab.vue +1 -1
- package/src/modules/organizations/components/sections/MembersAdd.vue +101 -43
- package/src/modules/organizations/controllers/invites.controller.js +18 -13
- package/src/modules/organizations/controllers/memberships.controller.js +18 -11
- package/src/modules/organizations/controllers/organizations.controller.js +3 -4
- package/src/modules/organizations/models/membership.model.js +2 -0
- package/src/modules/organizations/models/organization.model.js +4 -0
- package/src/modules/organizations/routes/invites.routes.js +2 -2
- package/src/modules/organizations/store/invites.js +2 -1
- package/src/modules/products/controllers/leftovers.controller.js +1 -1
- package/src/modules/products/middlewares/index.js +11 -0
- package/src/modules/products/routes/categories.routes.js +2 -2
- package/src/modules/reports/routes/reports.routes.js +2 -2
- package/src/modules/spots/components/blocks/CardSpot.vue +0 -1
- package/src/modules/spots/components/layouts/Spots.vue +2 -2
- package/src/modules/spots/components/pages/Map.vue +79 -78
- package/src/modules/spots/components/pages/SpotEdit.vue +8 -5
- package/src/modules/spots/controllers/spots.controller.js +1 -5
- package/src/modules/spots/router/spots.js +1 -1
- package/src/modules/users/components/pages/ProfileEdit.vue +37 -22
- package/src/modules/wallet/controllers/routes/payments.routes.js +2 -2
- package/src/modules/wallet/controllers/routes/rewards.routes.js +2 -2
- package/src/modules/middlewares/server/authJwt.js +0 -68
- /package/src/modules/{middlewares/server → auth/middlewares}/authSecret.js +0 -0
- /package/src/modules/{middlewares/server → auth/middlewares}/verifyInvites.js +0 -0
- /package/src/modules/{middlewares/server → auth/middlewares}/verifySignUp.js +0 -0
- /package/src/modules/{middlewares/server → auth/middlewares}/verifyUser.js +0 -0
- /package/src/modules/globals/services/{globals.cashe.js → globals.cache.js} +0 -0
- /package/src/modules/{middlewares/server → products/middlewares}/verifyCategory.js +0 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
const jwt = require("jsonwebtoken");
|
2
|
+
|
3
|
+
const middlewareFactory = (db) => {
|
4
|
+
const User = db.user;
|
5
|
+
const Role = db.role;
|
6
|
+
|
7
|
+
const verifyToken = (continueOnFail = false) => {
|
8
|
+
return async (req, res, next) => {
|
9
|
+
try {
|
10
|
+
if (!req.cookies.user) {
|
11
|
+
req.userId = null;
|
12
|
+
if (continueOnFail) {
|
13
|
+
return next();
|
14
|
+
} else {
|
15
|
+
return res.status(401).send({ message: "Unauthorized: No user cookie" });
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
let user = JSON.parse(req.cookies.user);
|
20
|
+
let token = req.headers["x-access-token"] || user.accessToken;
|
21
|
+
|
22
|
+
if (!token) {
|
23
|
+
req.userId = null;
|
24
|
+
if (continueOnFail) {
|
25
|
+
return next();
|
26
|
+
} else {
|
27
|
+
return res.status(401).send({ message: "Unauthorized: No token provided" });
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
const decoded = jwt.verify(token, process.env.SECRET_KEY);
|
32
|
+
req.userId = decoded._id;
|
33
|
+
|
34
|
+
next();
|
35
|
+
} catch (err) {
|
36
|
+
console.log(err);
|
37
|
+
req.userId = null;
|
38
|
+
if (continueOnFail) {
|
39
|
+
next();
|
40
|
+
} else {
|
41
|
+
res.status(401).send({ message: "Unauthorized: Invalid token" });
|
42
|
+
}
|
43
|
+
}
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
const checkRole = roleToCheck => async (req, res, next) => {
|
48
|
+
try {
|
49
|
+
const user = await User.findById(req.userId).exec();
|
50
|
+
|
51
|
+
if (!user) {
|
52
|
+
return res.status(404).send({ message: "User Not found." });
|
53
|
+
}
|
54
|
+
|
55
|
+
const roles = await Role.find({ _id: { $in: user.roles }}).exec();
|
56
|
+
|
57
|
+
for (let role of roles) {
|
58
|
+
if (role.name === roleToCheck) {
|
59
|
+
next();
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
res.status(403).send({ message: `Require ${roleToCheck} Role!` });
|
65
|
+
} catch (err) {
|
66
|
+
res.status(500).send({ message: err.message });
|
67
|
+
}
|
68
|
+
};
|
69
|
+
|
70
|
+
const isAdmin = checkRole("admin");
|
71
|
+
const isModerator = checkRole("moderator");
|
72
|
+
|
73
|
+
return {
|
74
|
+
verifyToken,
|
75
|
+
isAdmin,
|
76
|
+
isModerator
|
77
|
+
};
|
78
|
+
};
|
79
|
+
|
80
|
+
module.exports = middlewareFactory;
|
@@ -6,15 +6,13 @@ const middlewareIndexFactory = (db) => {
|
|
6
6
|
const verifySignUp = require("./verifySignUp")(db);
|
7
7
|
const verifyUser = require("./verifyUser")(db);
|
8
8
|
const verifyInvites = require("./verifyInvites")(db);
|
9
|
-
const verifyCategory = require("./verifyCategory")(db);
|
10
9
|
|
11
10
|
return {
|
12
11
|
authJwt,
|
13
12
|
authSecret,
|
14
13
|
verifySignUp,
|
15
14
|
verifyUser,
|
16
|
-
verifyInvites
|
17
|
-
verifyCategory
|
15
|
+
verifyInvites
|
18
16
|
};
|
19
17
|
};
|
20
18
|
|
@@ -38,7 +38,6 @@ const middlewareFactory = (db) => {
|
|
38
38
|
// Если пользователь не является членом организации, ограничиваем доступ к опубликованным ресурсам
|
39
39
|
req.query.status = 'published';
|
40
40
|
} else {
|
41
|
-
// Пользователь является членом организации, проверяем его права доступа
|
42
41
|
|
43
42
|
// Находим все департаменты данной организации, к которым относится пользователь
|
44
43
|
const departments = await Department.find({ organization: ownerOrgId });
|
@@ -48,6 +47,7 @@ const middlewareFactory = (db) => {
|
|
48
47
|
|
49
48
|
for (const department of departments) {
|
50
49
|
const accessRights = department.accesses[resource];
|
50
|
+
|
51
51
|
if (accessRights && accessRights.read) {
|
52
52
|
// Если хотя бы в одном департаменте есть права на чтение ресурса, разрешаем доступ
|
53
53
|
hasAccess = true;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
const controllerFactory = require("../controllers/auth.controller");
|
3
3
|
const controllerFactoryTwofa = require("../controllers/twofa.controller");
|
4
4
|
// Middlewares
|
5
|
-
const middlewareFactory = require('@pf/src/modules/middlewares
|
5
|
+
const middlewareFactory = require('@pf/src/modules/auth/middlewares');
|
6
6
|
// Routes
|
7
7
|
module.exports = function(app, db, origins) {
|
8
8
|
const controller = controllerFactory(db);
|
@@ -40,7 +40,7 @@ module.exports = function(app, db, origins) {
|
|
40
40
|
app.get(
|
41
41
|
"/api/auth/check-accesses",
|
42
42
|
[
|
43
|
-
authJwt.verifyToken,
|
43
|
+
authJwt.verifyToken(true),
|
44
44
|
],
|
45
45
|
controller.checkAccesses
|
46
46
|
);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require("../controllers/twofa.controller");
|
3
3
|
// Middlewares
|
4
|
-
const middlewareFactory = require('@pf/src/modules/middlewares
|
4
|
+
const middlewareFactory = require('@pf/src/modules/auth/middlewares');
|
5
5
|
// Routes
|
6
6
|
module.exports = function(app, db) {
|
7
7
|
const controller = controllerFactory(db);
|
@@ -85,6 +85,8 @@
|
|
85
85
|
roles: response.data.roles
|
86
86
|
});
|
87
87
|
|
88
|
+
await initialize();
|
89
|
+
|
88
90
|
return response.data;
|
89
91
|
} catch (error) {
|
90
92
|
|
@@ -141,6 +143,8 @@
|
|
141
143
|
roles: response.data.roles
|
142
144
|
});
|
143
145
|
|
146
|
+
await initialize();
|
147
|
+
|
144
148
|
return response.data;
|
145
149
|
} catch (error) {
|
146
150
|
setError(error);
|
@@ -153,6 +157,8 @@
|
|
153
157
|
removeCookie('user');
|
154
158
|
|
155
159
|
Object.assign(state.user, {
|
160
|
+
_id: undefined,
|
161
|
+
username: '',
|
156
162
|
email: '',
|
157
163
|
phone: '',
|
158
164
|
password: '',
|
@@ -160,9 +166,12 @@
|
|
160
166
|
});
|
161
167
|
|
162
168
|
Object.assign(state.access, {
|
169
|
+
roles: null,
|
163
170
|
token: null,
|
164
171
|
status: false
|
165
172
|
});
|
173
|
+
|
174
|
+
state.accesses = []
|
166
175
|
},
|
167
176
|
|
168
177
|
async resetPassword(user, type) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require('../controllers/chats.controller.js');
|
3
3
|
// Middlewares
|
4
|
-
const middlewareFactory = require('@pf/src/modules/middlewares
|
4
|
+
const middlewareFactory = require('@pf/src/modules/auth/middlewares');
|
5
5
|
// Routes
|
6
6
|
module.exports = function(app, db, wss) {
|
7
7
|
const controller = controllerFactory(db);
|
@@ -1,12 +1,12 @@
|
|
1
1
|
const controllerFactory = require("../controllers/blog.controller");
|
2
2
|
|
3
|
-
const
|
3
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
4
4
|
const middlewareFactoryCommunity = require('../middlewares/server');
|
5
5
|
|
6
6
|
module.exports = function(app, db, origins) {
|
7
7
|
const controller = controllerFactory(db);
|
8
8
|
|
9
|
-
const { authJwt } =
|
9
|
+
const { authJwt } = middlewareFactoryAuth(db);
|
10
10
|
const { verifyBlogpost } = middlewareFactoryCommunity(db);
|
11
11
|
|
12
12
|
app.get(
|
@@ -1,13 +1,13 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require("../controllers/events.controller");
|
3
3
|
// Middlewares
|
4
|
-
const
|
4
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
5
5
|
const middlewareFactoryEvents = require('../middlewares/server');
|
6
6
|
// Routes
|
7
7
|
module.exports = function(app, db, origins) {
|
8
8
|
const controller = controllerFactory(db);
|
9
9
|
|
10
|
-
const { authJwt } =
|
10
|
+
const { authJwt } = middlewareFactoryAuth(db);
|
11
11
|
const { verifyEvent } = middlewareFactoryEvents(db);
|
12
12
|
|
13
13
|
app.get(
|
@@ -1,13 +1,13 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require("../controllers/files.controller");
|
3
3
|
// Middlewares
|
4
|
-
const
|
4
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
5
5
|
const middlewareFactoryFiles = require('../middlewares/server');
|
6
6
|
|
7
7
|
module.exports = function(app, db, origins, publicPath) {
|
8
8
|
const controller = controllerFactory(db, publicPath);
|
9
9
|
|
10
|
-
const { authJwt } =
|
10
|
+
const { authJwt } = middlewareFactoryAuth(db);
|
11
11
|
const { middlewareBusboy } = middlewareFactoryFiles(db, publicPath);
|
12
12
|
|
13
13
|
app.post(
|
@@ -1,20 +1,19 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require("../controllers/gallery.controller");
|
3
3
|
// Middlewares
|
4
|
-
const
|
5
|
-
const middlewareFactoryAccesses = require('@pf/src/modules/middlewares/
|
4
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
5
|
+
const middlewareFactoryAccesses = require('@pf/src/modules/auth/middlewares/verifyAccesses')
|
6
6
|
|
7
7
|
module.exports = function(app, db, origins) {
|
8
8
|
const controller = controllerFactory(db);
|
9
9
|
|
10
|
-
const { authJwt } =
|
10
|
+
const { authJwt } = middlewareFactoryAuth(db);
|
11
11
|
const { verifyRead } = middlewareFactoryAccesses(db)
|
12
12
|
|
13
|
-
|
14
13
|
app.get(
|
15
14
|
"/api/gallery/read",
|
16
15
|
[
|
17
|
-
authJwt.verifyToken,
|
16
|
+
authJwt.verifyToken(true),
|
18
17
|
verifyRead('gallery'),
|
19
18
|
],
|
20
19
|
controller.read
|
@@ -1,12 +1,12 @@
|
|
1
1
|
const globalsQuery = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
|
2
2
|
|
3
|
-
const
|
3
|
+
const Cache = require('@pf/src/modules/globals/services/globals.cache');
|
4
4
|
const Logger = require('@pf/src/modules/globals/services/globals.logger');
|
5
5
|
|
6
6
|
class CRUD {
|
7
7
|
constructor(basePath, app, db, model) {
|
8
8
|
this.model = model;
|
9
|
-
this.cache = new
|
9
|
+
this.cache = new Cache();
|
10
10
|
this.logger = new Logger(db);
|
11
11
|
|
12
12
|
this.app = app;
|
@@ -117,7 +117,7 @@
|
|
117
117
|
@click="() => {
|
118
118
|
orders.mutations.resetCustomer(orders.state.current.customer)
|
119
119
|
}"
|
120
|
-
class="bg-white pd-thin radius-medium w-100 mn-b-thin"
|
120
|
+
class="bg-white pd-thin h-4r radius-medium w-100 mn-b-thin"
|
121
121
|
/>
|
122
122
|
<Feed
|
123
123
|
v-else
|
@@ -152,7 +152,7 @@
|
|
152
152
|
@click="() => {
|
153
153
|
orders.state.current.customer = user
|
154
154
|
}"
|
155
|
-
class="bg-white pd-thin radius-medium w-100 mn-b-thin"
|
155
|
+
class="bg-white pd-thin h-4r radius-medium w-100 mn-b-thin"
|
156
156
|
/>
|
157
157
|
</Feed>
|
158
158
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
@click="() => {
|
16
16
|
dataCustomer.user = null
|
17
17
|
}"
|
18
|
-
class="bg-white pd-thin radius-medium w-100"
|
18
|
+
class="bg-white h-2r pd-thin radius-medium w-100"
|
19
19
|
/>
|
20
20
|
|
21
21
|
<div
|
@@ -54,7 +54,7 @@
|
|
54
54
|
dataCustomer.email = user.email
|
55
55
|
dataCustomer.socials = user.socials
|
56
56
|
}"
|
57
|
-
class="bg-white pd-thin radius-medium w-100 mn-b-thin"
|
57
|
+
class="bg-white h-2r pd-thin radius-medium w-100 mn-b-thin"
|
58
58
|
/>
|
59
59
|
</Feed>
|
60
60
|
</div>
|
@@ -76,6 +76,7 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
|
|
76
76
|
const controllerFactory = (db) => {
|
77
77
|
const Order = db.order;
|
78
78
|
const Customer = db.customer;
|
79
|
+
const Leftover = db.leftover;
|
79
80
|
|
80
81
|
// Создание заказа
|
81
82
|
const create = async (req, res) => {
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require("../controllers/applications.controller");
|
3
3
|
// Middlewares
|
4
|
-
const
|
4
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
5
5
|
module.exports = function(app, db, origins) {
|
6
6
|
const controller = controllerFactory(db);
|
7
7
|
|
8
|
-
const { authJwt } =
|
8
|
+
const { authJwt } = middlewareFactoryAuth(db);
|
9
9
|
|
10
10
|
app.post(
|
11
11
|
"/applications",
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require("../controllers/orders.controller");
|
3
3
|
// Middlewares
|
4
|
-
const
|
4
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
5
5
|
// Routes
|
6
6
|
module.exports = function(app, db, origins, publicPath) {
|
7
7
|
const controller = controllerFactory(db);
|
8
|
-
const middleware =
|
8
|
+
const middleware = middlewareFactoryAuth(db);
|
9
9
|
|
10
10
|
app.post(
|
11
11
|
"/api/orders/create",
|
@@ -69,14 +69,16 @@
|
|
69
69
|
<IconTime class="i-medium mn-r-micro"/>
|
70
70
|
<span class="mn-r-thin">{{
|
71
71
|
organization.distance ?
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
organization.distance > 50 ?
|
73
|
+
'3-5 days' :
|
74
|
+
Math.ceil((5 + 5 + 3 * organization.distance) / 5) * 5
|
75
|
+
+ '-'
|
76
|
+
+ Math.ceil((15 + 5 + 3 * organization.distance) / 5) * 5
|
77
|
+
+ ' MIN' : 'Unavailable'
|
76
78
|
}}
|
77
79
|
</span>
|
78
|
-
<span v-if="organization.distance" class="t-transp mn-r-thin">|</span>
|
79
|
-
<span class="mn-r-thin">{{organization.distance ? organization.distance.toFixed(1) + ' KM' : ''}} </span>
|
80
|
+
<span v-if="organization.distance && organization.distance < 50" class="t-transp mn-r-thin">|</span>
|
81
|
+
<span v-if="organization.distance && organization.distance < 50" class="mn-r-thin">{{organization.distance ? organization.distance.toFixed(1) + ' KM' : ''}} </span>
|
80
82
|
<!-- <span class="mn-r-thin">{{organization.nearestSpotDistance}}</span> -->
|
81
83
|
<IconPrice class="i-medium mn-r-micro"/>
|
82
84
|
<span class="mn-r-thin">{{returnCurrency()}}500 </span>
|
@@ -88,7 +90,7 @@
|
|
88
90
|
<div class="w-max flex-nowrap flex gap-thin">
|
89
91
|
<CardOrderItem
|
90
92
|
@click.stop="$router.push({name: 'Product Organization', params: {_id: organization._id, product: product._id}})"
|
91
|
-
v-for="product in organization.products.slice(0,
|
93
|
+
v-for="product in organization.products.slice(0,5)"
|
92
94
|
:key="product._id"
|
93
95
|
:editable="false"
|
94
96
|
:product="product"
|
@@ -120,7 +120,7 @@
|
|
120
120
|
v-if="tab === 'invites'"
|
121
121
|
>
|
122
122
|
<Feed
|
123
|
-
:
|
123
|
+
v-model:items="invitesState"
|
124
124
|
:states="{
|
125
125
|
empty: {
|
126
126
|
title: 'No Invites Found',
|
@@ -183,6 +183,7 @@ import CardDepartment from '@pf/src/modules/organizations/components/blocks/Card
|
|
183
183
|
import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue'
|
184
184
|
|
185
185
|
import * as auth from '@pf/src/modules/auth/store/auth'
|
186
|
+
import * as globals from '@pf/src/modules/globals/store/globals'
|
186
187
|
import * as invites from '@pf/src/modules/organizations/store/invites';
|
187
188
|
import * as memberships from '@pf/src/modules/organizations/store/memberships';
|
188
189
|
import * as organization from '@pf/src/modules/organizations/store/organizations'
|
@@ -194,6 +195,8 @@ const organizationData = ref(null)
|
|
194
195
|
|
195
196
|
// Tab logic
|
196
197
|
const tab = ref('members')
|
198
|
+
// States
|
199
|
+
const invitesState = ref([])
|
197
200
|
// Popup
|
198
201
|
const isOpenMembersAddPopup = ref(false);
|
199
202
|
|
@@ -222,19 +225,27 @@ const FirstLevelDepartments = computed(() => {
|
|
222
225
|
);
|
223
226
|
});
|
224
227
|
|
225
|
-
async function handleSendInvite(list) {
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
228
|
+
async function handleSendInvite(list, resolve, reject) {
|
229
|
+
try {
|
230
|
+
const response = await invites.actions.create({
|
231
|
+
owner: {
|
232
|
+
type: 'Organization',
|
233
|
+
target: organizationData.value._id
|
234
|
+
},
|
235
|
+
creator: {
|
236
|
+
type: 'User',
|
237
|
+
target: auth.state.user._id
|
238
|
+
},
|
239
|
+
invites: list,
|
240
|
+
});
|
241
|
+
for (let invite of response.createdInvites) {
|
242
|
+
globals.actions.add(invitesState.value, invite)
|
243
|
+
}
|
244
|
+
closeMembersAddPopup();
|
245
|
+
resolve(); // Вызываем resolve, когда все операции завершены успешно
|
246
|
+
} catch (error) {
|
247
|
+
reject(error); // Вызываем reject, если произошла ошибка
|
248
|
+
}
|
238
249
|
}
|
239
250
|
|
240
251
|
async function removeMember(index,member) {
|
@@ -246,7 +257,7 @@ async function removeMember(index,member) {
|
|
246
257
|
|
247
258
|
async function removeInvite(index,invite) {
|
248
259
|
if (confirm("Confirm remove of member") == true) {
|
249
|
-
|
260
|
+
globals.actions.delete(invitesState.value, invite)
|
250
261
|
await invites.actions.delete(invite._id);
|
251
262
|
}
|
252
263
|
}
|
@@ -220,9 +220,9 @@
|
|
220
220
|
|
221
221
|
route.query.tab = tabOrganization.value
|
222
222
|
|
223
|
-
watch(tabOrganization, (newValue) => {
|
224
|
-
|
225
|
-
});
|
223
|
+
// watch(tabOrganization, (newValue) => {
|
224
|
+
// router.replace({ query: null});
|
225
|
+
// });
|
226
226
|
</script>
|
227
227
|
|
228
228
|
<style lang="scss">
|