not-locale 0.0.22 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-locale",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "not-* family module for localization in not- environment",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -37,4 +37,4 @@
37
37
  "mocha": "*",
38
38
  "nyc": "*"
39
39
  }
40
- }
40
+ }
@@ -12,7 +12,7 @@ const manifest = {
12
12
  sections:[
13
13
  {
14
14
  id: 'locale',
15
- title: '',
15
+ title: '',
16
16
  icon: {
17
17
  font: 'language',
18
18
  size: 'medium',
@@ -90,7 +90,7 @@ class nsLocale {
90
90
  id: `${SECTION_ID}.${item}`,
91
91
  section: SECTION_ID,
92
92
  title: item,
93
- classes: " is-clickable ",
93
+ class: " is-clickable ",
94
94
  action: this.changeLocale.bind(this, item),
95
95
  };
96
96
  }
@@ -3,6 +3,7 @@ const {
3
3
  LocaleExceptionGetError,
4
4
  LocaleExceptionAvailableError,
5
5
  } = require("../exceptions");
6
+
6
7
  const MODEL_NAME = "Locale";
7
8
  exports.thisLogicName = MODEL_NAME;
8
9
 
@@ -1,55 +1,58 @@
1
- const Log = require('not-log')(module, 'locale:route');
2
- const {notError} = require('not-error');
3
- const notNode = require('not-node');
1
+ const Log = require("not-log")(module, "locale:route");
2
+ const { notError } = require("not-error");
3
+ const notNode = require("not-node");
4
4
 
5
- async function get(req, res){
6
- try{
7
- let locale = req.params.locale;
8
- let result = await notNode.Application.getLogic('Locale').get({locale});
9
- res.status(200).json(result);
10
- }catch(err){
11
- Log.error(err);
12
- notNode.Application.report(
13
- new notError(
14
- `locale:route.get`, {
15
- locale: req.query.locale,
16
- owner: req.user?req.user._id:undefined,
17
- ownerModel: 'User'
18
- },
19
- err
20
- )
21
- );
22
- res.status(500).json({
23
- status: 'error'
24
- });
25
- }
5
+ async function get(req, res) {
6
+ try {
7
+ let locale = req.params.locale;
8
+ let result = await notNode.Application.getLogic("Locale").get({
9
+ locale,
10
+ });
11
+ res.status(200).json(result);
12
+ } catch (err) {
13
+ Log.error(err);
14
+ notNode.Application.report(
15
+ new notError(
16
+ `locale:route.get`,
17
+ {
18
+ locale: req.query.locale,
19
+ owner: req.user ? req.user._id : undefined,
20
+ ownerModel: "User",
21
+ },
22
+ err
23
+ )
24
+ );
25
+ res.status(500).json({
26
+ status: "error",
27
+ });
28
+ }
26
29
  }
27
30
 
28
- async function available(req, res){
29
- try{
30
- let result = await notNode.Application.getLogic('Locale').available();
31
- res.status(200).json(result);
32
- }catch(err){
33
- Log.error(err);
34
- notNode.Application.report(
35
- new notError(
36
- `locale:route.available`, {
37
- owner: req.user?req.user._id:undefined,
38
- ownerModel: 'User'
39
- },
40
- err
41
- )
42
- );
43
- res.status(500).json({
44
- status: 'error'
45
- });
46
- }
31
+ async function available(req, res) {
32
+ try {
33
+ let result = await notNode.Application.getLogic("Locale").available();
34
+ res.status(200).json(result);
35
+ } catch (err) {
36
+ Log.error(err);
37
+ notNode.Application.report(
38
+ new notError(
39
+ `locale:route.available`,
40
+ {
41
+ owner: req.user ? req.user._id : undefined,
42
+ ownerModel: "User",
43
+ },
44
+ err
45
+ )
46
+ );
47
+ res.status(500).json({
48
+ status: "error",
49
+ });
50
+ }
47
51
  }
48
52
 
49
-
50
53
  module.exports = {
51
- get,
52
- _get: get,
53
- available,
54
- _available: available,
54
+ get,
55
+ _get: get,
56
+ available,
57
+ _available: available,
55
58
  };
@@ -1,37 +1,43 @@
1
- const {error} = require('not-log')(module, 'locale:route');
1
+ const { error } = require("not-log")(module, "locale:route");
2
2
 
3
3
  try {
4
- module.exports = {
5
- model: 'locale',
6
- url: '/api/:modelName',
7
- fields: {},
8
- actions: {
9
- get: {
10
- ws: true,
11
- method: 'GET',
12
- isArray: false,
13
- postFix: '/:actionName',
14
- data: ['record'],
15
- rules: [{
16
- auth: true
17
- }, {
18
- auth: false
19
- }]
20
- },
21
- available:{
22
- ws: true,
23
- method: 'GET',
24
- isArray: false,
25
- postFix: '/:actionName',
26
- data: ['record'],
27
- rules: [{
28
- auth: true
29
- },{
30
- auth: false
31
- }]
32
- }
33
- }
34
- };
4
+ module.exports = {
5
+ model: "locale",
6
+ url: "/api/:modelName",
7
+ fields: {},
8
+ actions: {
9
+ get: {
10
+ ws: true,
11
+ method: "GET",
12
+ isArray: false,
13
+ postFix: "/:actionName",
14
+ data: ["record"],
15
+ rules: [
16
+ {
17
+ auth: true,
18
+ },
19
+ {
20
+ auth: false,
21
+ },
22
+ ],
23
+ },
24
+ available: {
25
+ ws: true,
26
+ method: "GET",
27
+ isArray: false,
28
+ postFix: "/:actionName",
29
+ data: ["record"],
30
+ rules: [
31
+ {
32
+ auth: true,
33
+ },
34
+ {
35
+ auth: false,
36
+ },
37
+ ],
38
+ },
39
+ },
40
+ };
35
41
  } catch (e) {
36
- error(e);
42
+ error(e);
37
43
  }