mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
Code formatting with prettier, change eslint config for the server
This commit is contained in:
parent
bc87c1d883
commit
7a3805e64c
191 changed files with 4321 additions and 2880 deletions
1
client/.env
Normal file
1
client/.env
Normal file
|
@ -0,0 +1 @@
|
|||
SKIP_PREFLIGHT_CHECK=true
|
732
client/package-lock.json
generated
732
client/package-lock.json
generated
|
@ -1696,9 +1696,10 @@
|
|||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
|
||||
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ=="
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz",
|
||||
"integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-globals": {
|
||||
"version": "4.3.4",
|
||||
|
@ -1717,9 +1718,9 @@
|
|||
}
|
||||
},
|
||||
"acorn-jsx": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.2.tgz",
|
||||
"integrity": "sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw=="
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz",
|
||||
"integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw=="
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "6.2.0",
|
||||
|
@ -2503,6 +2504,12 @@
|
|||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
|
||||
},
|
||||
"boolify": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/boolify/-/boolify-1.0.1.tgz",
|
||||
"integrity": "sha1-tcCeF8rNET0Rt7s+04TMASmU2Gs=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
|
@ -2772,6 +2779,17 @@
|
|||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
|
||||
},
|
||||
"camelcase-keys": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.1.0.tgz",
|
||||
"integrity": "sha512-43tBGDIs3SBDA5R5mYzkiBP3lt2IKhLDp1wVGS9XTq6SR3+7ZNdi/VwBJsk4NKgySoaziTrKM+N8hhT04NBVUA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camelcase": "^5.3.1",
|
||||
"map-obj": "^4.0.0",
|
||||
"quick-lru": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"caniuse-api": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz",
|
||||
|
@ -4413,6 +4431,12 @@
|
|||
"path-type": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"dlv": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
|
||||
"integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==",
|
||||
"dev": true
|
||||
},
|
||||
"dns-equal": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz",
|
||||
|
@ -4796,61 +4820,73 @@
|
|||
}
|
||||
},
|
||||
"eslint": {
|
||||
"version": "6.5.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.5.1.tgz",
|
||||
"integrity": "sha512-32h99BoLYStT1iq1v2P9uwpyznQ4M2jRiFB6acitKz52Gqn+vPaMDUTB1bYi1WN4Nquj2w+t+bimYUG83DC55A==",
|
||||
"version": "5.16.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz",
|
||||
"integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"ajv": "^6.10.0",
|
||||
"ajv": "^6.9.1",
|
||||
"chalk": "^2.1.0",
|
||||
"cross-spawn": "^6.0.5",
|
||||
"debug": "^4.0.1",
|
||||
"doctrine": "^3.0.0",
|
||||
"eslint-scope": "^5.0.0",
|
||||
"eslint-utils": "^1.4.2",
|
||||
"eslint-visitor-keys": "^1.1.0",
|
||||
"espree": "^6.1.1",
|
||||
"eslint-scope": "^4.0.3",
|
||||
"eslint-utils": "^1.3.1",
|
||||
"eslint-visitor-keys": "^1.0.0",
|
||||
"espree": "^5.0.1",
|
||||
"esquery": "^1.0.1",
|
||||
"esutils": "^2.0.2",
|
||||
"file-entry-cache": "^5.0.1",
|
||||
"functional-red-black-tree": "^1.0.1",
|
||||
"glob-parent": "^5.0.0",
|
||||
"glob": "^7.1.2",
|
||||
"globals": "^11.7.0",
|
||||
"ignore": "^4.0.6",
|
||||
"import-fresh": "^3.0.0",
|
||||
"imurmurhash": "^0.1.4",
|
||||
"inquirer": "^6.4.1",
|
||||
"is-glob": "^4.0.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"inquirer": "^6.2.2",
|
||||
"js-yaml": "^3.13.0",
|
||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||
"levn": "^0.3.0",
|
||||
"lodash": "^4.17.14",
|
||||
"lodash": "^4.17.11",
|
||||
"minimatch": "^3.0.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"natural-compare": "^1.4.0",
|
||||
"optionator": "^0.8.2",
|
||||
"path-is-inside": "^1.0.2",
|
||||
"progress": "^2.0.0",
|
||||
"regexpp": "^2.0.1",
|
||||
"semver": "^6.1.2",
|
||||
"strip-ansi": "^5.2.0",
|
||||
"strip-json-comments": "^3.0.1",
|
||||
"semver": "^5.5.1",
|
||||
"strip-ansi": "^4.0.0",
|
||||
"strip-json-comments": "^2.0.1",
|
||||
"table": "^5.2.3",
|
||||
"text-table": "^0.2.0",
|
||||
"v8-compile-cache": "^2.0.3"
|
||||
"text-table": "^0.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
|
||||
"integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esrecurse": "^4.1.0",
|
||||
"estraverse": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"import-fresh": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz",
|
||||
"integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"parent-module": "^1.0.0",
|
||||
"resolve-from": "^4.0.0"
|
||||
|
@ -4859,12 +4895,29 @@
|
|||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
},
|
||||
"resolve-from": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
|
||||
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"dev": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
||||
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -5171,25 +5224,27 @@
|
|||
}
|
||||
},
|
||||
"eslint-plugin-react": {
|
||||
"version": "7.14.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz",
|
||||
"integrity": "sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==",
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.16.0.tgz",
|
||||
"integrity": "sha512-GacBAATewhhptbK3/vTP09CbFrgUJmBSaaRcWdbQLFvUZy9yVcQxigBNHGPU/KE2AyHpzj3AWXpxoMTsIDiHug==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"array-includes": "^3.0.3",
|
||||
"doctrine": "^2.1.0",
|
||||
"has": "^1.0.3",
|
||||
"jsx-ast-utils": "^2.1.0",
|
||||
"jsx-ast-utils": "^2.2.1",
|
||||
"object.entries": "^1.1.0",
|
||||
"object.fromentries": "^2.0.0",
|
||||
"object.values": "^1.1.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"resolve": "^1.10.1"
|
||||
"resolve": "^1.12.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"doctrine": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
|
||||
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2"
|
||||
}
|
||||
|
@ -5224,13 +5279,14 @@
|
|||
"integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A=="
|
||||
},
|
||||
"espree": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-6.1.1.tgz",
|
||||
"integrity": "sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ==",
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz",
|
||||
"integrity": "sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"acorn": "^7.0.0",
|
||||
"acorn-jsx": "^5.0.2",
|
||||
"eslint-visitor-keys": "^1.1.0"
|
||||
"acorn": "^6.0.7",
|
||||
"acorn-jsx": "^5.0.0",
|
||||
"eslint-visitor-keys": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"esprima": {
|
||||
|
@ -5959,6 +6015,12 @@
|
|||
"resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz",
|
||||
"integrity": "sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg=="
|
||||
},
|
||||
"get-stdin": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz",
|
||||
"integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==",
|
||||
"dev": true
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
||||
|
@ -6099,9 +6161,9 @@
|
|||
"integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ=="
|
||||
},
|
||||
"handlebars": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.2.tgz",
|
||||
"integrity": "sha512-cIv17+GhL8pHHnRJzGu2wwcthL5sb8uDKBHvZ2Dtu5s1YNt0ljbzKbamnc+gr69y7bzwQiBdr5+hOpRd5pnOdg==",
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz",
|
||||
"integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==",
|
||||
"requires": {
|
||||
"neo-async": "^2.6.0",
|
||||
"optimist": "^0.6.1",
|
||||
|
@ -6601,6 +6663,12 @@
|
|||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
|
||||
},
|
||||
"indent-string": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
|
||||
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
|
||||
"dev": true
|
||||
},
|
||||
"indexes-of": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
|
||||
|
@ -6644,6 +6712,7 @@
|
|||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz",
|
||||
"integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-escapes": "^3.2.0",
|
||||
"chalk": "^2.4.2",
|
||||
|
@ -8385,6 +8454,12 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
||||
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4="
|
||||
},
|
||||
"lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.sortby": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
|
||||
|
@ -8422,6 +8497,58 @@
|
|||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.4.tgz",
|
||||
"integrity": "sha512-p0b6mOGKcGa+7nnmKbpzR6qloPbrgLcnio++E+14Vo/XffOGwZtRpUhr8dTH/x2oCMmEoIU0Zwm3ZauhvYD17g=="
|
||||
},
|
||||
"loglevel-colored-level-prefix": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/loglevel-colored-level-prefix/-/loglevel-colored-level-prefix-1.0.0.tgz",
|
||||
"integrity": "sha1-akAhj9x64V/HbD0PPmdsRlOIYD4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^1.1.3",
|
||||
"loglevel": "^1.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^2.2.1",
|
||||
"escape-string-regexp": "^1.0.2",
|
||||
"has-ansi": "^2.0.0",
|
||||
"strip-ansi": "^3.0.0",
|
||||
"supports-color": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"loose-envify": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||
|
@ -8464,6 +8591,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"make-plural": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/make-plural/-/make-plural-4.3.0.tgz",
|
||||
"integrity": "sha512-xTYd4JVHpSCW+aqDof6w/MebaMVNTVYBZhbB/vi513xXdiPT92JMVCo0Jq8W2UZnzYRFeVbQiQ+I25l13JuKvA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"makeerror": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",
|
||||
|
@ -8490,6 +8626,12 @@
|
|||
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
|
||||
"integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8="
|
||||
},
|
||||
"map-obj": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.1.0.tgz",
|
||||
"integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g==",
|
||||
"dev": true
|
||||
},
|
||||
"map-visit": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
|
||||
|
@ -8616,6 +8758,29 @@
|
|||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz",
|
||||
"integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw=="
|
||||
},
|
||||
"messageformat": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/messageformat/-/messageformat-2.3.0.tgz",
|
||||
"integrity": "sha512-uTzvsv0lTeQxYI2y1NPa1lItL5VRI8Gb93Y2K2ue5gBPyrbJxfDi/EYWxh2PKv5yO42AJeeqblS9MJSh/IEk4w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"make-plural": "^4.3.0",
|
||||
"messageformat-formatters": "^2.0.1",
|
||||
"messageformat-parser": "^4.1.2"
|
||||
}
|
||||
},
|
||||
"messageformat-formatters": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/messageformat-formatters/-/messageformat-formatters-2.0.1.tgz",
|
||||
"integrity": "sha512-E/lQRXhtHwGuiQjI7qxkLp8AHbMD5r2217XNe/SREbBlSawe0lOqsFb7rflZJmlQFSULNLIqlcjjsCPlB3m3Mg==",
|
||||
"dev": true
|
||||
},
|
||||
"messageformat-parser": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/messageformat-parser/-/messageformat-parser-4.1.2.tgz",
|
||||
"integrity": "sha512-7dWuifeyldz7vhEuL96Kwq1fhZXBW+TUfbnHN4UCrCxoXQTYjHnR78eI66Gk9LaLLsAvzPNVJBaa66DRfFNaiA==",
|
||||
"dev": true
|
||||
},
|
||||
"methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
|
@ -9184,14 +9349,14 @@
|
|||
}
|
||||
},
|
||||
"object.fromentries": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.0.tgz",
|
||||
"integrity": "sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.1.tgz",
|
||||
"integrity": "sha512-PUQv8Hbg3j2QX0IQYv3iAGCbGcu4yY4KQ92/dhA4sFSixBmSmp13UpDLs6jGK8rBtbmhNNIK99LD2k293jpiGA==",
|
||||
"requires": {
|
||||
"define-properties": "^1.1.2",
|
||||
"es-abstract": "^1.11.0",
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.15.0",
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.1"
|
||||
"has": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"object.getownpropertydescriptors": {
|
||||
|
@ -10562,6 +10727,179 @@
|
|||
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
|
||||
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.18.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
|
||||
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier-eslint": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prettier-eslint/-/prettier-eslint-9.0.0.tgz",
|
||||
"integrity": "sha512-0dael2aMpMAxAwClnLi2Coc30v3BubsTX6clqseZ8NFCJZnbZlwxZGHHESYBlqTyN9lvZDHHv+XdeHW0fKhxJQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/parser": "^1.10.2",
|
||||
"common-tags": "^1.4.0",
|
||||
"core-js": "^3.1.4",
|
||||
"dlv": "^1.1.0",
|
||||
"eslint": "^5.0.0",
|
||||
"indent-string": "^4.0.0",
|
||||
"lodash.merge": "^4.6.0",
|
||||
"loglevel-colored-level-prefix": "^1.0.0",
|
||||
"prettier": "^1.7.0",
|
||||
"pretty-format": "^23.0.1",
|
||||
"require-relative": "^0.8.7",
|
||||
"typescript": "^3.2.1",
|
||||
"vue-eslint-parser": "^2.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/experimental-utils": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz",
|
||||
"integrity": "sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/json-schema": "^7.0.3",
|
||||
"@typescript-eslint/typescript-estree": "1.13.0",
|
||||
"eslint-scope": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-1.13.0.tgz",
|
||||
"integrity": "sha512-ITMBs52PCPgLb2nGPoeT4iU3HdQZHcPaZVw+7CsFagRJHUhyeTgorEwHXhFf3e7Evzi8oujKNpHc8TONth8AdQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/eslint-visitor-keys": "^1.0.0",
|
||||
"@typescript-eslint/experimental-utils": "1.13.0",
|
||||
"@typescript-eslint/typescript-estree": "1.13.0",
|
||||
"eslint-visitor-keys": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/typescript-estree": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz",
|
||||
"integrity": "sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash.unescape": "4.0.1",
|
||||
"semver": "5.5.0"
|
||||
}
|
||||
},
|
||||
"core-js": {
|
||||
"version": "3.3.6",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.3.6.tgz",
|
||||
"integrity": "sha512-u4oM8SHwmDuh5mWZdDg9UwNVq5s1uqq6ZDLLIs07VY+VJU91i3h4f3K/pgFvtUQPGdeStrZ+odKyfyt4EnKHfA==",
|
||||
"dev": true
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
|
||||
"integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esrecurse": "^4.1.0",
|
||||
"estraverse": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"pretty-format": {
|
||||
"version": "23.6.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-23.6.0.tgz",
|
||||
"integrity": "sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^3.0.0",
|
||||
"ansi-styles": "^3.2.0"
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
|
||||
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"prettier-eslint-cli": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prettier-eslint-cli/-/prettier-eslint-cli-5.0.0.tgz",
|
||||
"integrity": "sha512-cei9UbN1aTrz3sQs88CWpvY/10PYTevzd76zoG1tdJ164OhmNTFRKPTOZrutVvscoQWzbnLKkviS3gu5JXwvZg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arrify": "^2.0.1",
|
||||
"boolify": "^1.0.0",
|
||||
"camelcase-keys": "^6.0.0",
|
||||
"chalk": "^2.4.2",
|
||||
"common-tags": "^1.8.0",
|
||||
"core-js": "^3.1.4",
|
||||
"eslint": "^5.0.0",
|
||||
"find-up": "^4.1.0",
|
||||
"get-stdin": "^7.0.0",
|
||||
"glob": "^7.1.4",
|
||||
"ignore": "^5.1.2",
|
||||
"lodash.memoize": "^4.1.2",
|
||||
"loglevel-colored-level-prefix": "^1.0.0",
|
||||
"messageformat": "^2.2.1",
|
||||
"prettier-eslint": "^9.0.0",
|
||||
"rxjs": "^6.5.2",
|
||||
"yargs": "^13.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"arrify": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
|
||||
"integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==",
|
||||
"dev": true
|
||||
},
|
||||
"core-js": {
|
||||
"version": "3.3.6",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.3.6.tgz",
|
||||
"integrity": "sha512-u4oM8SHwmDuh5mWZdDg9UwNVq5s1uqq6ZDLLIs07VY+VJU91i3h4f3K/pgFvtUQPGdeStrZ+odKyfyt4EnKHfA==",
|
||||
"dev": true
|
||||
},
|
||||
"find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"locate-path": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"ignore": {
|
||||
"version": "5.1.4",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz",
|
||||
"integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==",
|
||||
"dev": true
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-locate": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-limit": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"pretty-bytes": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.3.0.tgz",
|
||||
|
@ -10747,6 +11085,12 @@
|
|||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz",
|
||||
"integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA=="
|
||||
},
|
||||
"quick-lru": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz",
|
||||
"integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==",
|
||||
"dev": true
|
||||
},
|
||||
"raf": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
|
||||
|
@ -11095,6 +11439,224 @@
|
|||
"webpack-dev-server": "3.2.1",
|
||||
"webpack-manifest-plugin": "2.1.1",
|
||||
"workbox-webpack-plugin": "4.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
|
||||
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ=="
|
||||
},
|
||||
"ansi-escapes": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.2.1.tgz",
|
||||
"integrity": "sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q==",
|
||||
"requires": {
|
||||
"type-fest": "^0.5.2"
|
||||
}
|
||||
},
|
||||
"cli-cursor": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
|
||||
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
|
||||
"requires": {
|
||||
"restore-cursor": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||
},
|
||||
"eslint": {
|
||||
"version": "6.6.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.6.0.tgz",
|
||||
"integrity": "sha512-PpEBq7b6qY/qrOmpYQ/jTMDYfuQMELR4g4WI1M/NaSDDD/bdcMb+dj4Hgks7p41kW2caXsPsEZAEAyAgjVVC0g==",
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"ajv": "^6.10.0",
|
||||
"chalk": "^2.1.0",
|
||||
"cross-spawn": "^6.0.5",
|
||||
"debug": "^4.0.1",
|
||||
"doctrine": "^3.0.0",
|
||||
"eslint-scope": "^5.0.0",
|
||||
"eslint-utils": "^1.4.3",
|
||||
"eslint-visitor-keys": "^1.1.0",
|
||||
"espree": "^6.1.2",
|
||||
"esquery": "^1.0.1",
|
||||
"esutils": "^2.0.2",
|
||||
"file-entry-cache": "^5.0.1",
|
||||
"functional-red-black-tree": "^1.0.1",
|
||||
"glob-parent": "^5.0.0",
|
||||
"globals": "^11.7.0",
|
||||
"ignore": "^4.0.6",
|
||||
"import-fresh": "^3.0.0",
|
||||
"imurmurhash": "^0.1.4",
|
||||
"inquirer": "^7.0.0",
|
||||
"is-glob": "^4.0.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||
"levn": "^0.3.0",
|
||||
"lodash": "^4.17.14",
|
||||
"minimatch": "^3.0.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"natural-compare": "^1.4.0",
|
||||
"optionator": "^0.8.2",
|
||||
"progress": "^2.0.0",
|
||||
"regexpp": "^2.0.1",
|
||||
"semver": "^6.1.2",
|
||||
"strip-ansi": "^5.2.0",
|
||||
"strip-json-comments": "^3.0.1",
|
||||
"table": "^5.2.3",
|
||||
"text-table": "^0.2.0",
|
||||
"v8-compile-cache": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"eslint-plugin-react": {
|
||||
"version": "7.14.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz",
|
||||
"integrity": "sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==",
|
||||
"requires": {
|
||||
"array-includes": "^3.0.3",
|
||||
"doctrine": "^2.1.0",
|
||||
"has": "^1.0.3",
|
||||
"jsx-ast-utils": "^2.1.0",
|
||||
"object.entries": "^1.1.0",
|
||||
"object.fromentries": "^2.0.0",
|
||||
"object.values": "^1.1.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"resolve": "^1.10.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"doctrine": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
|
||||
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
|
||||
"requires": {
|
||||
"esutils": "^2.0.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslint-utils": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz",
|
||||
"integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==",
|
||||
"requires": {
|
||||
"eslint-visitor-keys": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"espree": {
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz",
|
||||
"integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==",
|
||||
"requires": {
|
||||
"acorn": "^7.1.0",
|
||||
"acorn-jsx": "^5.1.0",
|
||||
"eslint-visitor-keys": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"figures": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz",
|
||||
"integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==",
|
||||
"requires": {
|
||||
"escape-string-regexp": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"import-fresh": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz",
|
||||
"integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==",
|
||||
"requires": {
|
||||
"parent-module": "^1.0.0",
|
||||
"resolve-from": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"inquirer": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.0.tgz",
|
||||
"integrity": "sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ==",
|
||||
"requires": {
|
||||
"ansi-escapes": "^4.2.1",
|
||||
"chalk": "^2.4.2",
|
||||
"cli-cursor": "^3.1.0",
|
||||
"cli-width": "^2.0.0",
|
||||
"external-editor": "^3.0.3",
|
||||
"figures": "^3.0.0",
|
||||
"lodash": "^4.17.15",
|
||||
"mute-stream": "0.0.8",
|
||||
"run-async": "^2.2.0",
|
||||
"rxjs": "^6.4.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^5.1.0",
|
||||
"through": "^2.3.6"
|
||||
}
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"mute-stream": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
|
||||
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="
|
||||
},
|
||||
"onetime": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz",
|
||||
"integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==",
|
||||
"requires": {
|
||||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"resolve-from": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
|
||||
},
|
||||
"restore-cursor": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
|
||||
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
|
||||
"requires": {
|
||||
"onetime": "^5.1.0",
|
||||
"signal-exit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.1.0.tgz",
|
||||
"integrity": "sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ==",
|
||||
"requires": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^5.2.0"
|
||||
}
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz",
|
||||
"integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"react-textarea-autosize": {
|
||||
|
@ -11516,6 +12078,12 @@
|
|||
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
|
||||
},
|
||||
"require-relative": {
|
||||
"version": "0.8.7",
|
||||
"resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz",
|
||||
"integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=",
|
||||
"dev": true
|
||||
},
|
||||
"requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
|
@ -12745,9 +13313,10 @@
|
|||
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz",
|
||||
"integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw=="
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
|
||||
"dev": true
|
||||
},
|
||||
"style-loader": {
|
||||
"version": "1.0.0",
|
||||
|
@ -13160,6 +13729,12 @@
|
|||
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.6.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.4.tgz",
|
||||
"integrity": "sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript-compare": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz",
|
||||
|
@ -13590,6 +14165,65 @@
|
|||
"resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz",
|
||||
"integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w="
|
||||
},
|
||||
"vue-eslint-parser": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz",
|
||||
"integrity": "sha512-ZezcU71Owm84xVF6gfurBQUGg8WQ+WZGxgDEQu1IHFBZNx7BFZg3L1yHxrCBNNwbwFtE1GuvfJKMtb6Xuwc/Bw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^3.1.0",
|
||||
"eslint-scope": "^3.7.1",
|
||||
"eslint-visitor-keys": "^1.0.0",
|
||||
"espree": "^3.5.2",
|
||||
"esquery": "^1.0.0",
|
||||
"lodash": "^4.17.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "5.7.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz",
|
||||
"integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-jsx": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz",
|
||||
"integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"acorn": "^3.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
|
||||
"integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "3.7.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz",
|
||||
"integrity": "sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esrecurse": "^4.1.0",
|
||||
"estraverse": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"espree": {
|
||||
"version": "3.5.4",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
|
||||
"integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"acorn": "^5.5.0",
|
||||
"acorn-jsx": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"w3c-hr-time": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"scripts": {
|
||||
"build": "react-scripts build",
|
||||
"eject": "react-scripts eject",
|
||||
"format": "prettier-eslint --write \"src/**/*.*(js|jsx)\"",
|
||||
"lint": "eslint --ext js,jsx src",
|
||||
"start": "react-scripts start",
|
||||
"test": "react-scripts test"
|
||||
|
@ -64,6 +65,12 @@
|
|||
"whatwg-fetch": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint-config-airbnb": "^18.0.1"
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-airbnb": "^18.0.1",
|
||||
"eslint-plugin-import": "^2.18.2",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||
"eslint-plugin-react": "^7.16.0",
|
||||
"eslint-plugin-react-hooks": "^1.7.0",
|
||||
"prettier-eslint-cli": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,11 +42,7 @@ const Projects = React.memo(({
|
|||
))}
|
||||
{isEditable && (
|
||||
<Grid.Column mobile={8} computer={4}>
|
||||
<button
|
||||
type="button"
|
||||
className={classNames(styles.card, styles.add)}
|
||||
onClick={onAdd}
|
||||
>
|
||||
<button type="button" className={classNames(styles.card, styles.add)} onClick={onAdd}>
|
||||
<div className={styles.addTitleWrapper}>
|
||||
<div className={styles.addTitle}>
|
||||
<PlusIcon className={styles.addGridIcon} />
|
||||
|
|
|
@ -37,135 +37,137 @@ const createMessage = (error) => {
|
|||
}
|
||||
};
|
||||
|
||||
const EditEmailStep = React.memo(({
|
||||
defaultData, email, isSubmitting, error, onUpdate, onMessageDismiss, onBack, onClose,
|
||||
}) => {
|
||||
const [t] = useTranslation();
|
||||
const wasSubmitting = usePrevious(isSubmitting);
|
||||
const EditEmailStep = React.memo(
|
||||
({
|
||||
defaultData, email, isSubmitting, error, onUpdate, onMessageDismiss, onBack, onClose,
|
||||
}) => {
|
||||
const [t] = useTranslation();
|
||||
const wasSubmitting = usePrevious(isSubmitting);
|
||||
|
||||
const [data, handleFieldChange, setData] = useForm({
|
||||
email: '',
|
||||
currentPassword: '',
|
||||
...defaultData,
|
||||
});
|
||||
const [data, handleFieldChange, setData] = useForm({
|
||||
email: '',
|
||||
currentPassword: '',
|
||||
...defaultData,
|
||||
});
|
||||
|
||||
const message = useMemo(() => createMessage(error), [error]);
|
||||
const [focusCurrentPasswordFieldState, focusCurrentPasswordField] = useToggle();
|
||||
const message = useMemo(() => createMessage(error), [error]);
|
||||
const [focusCurrentPasswordFieldState, focusCurrentPasswordField] = useToggle();
|
||||
|
||||
const emailField = useRef(null);
|
||||
const currentPasswordField = useRef(null);
|
||||
const emailField = useRef(null);
|
||||
const currentPasswordField = useRef(null);
|
||||
|
||||
const handleSubmit = useCallback(() => {
|
||||
const cleanData = {
|
||||
...data,
|
||||
email: data.email.trim(),
|
||||
};
|
||||
const handleSubmit = useCallback(() => {
|
||||
const cleanData = {
|
||||
...data,
|
||||
email: data.email.trim(),
|
||||
};
|
||||
|
||||
if (!isEmail(cleanData.email)) {
|
||||
emailField.current.select();
|
||||
return;
|
||||
}
|
||||
|
||||
if (cleanData.email === email) {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cleanData.currentPassword) {
|
||||
currentPasswordField.current.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
onUpdate(cleanData);
|
||||
}, [email, onUpdate, onClose, data]);
|
||||
|
||||
useEffect(() => {
|
||||
emailField.current.select();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (wasSubmitting && !isSubmitting) {
|
||||
if (error) {
|
||||
switch (error.message) {
|
||||
case 'User is already exist':
|
||||
emailField.current.select();
|
||||
|
||||
break;
|
||||
case 'Current password is not valid':
|
||||
setData((prevData) => ({
|
||||
...prevData,
|
||||
currentPassword: '',
|
||||
}));
|
||||
focusCurrentPasswordField();
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
onClose();
|
||||
if (!isEmail(cleanData.email)) {
|
||||
emailField.current.select();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, [isSubmitting, wasSubmitting, error, onClose, setData, focusCurrentPasswordField]);
|
||||
|
||||
useDidUpdate(() => {
|
||||
currentPasswordField.current.focus();
|
||||
}, [focusCurrentPasswordFieldState]);
|
||||
if (cleanData.email === email) {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popup.Header onBack={onBack}>
|
||||
{t('common.editEmail', {
|
||||
context: 'title',
|
||||
})}
|
||||
</Popup.Header>
|
||||
<Popup.Content>
|
||||
{message && (
|
||||
<Message
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
{...{
|
||||
[message.type]: true,
|
||||
}}
|
||||
visible
|
||||
content={t(message.content)}
|
||||
onDismiss={onMessageDismiss}
|
||||
/>
|
||||
)}
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<div className={styles.text}>{t('common.newEmail')}</div>
|
||||
<Input
|
||||
fluid
|
||||
ref={emailField}
|
||||
name="email"
|
||||
value={data.email}
|
||||
placeholder={email}
|
||||
className={styles.field}
|
||||
onChange={handleFieldChange}
|
||||
/>
|
||||
{data.email.trim() !== email && (
|
||||
<>
|
||||
<div className={styles.text}>{t('common.currentPassword')}</div>
|
||||
<Input
|
||||
fluid
|
||||
ref={currentPasswordField}
|
||||
type="password"
|
||||
name="currentPassword"
|
||||
value={data.currentPassword}
|
||||
className={styles.field}
|
||||
onChange={handleFieldChange}
|
||||
/>
|
||||
</>
|
||||
if (!cleanData.currentPassword) {
|
||||
currentPasswordField.current.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
onUpdate(cleanData);
|
||||
}, [email, onUpdate, onClose, data]);
|
||||
|
||||
useEffect(() => {
|
||||
emailField.current.select();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (wasSubmitting && !isSubmitting) {
|
||||
if (error) {
|
||||
switch (error.message) {
|
||||
case 'User is already exist':
|
||||
emailField.current.select();
|
||||
|
||||
break;
|
||||
case 'Current password is not valid':
|
||||
setData((prevData) => ({
|
||||
...prevData,
|
||||
currentPassword: '',
|
||||
}));
|
||||
focusCurrentPasswordField();
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
}, [isSubmitting, wasSubmitting, error, onClose, setData, focusCurrentPasswordField]);
|
||||
|
||||
useDidUpdate(() => {
|
||||
currentPasswordField.current.focus();
|
||||
}, [focusCurrentPasswordFieldState]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popup.Header onBack={onBack}>
|
||||
{t('common.editEmail', {
|
||||
context: 'title',
|
||||
})}
|
||||
</Popup.Header>
|
||||
<Popup.Content>
|
||||
{message && (
|
||||
<Message
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
{...{
|
||||
[message.type]: true,
|
||||
}}
|
||||
visible
|
||||
content={t(message.content)}
|
||||
onDismiss={onMessageDismiss}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
positive
|
||||
content={t('action.save')}
|
||||
loading={isSubmitting}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</Form>
|
||||
</Popup.Content>
|
||||
</>
|
||||
);
|
||||
});
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<div className={styles.text}>{t('common.newEmail')}</div>
|
||||
<Input
|
||||
fluid
|
||||
ref={emailField}
|
||||
name="email"
|
||||
value={data.email}
|
||||
placeholder={email}
|
||||
className={styles.field}
|
||||
onChange={handleFieldChange}
|
||||
/>
|
||||
{data.email.trim() !== email && (
|
||||
<>
|
||||
<div className={styles.text}>{t('common.currentPassword')}</div>
|
||||
<Input
|
||||
fluid
|
||||
ref={currentPasswordField}
|
||||
type="password"
|
||||
name="currentPassword"
|
||||
value={data.currentPassword}
|
||||
className={styles.field}
|
||||
onChange={handleFieldChange}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
positive
|
||||
content={t('action.save')}
|
||||
loading={isSubmitting}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</Form>
|
||||
</Popup.Content>
|
||||
</>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
EditEmailStep.propTypes = {
|
||||
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||
|
|
|
@ -31,110 +31,112 @@ const createMessage = (error) => {
|
|||
}
|
||||
};
|
||||
|
||||
const EditPasswordStep = React.memo(({
|
||||
defaultData, isSubmitting, error, onUpdate, onMessageDismiss, onBack, onClose,
|
||||
}) => {
|
||||
const [t] = useTranslation();
|
||||
const wasSubmitting = usePrevious(isSubmitting);
|
||||
const EditPasswordStep = React.memo(
|
||||
({
|
||||
defaultData, isSubmitting, error, onUpdate, onMessageDismiss, onBack, onClose,
|
||||
}) => {
|
||||
const [t] = useTranslation();
|
||||
const wasSubmitting = usePrevious(isSubmitting);
|
||||
|
||||
const [data, handleFieldChange, setData] = useForm({
|
||||
password: '',
|
||||
currentPassword: '',
|
||||
...defaultData,
|
||||
});
|
||||
const [data, handleFieldChange, setData] = useForm({
|
||||
password: '',
|
||||
currentPassword: '',
|
||||
...defaultData,
|
||||
});
|
||||
|
||||
const message = useMemo(() => createMessage(error), [error]);
|
||||
const [focusCurrentPasswordFieldState, focusCurrentPasswordField] = useToggle();
|
||||
const message = useMemo(() => createMessage(error), [error]);
|
||||
const [focusCurrentPasswordFieldState, focusCurrentPasswordField] = useToggle();
|
||||
|
||||
const passwordField = useRef(null);
|
||||
const currentPasswordField = useRef(null);
|
||||
const passwordField = useRef(null);
|
||||
const currentPasswordField = useRef(null);
|
||||
|
||||
const handleSubmit = useCallback(() => {
|
||||
if (!data.password) {
|
||||
passwordField.current.select();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.currentPassword) {
|
||||
currentPasswordField.current.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
onUpdate(data);
|
||||
}, [onUpdate, data]);
|
||||
|
||||
useEffect(() => {
|
||||
passwordField.current.select();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (wasSubmitting && !isSubmitting) {
|
||||
if (!error) {
|
||||
onClose();
|
||||
} else if (error.message === 'Current password is not valid') {
|
||||
setData((prevData) => ({
|
||||
...prevData,
|
||||
currentPassword: '',
|
||||
}));
|
||||
focusCurrentPasswordField();
|
||||
const handleSubmit = useCallback(() => {
|
||||
if (!data.password) {
|
||||
passwordField.current.select();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, [isSubmitting, wasSubmitting, error, onClose, setData, focusCurrentPasswordField]);
|
||||
|
||||
useDidUpdate(() => {
|
||||
currentPasswordField.current.focus();
|
||||
}, [focusCurrentPasswordFieldState]);
|
||||
if (!data.currentPassword) {
|
||||
currentPasswordField.current.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popup.Header onBack={onBack}>
|
||||
{t('common.editPassword', {
|
||||
context: 'title',
|
||||
})}
|
||||
</Popup.Header>
|
||||
<Popup.Content>
|
||||
{message && (
|
||||
<Message
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
{...{
|
||||
[message.type]: true,
|
||||
}}
|
||||
visible
|
||||
content={t(message.content)}
|
||||
onDismiss={onMessageDismiss}
|
||||
/>
|
||||
)}
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<div className={styles.text}>{t('common.newPassword')}</div>
|
||||
<Input
|
||||
fluid
|
||||
ref={passwordField}
|
||||
name="password"
|
||||
value={data.password}
|
||||
className={styles.field}
|
||||
onChange={handleFieldChange}
|
||||
/>
|
||||
<div className={styles.text}>{t('common.currentPassword')}</div>
|
||||
<Input
|
||||
fluid
|
||||
ref={currentPasswordField}
|
||||
type="password"
|
||||
name="currentPassword"
|
||||
value={data.currentPassword}
|
||||
className={styles.field}
|
||||
onChange={handleFieldChange}
|
||||
/>
|
||||
<Button
|
||||
positive
|
||||
content={t('action.save')}
|
||||
loading={isSubmitting}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</Form>
|
||||
</Popup.Content>
|
||||
</>
|
||||
);
|
||||
});
|
||||
onUpdate(data);
|
||||
}, [onUpdate, data]);
|
||||
|
||||
useEffect(() => {
|
||||
passwordField.current.select();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (wasSubmitting && !isSubmitting) {
|
||||
if (!error) {
|
||||
onClose();
|
||||
} else if (error.message === 'Current password is not valid') {
|
||||
setData((prevData) => ({
|
||||
...prevData,
|
||||
currentPassword: '',
|
||||
}));
|
||||
focusCurrentPasswordField();
|
||||
}
|
||||
}
|
||||
}, [isSubmitting, wasSubmitting, error, onClose, setData, focusCurrentPasswordField]);
|
||||
|
||||
useDidUpdate(() => {
|
||||
currentPasswordField.current.focus();
|
||||
}, [focusCurrentPasswordFieldState]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popup.Header onBack={onBack}>
|
||||
{t('common.editPassword', {
|
||||
context: 'title',
|
||||
})}
|
||||
</Popup.Header>
|
||||
<Popup.Content>
|
||||
{message && (
|
||||
<Message
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
{...{
|
||||
[message.type]: true,
|
||||
}}
|
||||
visible
|
||||
content={t(message.content)}
|
||||
onDismiss={onMessageDismiss}
|
||||
/>
|
||||
)}
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<div className={styles.text}>{t('common.newPassword')}</div>
|
||||
<Input
|
||||
fluid
|
||||
ref={passwordField}
|
||||
name="password"
|
||||
value={data.password}
|
||||
className={styles.field}
|
||||
onChange={handleFieldChange}
|
||||
/>
|
||||
<div className={styles.text}>{t('common.currentPassword')}</div>
|
||||
<Input
|
||||
fluid
|
||||
ref={currentPasswordField}
|
||||
type="password"
|
||||
name="currentPassword"
|
||||
value={data.currentPassword}
|
||||
className={styles.field}
|
||||
onChange={handleFieldChange}
|
||||
/>
|
||||
<Button
|
||||
positive
|
||||
content={t('action.save')}
|
||||
loading={isSubmitting}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</Form>
|
||||
</Popup.Content>
|
||||
</>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
EditPasswordStep.propTypes = {
|
||||
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||
|
|
|
@ -15,7 +15,8 @@ export default {
|
|||
addUser_title: 'Add User',
|
||||
administrator: 'Administrator',
|
||||
all: 'All',
|
||||
allChangesWillBeAutomaticallySavedAfterConnectionRestored: 'All changes will be automatically saved<br />after connection restored',
|
||||
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
||||
'All changes will be automatically saved<br />after connection restored',
|
||||
areYouSureYouWantToDeleteThisBoard: 'Are you sure you want to delete this board?',
|
||||
areYouSureYouWantToDeleteThisCard: 'Are you sure you want to delete this card?',
|
||||
areYouSureYouWantToDeleteThisComment: 'Are you sure you want to delete this comment?',
|
||||
|
@ -24,7 +25,8 @@ export default {
|
|||
areYouSureYouWantToDeleteThisProject: 'Are you sure you want to delete this project?',
|
||||
areYouSureYouWantToDeleteThisTask: 'Are you sure you want to delete this task?',
|
||||
areYouSureYouWantToDeleteThisUser: 'Are you sure you want to delete this user?',
|
||||
areYouSureYouWantToRemoveThisMemberFromProject: 'Are you sure you want to remove this member from project?',
|
||||
areYouSureYouWantToRemoveThisMemberFromProject:
|
||||
'Are you sure you want to remove this member from project?',
|
||||
boardNotFound_title: 'Board Not Found',
|
||||
cardActions_title: 'Card Actions',
|
||||
cardNotFound_title: 'Card Not Found',
|
||||
|
@ -77,7 +79,8 @@ export default {
|
|||
noUnreadNotifications: 'No unread notifications',
|
||||
openBoard_title: 'Open Board',
|
||||
projectNotFound_title: 'Project Not Found',
|
||||
refreshPageToLoadLastDataAndReceiveUpdates: '<0>Refresh the page</0> to load last data<br />and receive updates',
|
||||
refreshPageToLoadLastDataAndReceiveUpdates:
|
||||
'<0>Refresh the page</0> to load last data<br />and receive updates',
|
||||
removeMember_title: 'Remove Member',
|
||||
seconds: 'Seconds',
|
||||
taskActions_title: 'Task Actions',
|
||||
|
@ -89,7 +92,8 @@ export default {
|
|||
userIsAlreadyExist: 'User is already exist',
|
||||
userLeftNewCommentToCard: '{{user}} left a new comment «{{comment}}» to <2>{{card}}</2>',
|
||||
userMovedCardFromListToList: '{{user}} moved <2>{{card}}</2> from {{fromList}} to {{toList}}',
|
||||
userMovedThisCardFromListToList: '<0>{{user}}</0><1> moved this card from {{fromList}} to {{toList}}</1>',
|
||||
userMovedThisCardFromListToList:
|
||||
'<0>{{user}}</0><1> moved this card from {{fromList}} to {{toList}}</1>',
|
||||
users: 'Users',
|
||||
writeComment: 'Write a comment...',
|
||||
},
|
||||
|
|
|
@ -19,7 +19,8 @@ export default {
|
|||
addUser: 'Добавление пользователя',
|
||||
administrator: 'Администратор',
|
||||
all: 'Все',
|
||||
allChangesWillBeAutomaticallySavedAfterConnectionRestored: 'Все изменения сохранятся автоматически,<br />как только подключение восстановится',
|
||||
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
||||
'Все изменения сохранятся автоматически,<br />как только подключение восстановится',
|
||||
areYouSureYouWantToDeleteThisBoard: 'Вы уверены, что хотите удалить эту доску?',
|
||||
areYouSureYouWantToDeleteThisCard: 'Вы уверены, что хотите удалить эту карточку?',
|
||||
areYouSureYouWantToDeleteThisComment: 'Вы уверены, что хотите удалить этот комментарий?',
|
||||
|
@ -28,7 +29,8 @@ export default {
|
|||
areYouSureYouWantToDeleteThisProject: 'Вы уверены, что хотите удалить этот проект?',
|
||||
areYouSureYouWantToDeleteThisTask: 'Вы уверены, что хотите удалить эту задачу?',
|
||||
areYouSureYouWantToDeleteThisUser: 'Вы уверены, что хотите удалить этого пользователя?',
|
||||
areYouSureYouWantToRemoveThisMemberFromProject: 'Вы уверены, что хотите удалить этого участника из проекта?',
|
||||
areYouSureYouWantToRemoveThisMemberFromProject:
|
||||
'Вы уверены, что хотите удалить этого участника из проекта?',
|
||||
boardNotFound: 'Доска не найдена',
|
||||
cardActions: 'Действия с карточкой',
|
||||
cardNotFound: 'Карточка не найдена',
|
||||
|
@ -81,7 +83,8 @@ export default {
|
|||
noUnreadNotifications: 'Уведомлений нет',
|
||||
openBoard: 'Откройте доску',
|
||||
projectNotFound: 'Доска не найдена',
|
||||
refreshPageToLoadLastDataAndReceiveUpdates: '<0>Обновите страницу</0>, чтобы загрузить<br />актуальные данные и получать обновления',
|
||||
refreshPageToLoadLastDataAndReceiveUpdates:
|
||||
'<0>Обновите страницу</0>, чтобы загрузить<br />актуальные данные и получать обновления',
|
||||
removeMember: 'Удаление участника',
|
||||
seconds: 'Секунды',
|
||||
taskActions: 'Действия с задачей',
|
||||
|
@ -92,8 +95,10 @@ export default {
|
|||
userAddedThisCardToList: '<0>{{user}}</0><1> добавил(а) эту карточку в {{list}}</1>',
|
||||
userIsAlreadyExist: 'Пользователь уже существует',
|
||||
userLeftNewCommentToCard: '{{user}} оставил(а) комментарий «{{comment}}» к <2>{{card}}</2>',
|
||||
userMovedCardFromListToList: '{{user}} переместил(а) <2>{{card}}</2> из {{fromList}} в {{toList}}',
|
||||
userMovedThisCardFromListToList: '<0>{{user}}</0><1> переместил(а) эту карточку из {{fromList}} в {{toList}}</1>',
|
||||
userMovedCardFromListToList:
|
||||
'{{user}} переместил(а) <2>{{card}}</2> из {{fromList}} в {{toList}}',
|
||||
userMovedThisCardFromListToList:
|
||||
'<0>{{user}}</0><1> переместил(а) эту карточку из {{fromList}} в {{toList}}</1>',
|
||||
users: 'Пользователи',
|
||||
writeComment: 'Напишите комментарий...',
|
||||
},
|
||||
|
|
|
@ -4,8 +4,6 @@ import { fetchActionsInCurrentCardService } from '../services';
|
|||
import EntryActionTypes from '../../../constants/EntryActionTypes';
|
||||
|
||||
export default function* () {
|
||||
yield takeLatest(
|
||||
EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH,
|
||||
() => fetchActionsInCurrentCardService(),
|
||||
);
|
||||
// eslint-disable-next-line max-len
|
||||
yield takeLatest(EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH, () => fetchActionsInCurrentCardService());
|
||||
}
|
||||
|
|
|
@ -10,18 +10,11 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
|||
|
||||
export default function* () {
|
||||
yield all([
|
||||
takeLatest(
|
||||
EntryActionTypes.BOARD_IN_CURRENT_PROJECT_CREATE,
|
||||
({ payload: { data } }) => createBoardInCurrentProjectService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.BOARD_UPDATE,
|
||||
({ payload: { id, data } }) => updateBoardService(id, data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.BOARD_MOVE,
|
||||
({ payload: { id, index } }) => moveBoardService(id, index),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.BOARD_IN_CURRENT_PROJECT_CREATE, ({ payload: { data } }) => createBoardInCurrentProjectService(data)),
|
||||
takeLatest(EntryActionTypes.BOARD_UPDATE, ({ payload: { id, data } }) => updateBoardService(id, data)),
|
||||
takeLatest(EntryActionTypes.BOARD_MOVE, ({ payload: { id, index } }) => moveBoardService(id, index)),
|
||||
/* eslint-enable max-len */
|
||||
takeLatest(EntryActionTypes.BOARD_DELETE, ({ payload: { id } }) => deleteBoardService(id)),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -12,22 +12,12 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
|||
|
||||
export default function* () {
|
||||
yield all([
|
||||
takeLatest(
|
||||
EntryActionTypes.CARD_CREATE,
|
||||
({ payload: { listId, data } }) => createCardService(listId, data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CARD_UPDATE,
|
||||
({ payload: { id, data } }) => updateCardService(id, data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CURRENT_CARD_UPDATE,
|
||||
({ payload: { data } }) => updateCurrentCardService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CARD_MOVE,
|
||||
({ payload: { id, listId, index } }) => moveCardService(id, listId, index),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.CARD_CREATE, ({ payload: { listId, data } }) => createCardService(listId, data)),
|
||||
takeLatest(EntryActionTypes.CARD_UPDATE, ({ payload: { id, data } }) => updateCardService(id, data)),
|
||||
takeLatest(EntryActionTypes.CURRENT_CARD_UPDATE, ({ payload: { data } }) => updateCurrentCardService(data)),
|
||||
takeLatest(EntryActionTypes.CARD_MOVE, ({ payload: { id, listId, index } }) => moveCardService(id, listId, index)),
|
||||
/* eslint-enable max-len */
|
||||
takeLatest(EntryActionTypes.CARD_DELETE, ({ payload: { id } }) => deleteCardService(id)),
|
||||
takeLatest(EntryActionTypes.CURRENT_CARD_DELETE, () => deleteCurrentCardService()),
|
||||
]);
|
||||
|
|
|
@ -9,17 +9,10 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
|||
|
||||
export default function* () {
|
||||
yield all([
|
||||
takeLatest(
|
||||
EntryActionTypes.COMMENT_ACTION_IN_CURRENT_CARD_CREATE,
|
||||
({ payload: { data } }) => createCommentActionInCurrentCardService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.COMMENT_ACTION_UPDATE,
|
||||
({ payload: { id, data } }) => updateCommentActionService(id, data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.COMMENT_ACTION_DELETE,
|
||||
({ payload: { id } }) => deleteCommentActionService(id),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.COMMENT_ACTION_IN_CURRENT_CARD_CREATE, ({ payload: { data } }) => createCommentActionInCurrentCardService(data)),
|
||||
takeLatest(EntryActionTypes.COMMENT_ACTION_UPDATE, ({ payload: { id, data } }) => updateCommentActionService(id, data)),
|
||||
takeLatest(EntryActionTypes.COMMENT_ACTION_DELETE, ({ payload: { id } }) => deleteCommentActionService(id)),
|
||||
/* eslint-enable max-len */
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -15,38 +15,18 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
|||
|
||||
export default function* () {
|
||||
yield all([
|
||||
takeLatest(
|
||||
EntryActionTypes.LABEL_IN_CURRENT_BOARD_CREATE,
|
||||
({ payload: { data } }) => createLabelInCurrentBoardService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.LABEL_UPDATE,
|
||||
({ payload: { id, data } }) => updateLabelService(id, data),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.LABEL_IN_CURRENT_BOARD_CREATE, ({ payload: { data } }) => createLabelInCurrentBoardService(data)),
|
||||
takeLatest(EntryActionTypes.LABEL_UPDATE, ({ payload: { id, data } }) => updateLabelService(id, data)),
|
||||
/* eslint-enable max-len */
|
||||
takeLatest(EntryActionTypes.LABEL_DELETE, ({ payload: { id } }) => deleteLabelService(id)),
|
||||
takeLatest(
|
||||
EntryActionTypes.LABEL_TO_CARD_ADD,
|
||||
({ payload: { id, cardId } }) => addLabelToCardService(id, cardId),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.LABEL_TO_CURRENT_CARD_ADD,
|
||||
({ payload: { id } }) => addLabelToCurrentCardService(id),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.LABEL_FROM_CARD_REMOVE,
|
||||
({ payload: { id, cardId } }) => removeLabelFromCardService(id, cardId),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.LABEL_FROM_CURRENT_CARD_REMOVE,
|
||||
({ payload: { id } }) => removeLabelFromCurrentCardService(id),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.LABEL_TO_FILTER_IN_CURRENT_BOARD_ADD,
|
||||
({ payload: { id } }) => addLabelToFilterInCurrentBoardService(id),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.LABEL_FROM_FILTER_IN_CURRENT_BOARD_REMOVE,
|
||||
({ payload: { id } }) => removeLabelFromFilterInCurrentBoardService(id),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.LABEL_TO_CARD_ADD, ({ payload: { id, cardId } }) => addLabelToCardService(id, cardId)),
|
||||
takeLatest(EntryActionTypes.LABEL_TO_CURRENT_CARD_ADD, ({ payload: { id } }) => addLabelToCurrentCardService(id)),
|
||||
takeLatest(EntryActionTypes.LABEL_FROM_CARD_REMOVE, ({ payload: { id, cardId } }) => removeLabelFromCardService(id, cardId)),
|
||||
takeLatest(EntryActionTypes.LABEL_FROM_CURRENT_CARD_REMOVE, ({ payload: { id } }) => removeLabelFromCurrentCardService(id)),
|
||||
takeLatest(EntryActionTypes.LABEL_TO_FILTER_IN_CURRENT_BOARD_ADD, ({ payload: { id } }) => addLabelToFilterInCurrentBoardService(id)),
|
||||
takeLatest(EntryActionTypes.LABEL_FROM_FILTER_IN_CURRENT_BOARD_REMOVE, ({ payload: { id } }) => removeLabelFromFilterInCurrentBoardService(id)),
|
||||
/* eslint-enable max-len */
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -10,18 +10,11 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
|||
|
||||
export default function* () {
|
||||
yield all([
|
||||
takeLatest(
|
||||
EntryActionTypes.LIST_IN_CURRENT_BOARD_CREATE,
|
||||
({ payload: { data } }) => createListInCurrentBoardService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.LIST_UPDATE,
|
||||
({ payload: { id, data } }) => updateListService(id, data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.LIST_MOVE,
|
||||
({ payload: { id, index } }) => moveListService(id, index),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.LIST_IN_CURRENT_BOARD_CREATE, ({ payload: { data } }) => createListInCurrentBoardService(data)),
|
||||
takeLatest(EntryActionTypes.LIST_UPDATE, ({ payload: { id, data } }) => updateListService(id, data)),
|
||||
takeLatest(EntryActionTypes.LIST_MOVE, ({ payload: { id, index } }) => moveListService(id, index)),
|
||||
/* eslint-enable max-len */
|
||||
takeLatest(EntryActionTypes.LIST_DELETE, ({ payload: { id } }) => deleteListService(id)),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@ import { deleteNotificationService } from '../services';
|
|||
import EntryActionTypes from '../../../constants/EntryActionTypes';
|
||||
|
||||
export default function* () {
|
||||
yield takeLatest(
|
||||
EntryActionTypes.NOTIFICATION_DELETE,
|
||||
({ payload: { id } }) => deleteNotificationService(id),
|
||||
);
|
||||
// eslint-disable-next-line max-len
|
||||
yield takeLatest(EntryActionTypes.NOTIFICATION_DELETE, ({ payload: { id } }) => deleteNotificationService(id));
|
||||
}
|
||||
|
|
|
@ -8,13 +8,9 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
|||
|
||||
export default function* () {
|
||||
yield all([
|
||||
takeLatest(
|
||||
EntryActionTypes.MEMBERSHIP_IN_CURRENT_PROJECT_CREATE,
|
||||
({ payload: { data } }) => createMembershipInCurrentProjectService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.PROJECT_MEMBERSHIP_DELETE,
|
||||
({ payload: { id } }) => deleteProjectMembershipService(id),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.MEMBERSHIP_IN_CURRENT_PROJECT_CREATE, ({ payload: { data } }) => createMembershipInCurrentProjectService(data)),
|
||||
takeLatest(EntryActionTypes.PROJECT_MEMBERSHIP_DELETE, ({ payload: { id } }) => deleteProjectMembershipService(id)),
|
||||
/* eslint-enable max-len */
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -9,14 +9,10 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
|||
|
||||
export default function* () {
|
||||
yield all([
|
||||
takeLatest(
|
||||
EntryActionTypes.PROJECT_CREATE,
|
||||
({ payload: { data } }) => createProjectService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CURRENT_PROJECT_UPDATE,
|
||||
({ payload: { data } }) => updateCurrentProjectService(data),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.PROJECT_CREATE, ({ payload: { data } }) => createProjectService(data)),
|
||||
takeLatest(EntryActionTypes.CURRENT_PROJECT_UPDATE, ({ payload: { data } }) => updateCurrentProjectService(data)),
|
||||
/* eslint-enable max-len */
|
||||
takeLatest(EntryActionTypes.CURRENT_PROJECT_DELETE, () => deleteCurrentProjectService()),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -5,14 +5,10 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
|||
|
||||
export default function* () {
|
||||
yield all([
|
||||
takeLatest(
|
||||
EntryActionTypes.TASK_IN_CURRENT_CARD_CREATE,
|
||||
({ payload: { data } }) => createTaskInCurrentCardService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.TASK_UPDATE,
|
||||
({ payload: { id, data } }) => updateTaskService(id, data),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.TASK_IN_CURRENT_CARD_CREATE, ({ payload: { data } }) => createTaskInCurrentCardService(data)),
|
||||
takeLatest(EntryActionTypes.TASK_UPDATE, ({ payload: { id, data } }) => updateTaskService(id, data)),
|
||||
/* eslint-enable max-len */
|
||||
takeLatest(EntryActionTypes.TASK_DELETE, ({ payload: { id } }) => deleteTaskService(id)),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -24,58 +24,23 @@ export default function* () {
|
|||
yield all([
|
||||
takeLatest(EntryActionTypes.USER_CREATE, ({ payload: { data } }) => createUserService(data)),
|
||||
takeLatest(EntryActionTypes.USER_CREATE_ERROR_CLEAR, () => clearUserCreateErrorService()),
|
||||
takeLatest(
|
||||
EntryActionTypes.USER_UPDATE,
|
||||
({ payload: { id, data } }) => updateUserService(id, data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CURRENT_USER_UPDATE,
|
||||
({ payload: { data } }) => updateCurrentUserService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CURRENT_USER_EMAIL_UPDATE,
|
||||
({ payload: { data } }) => updateCurrentUserEmailService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR,
|
||||
() => clearCurrentUserEmailUpdateErrorService(),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE,
|
||||
({ payload: { data } }) => updateCurrentUserPasswordService(data),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR,
|
||||
() => clearCurrentUserPasswordUpdateErrorService(),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.CURRENT_USER_AVATAR_UPLOAD,
|
||||
({ payload: { file } }) => uploadCurrentUserAvatarService(file),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.USER_UPDATE, ({ payload: { id, data } }) => updateUserService(id, data)),
|
||||
takeLatest(EntryActionTypes.CURRENT_USER_UPDATE, ({ payload: { data } }) => updateCurrentUserService(data)),
|
||||
takeLatest(EntryActionTypes.CURRENT_USER_EMAIL_UPDATE, ({ payload: { data } }) => updateCurrentUserEmailService(data)),
|
||||
takeLatest(EntryActionTypes.CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR, () => clearCurrentUserEmailUpdateErrorService()),
|
||||
takeLatest(EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE, ({ payload: { data } }) => updateCurrentUserPasswordService(data)),
|
||||
takeLatest(EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR, () => clearCurrentUserPasswordUpdateErrorService()),
|
||||
takeLatest(EntryActionTypes.CURRENT_USER_AVATAR_UPLOAD, ({ payload: { file } }) => uploadCurrentUserAvatarService(file)),
|
||||
/* eslint-enable max-len */
|
||||
takeLatest(EntryActionTypes.USER_DELETE, ({ payload: { id } }) => deleteUserService(id)),
|
||||
takeLatest(
|
||||
EntryActionTypes.USER_TO_CARD_ADD,
|
||||
({ payload: { id, cardId } }) => addUserToCardService(id, cardId),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.USER_TO_CURRENT_CARD_ADD,
|
||||
({ payload: { id } }) => addUserToCurrentCardService(id),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.USER_FROM_CARD_REMOVE,
|
||||
({ payload: { id, cardId } }) => removeUserFromCardService(id, cardId),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.USER_FROM_CURRENT_CARD_REMOVE,
|
||||
({ payload: { id } }) => removeUserFromCurrentCardService(id),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.USER_TO_FILTER_IN_CURRENT_BOARD_ADD,
|
||||
({ payload: { id } }) => addUserToFilterInCurrentBoardService(id),
|
||||
),
|
||||
takeLatest(
|
||||
EntryActionTypes.USER_FROM_FILTER_IN_CURRENT_BOARD_REMOVE,
|
||||
({ payload: { id } }) => removeUserFromFilterInCurrentBoardService(id),
|
||||
),
|
||||
/* eslint-disable max-len */
|
||||
takeLatest(EntryActionTypes.USER_TO_CARD_ADD, ({ payload: { id, cardId } }) => addUserToCardService(id, cardId)),
|
||||
takeLatest(EntryActionTypes.USER_TO_CURRENT_CARD_ADD, ({ payload: { id } }) => addUserToCurrentCardService(id)),
|
||||
takeLatest(EntryActionTypes.USER_FROM_CARD_REMOVE, ({ payload: { id, cardId } }) => removeUserFromCardService(id, cardId)),
|
||||
takeLatest(EntryActionTypes.USER_FROM_CURRENT_CARD_REMOVE, ({ payload: { id } }) => removeUserFromCurrentCardService(id)),
|
||||
takeLatest(EntryActionTypes.USER_TO_FILTER_IN_CURRENT_BOARD_ADD, ({ payload: { id } }) => addUserToFilterInCurrentBoardService(id)),
|
||||
takeLatest(EntryActionTypes.USER_FROM_FILTER_IN_CURRENT_BOARD_REMOVE, ({ payload: { id } }) => removeUserFromFilterInCurrentBoardService(id)),
|
||||
/* eslint-enable max-len */
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -11,10 +11,8 @@ export const pathnameSelector = ({
|
|||
},
|
||||
}) => pathname;
|
||||
|
||||
export const pathsMatchSelector = createReselectSelector(
|
||||
pathnameSelector,
|
||||
(pathname) => matchPaths(pathname, Object.values(Paths)),
|
||||
);
|
||||
// eslint-disable-next-line max-len
|
||||
export const pathsMatchSelector = createReselectSelector(pathnameSelector, (pathname) => matchPaths(pathname, Object.values(Paths)));
|
||||
|
||||
export const pathSelector = createReduxOrmSelector(
|
||||
orm,
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
{
|
||||
// ╔═╗╔═╗╦ ╦╔╗╔╔╦╗┬─┐┌─┐
|
||||
// ║╣ ╚═╗║ ║║║║ ║ ├┬┘│
|
||||
// o╚═╝╚═╝╩═╝╩╝╚╝ ╩ ┴└─└─┘
|
||||
// A set of basic code conventions designed to encourage quality and consistency
|
||||
// across your Sails app's code base. These rules are checked against
|
||||
// automatically any time you run `npm test`.
|
||||
//
|
||||
// > An additional eslintrc override file is included in the `assets/` folder
|
||||
// > right out of the box. This is specifically to allow for variations in acceptable
|
||||
// > global variables between front-end JavaScript code designed to run in the browser
|
||||
// > vs. backend code designed to run in a Node.js/Sails process.
|
||||
//
|
||||
// > Note: If you're using mocha, you'll want to add an extra override file to your
|
||||
// > `test/` folder so that eslint will tolerate mocha-specific globals like `before`
|
||||
// > and `describe`.
|
||||
// Designed for ESLint v4.
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// For more information about any of the rules below, check out the relevant
|
||||
// reference page on eslint.org. For example, to get details on "no-sequences",
|
||||
// you would visit `http://eslint.org/docs/rules/no-sequences`. If you're unsure
|
||||
// or could use some advice, come by https://sailsjs.com/support.
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
|
||||
"globals": {
|
||||
// If "no-undef" is enabled below, be sure to list all global variables that
|
||||
// are used in this app's backend code (including the globalIds of models):
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
"Promise": true,
|
||||
"sails": true,
|
||||
"_": true
|
||||
// …and any others (e.g. `"Organization": true`)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
},
|
||||
|
||||
"rules": {
|
||||
"block-scoped-var": ["error"],
|
||||
"callback-return": ["error", ["done", "proceed", "next", "onwards", "callback", "cb"]],
|
||||
"camelcase": ["warn", {"properties":"always"}],
|
||||
"comma-style": ["warn", "last"],
|
||||
"curly": ["warn"],
|
||||
"eqeqeq": ["error", "always"],
|
||||
"eol-last": ["warn"],
|
||||
"handle-callback-err": ["error"],
|
||||
"indent": ["warn", 2, {
|
||||
"SwitchCase": 1,
|
||||
"MemberExpression": "off",
|
||||
"FunctionDeclaration": {"body":1, "parameters":"off"},
|
||||
"FunctionExpression": {"body":1, "parameters":"off"},
|
||||
"CallExpression": {"arguments":"off"},
|
||||
"ArrayExpression": 1,
|
||||
"ObjectExpression": 1,
|
||||
"ignoredNodes": ["ConditionalExpression"]
|
||||
}],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"no-dupe-keys": ["error"],
|
||||
"no-duplicate-case": ["error"],
|
||||
"no-extra-semi": ["warn"],
|
||||
"no-labels": ["error"],
|
||||
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
|
||||
"no-redeclare": ["warn"],
|
||||
"no-return-assign": ["error", "always"],
|
||||
"no-sequences": ["error"],
|
||||
"no-trailing-spaces": ["warn"],
|
||||
"no-undef": ["off"],
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// ^^Note: If this "no-undef" rule is enabled (set to `["error"]`), then all model globals
|
||||
// (e.g. `"Organization": true`) should be included above under "globals".
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
"no-unexpected-multiline": ["warn"],
|
||||
"no-unreachable": ["warn"],
|
||||
"no-unused-vars": ["warn", {"caughtErrors":"all", "caughtErrorsIgnorePattern": "^unused($|[A-Z].*$)", "argsIgnorePattern": "^unused($|[A-Z].*$)", "varsIgnorePattern": "^unused($|[A-Z].*$)" }],
|
||||
"no-use-before-define": ["error", {"functions":false}],
|
||||
"one-var": ["warn", "never"],
|
||||
"prefer-arrow-callback": ["warn", {"allowNamedFunctions":true}],
|
||||
"quotes": ["warn", "single", {"avoidEscape":false, "allowTemplateLiterals":true}],
|
||||
"semi": ["warn", "always"],
|
||||
"semi-spacing": ["warn", {"before":false, "after":true}],
|
||||
"semi-style": ["warn", "last"]
|
||||
}
|
||||
|
||||
}
|
|
@ -2,11 +2,11 @@ const bcrypt = require('bcrypt');
|
|||
|
||||
const Errors = {
|
||||
EMAIL_NOT_EXIST: {
|
||||
unauthorized: 'Email does not exist'
|
||||
unauthorized: 'Email does not exist',
|
||||
},
|
||||
PASSWORD_NOT_VALID: {
|
||||
unauthorized: 'Password is not valid'
|
||||
}
|
||||
unauthorized: 'Password is not valid',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -14,23 +14,23 @@ module.exports = {
|
|||
email: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
isEmail: true
|
||||
isEmail: true,
|
||||
},
|
||||
password: {
|
||||
type: 'string',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
unauthorized: {
|
||||
responseType: 'unauthorized'
|
||||
}
|
||||
responseType: 'unauthorized',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const user = await sails.helpers.getUser({
|
||||
email: inputs.email.toLowerCase()
|
||||
email: inputs.email.toLowerCase(),
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
|
@ -42,7 +42,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: sails.helpers.signToken(user.id)
|
||||
item: sails.helpers.signToken(user.id),
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
}
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,21 +9,21 @@ module.exports = {
|
|||
cardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
beforeId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/
|
||||
}
|
||||
regex: /^[0-9]+$/,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { project } = await sails.helpers
|
||||
|
@ -32,17 +32,14 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
throw Errors.CARD_NOT_FOUND; // Forbidden
|
||||
}
|
||||
|
||||
const actions = await sails.helpers.getActionsForCard(
|
||||
inputs.cardId,
|
||||
inputs.beforeId
|
||||
);
|
||||
const actions = await sails.helpers.getActionsForCard(inputs.cardId, inputs.beforeId);
|
||||
|
||||
const userIds = sails.helpers.mapRecords(actions, 'userId', true);
|
||||
const users = await sails.helpers.getUsers(userIds);
|
||||
|
@ -50,8 +47,8 @@ module.exports = {
|
|||
return exits.success({
|
||||
items: actions,
|
||||
included: {
|
||||
users
|
||||
}
|
||||
users,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
PROJECT_NOT_FOUND: {
|
||||
notFound: 'Project is not found'
|
||||
}
|
||||
notFound: 'Project is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,25 +9,25 @@ module.exports = {
|
|||
projectId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
position: {
|
||||
type: 'number',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const project = await Project.findOne(inputs.projectId);
|
||||
|
||||
if (!project) {
|
||||
|
@ -42,8 +42,8 @@ module.exports = {
|
|||
item: board,
|
||||
included: {
|
||||
lists: [],
|
||||
labels: []
|
||||
}
|
||||
labels: [],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
BOARD_NOT_FOUND: {
|
||||
notFound: 'Board is not found'
|
||||
}
|
||||
notFound: 'Board is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,17 +9,17 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
let board = await Board.findOne(inputs.id);
|
||||
|
||||
if (!board) {
|
||||
|
@ -33,7 +33,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: board
|
||||
item: board,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
BOARD_NOT_FOUND: {
|
||||
notFound: 'Board is not found'
|
||||
}
|
||||
notFound: 'Board is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,17 +9,17 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
// TODO: allow over HTTP without subscription
|
||||
if (!this.req.isSocket) {
|
||||
return this.res.badRequest();
|
||||
|
@ -33,7 +33,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -48,7 +48,7 @@ module.exports = {
|
|||
|
||||
const cardSubscriptions = await sails.helpers.getSubscriptionsByUserForCard(
|
||||
cardIds,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
const cardMemberships = await sails.helpers.getMembershipsForCard(cardIds);
|
||||
|
@ -59,12 +59,12 @@ module.exports = {
|
|||
const isSubscribedByCardId = cardSubscriptions.reduce(
|
||||
(result, cardSubscription) => ({
|
||||
...result,
|
||||
[cardSubscription.cardId]: true
|
||||
[cardSubscription.cardId]: true,
|
||||
}),
|
||||
{}
|
||||
{},
|
||||
);
|
||||
|
||||
cards.forEach(card => {
|
||||
cards.forEach((card) => {
|
||||
card.isSubscribed = isSubscribedByCardId[card.id] || false;
|
||||
});
|
||||
|
||||
|
@ -78,8 +78,8 @@ module.exports = {
|
|||
cards,
|
||||
cardMemberships,
|
||||
cardLabels,
|
||||
tasks
|
||||
}
|
||||
tasks,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
BOARD_NOT_FOUND: {
|
||||
notFound: 'Board is not found'
|
||||
}
|
||||
notFound: 'Board is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,24 +9,24 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
position: {
|
||||
type: 'number'
|
||||
type: 'number',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
}
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
let board = await Board.findOne(inputs.id);
|
||||
|
||||
if (!board) {
|
||||
|
@ -42,7 +42,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: board
|
||||
item: board,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
LABEL_NOT_FOUND: {
|
||||
notFound: 'Label is not found'
|
||||
notFound: 'Label is not found',
|
||||
},
|
||||
CARD_LABEL_EXIST: {
|
||||
conflict: 'Card label is already exist'
|
||||
}
|
||||
conflict: 'Card label is already exist',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -15,25 +15,25 @@ module.exports = {
|
|||
cardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
labelId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
responseType: 'notFound',
|
||||
},
|
||||
conflict: {
|
||||
responseType: 'conflict'
|
||||
}
|
||||
responseType: 'conflict',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { card, project } = await sails.helpers
|
||||
|
@ -42,7 +42,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -51,7 +51,7 @@ module.exports = {
|
|||
|
||||
const label = await Label.findOne({
|
||||
id: inputs.labelId,
|
||||
boardId: card.boardId
|
||||
boardId: card.boardId,
|
||||
});
|
||||
|
||||
if (!label) {
|
||||
|
@ -63,7 +63,7 @@ module.exports = {
|
|||
.intercept('conflict', () => Errors.CARD_LABEL_EXIST);
|
||||
|
||||
return exits.success({
|
||||
item: cardLabel
|
||||
item: cardLabel,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
CARD_LABEL_NOT_FOUND: {
|
||||
notFound: 'Card label is not found'
|
||||
}
|
||||
notFound: 'Card label is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -12,22 +12,22 @@ module.exports = {
|
|||
cardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
labelId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { board, project } = await sails.helpers
|
||||
|
@ -36,7 +36,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -45,7 +45,7 @@ module.exports = {
|
|||
|
||||
let cardLabel = await CardLabel.findOne({
|
||||
cardId: inputs.cardId,
|
||||
labelId: inputs.labelId
|
||||
labelId: inputs.labelId,
|
||||
});
|
||||
|
||||
if (!cardLabel) {
|
||||
|
@ -59,7 +59,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: cardLabel
|
||||
item: cardLabel,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
USER_NOT_FOUND: {
|
||||
notFound: 'User is not found'
|
||||
notFound: 'User is not found',
|
||||
},
|
||||
CARD_MEMBERSHIP_EXIST: {
|
||||
conflict: 'Card membership is already exist'
|
||||
}
|
||||
conflict: 'Card membership is already exist',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -15,25 +15,25 @@ module.exports = {
|
|||
cardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
responseType: 'notFound',
|
||||
},
|
||||
conflict: {
|
||||
responseType: 'conflict'
|
||||
}
|
||||
responseType: 'conflict',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { card, project } = await sails.helpers
|
||||
|
@ -42,17 +42,14 @@ module.exports = {
|
|||
|
||||
let isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
throw Errors.CARD_NOT_FOUND; // Forbidden
|
||||
}
|
||||
|
||||
isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
inputs.userId
|
||||
);
|
||||
isUserMemberForProject = await sails.helpers.isUserMemberForProject(project.id, inputs.userId);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
throw Errors.USER_NOT_FOUND;
|
||||
|
@ -63,7 +60,7 @@ module.exports = {
|
|||
.intercept('conflict', () => Errors.CARD_MEMBERSHIP_EXIST);
|
||||
|
||||
return exits.success({
|
||||
item: cardMembership
|
||||
item: cardMembership,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
CARD_MEMBERSHIP_NOT_FOUND: {
|
||||
notFound: 'Card membership is not found'
|
||||
}
|
||||
notFound: 'Card membership is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -12,22 +12,22 @@ module.exports = {
|
|||
cardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { board, project } = await sails.helpers
|
||||
|
@ -36,7 +36,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -45,25 +45,21 @@ module.exports = {
|
|||
|
||||
let cardMembership = await CardMembership.findOne({
|
||||
cardId: inputs.cardId,
|
||||
userId: inputs.userId
|
||||
userId: inputs.userId,
|
||||
});
|
||||
|
||||
if (!cardMembership) {
|
||||
throw Errors.CARD_MEMBERSHIP_NOT_FOUND;
|
||||
}
|
||||
|
||||
cardMembership = await sails.helpers.deleteCardMembership(
|
||||
cardMembership,
|
||||
board,
|
||||
this.req
|
||||
);
|
||||
cardMembership = await sails.helpers.deleteCardMembership(cardMembership, board, this.req);
|
||||
|
||||
if (!cardMembership) {
|
||||
throw Errors.CARD_MEMBERSHIP_NOT_FOUND;
|
||||
}
|
||||
|
||||
return exits.success({
|
||||
item: cardMembership
|
||||
item: cardMembership,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,8 +2,8 @@ const moment = require('moment');
|
|||
|
||||
const Errors = {
|
||||
LIST_NOT_FOUND: {
|
||||
notFound: 'List is not found'
|
||||
}
|
||||
notFound: 'List is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -11,43 +11,41 @@ module.exports = {
|
|||
listId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
position: {
|
||||
type: 'number',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true
|
||||
allowNull: true,
|
||||
},
|
||||
dueDate: {
|
||||
type: 'string',
|
||||
custom: value => moment(value, moment.ISO_8601, true).isValid()
|
||||
custom: (value) => moment(value, moment.ISO_8601, true).isValid(),
|
||||
},
|
||||
timer: {
|
||||
type: 'json',
|
||||
custom: value =>
|
||||
_.isPlainObject(value) &&
|
||||
_.size(value) === 2 &&
|
||||
(_.isNull(value.startedAt) ||
|
||||
moment(value.startedAt, moment.ISO_8601, true).isValid()) &&
|
||||
_.isFinite(value.total)
|
||||
}
|
||||
custom: (value) => _.isPlainObject(value)
|
||||
&& _.size(value) === 2
|
||||
&& (_.isNull(value.startedAt) || moment(value.startedAt, moment.ISO_8601, true).isValid())
|
||||
&& _.isFinite(value.total),
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { list, project } = await sails.helpers
|
||||
|
@ -56,30 +54,19 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
throw Errors.LIST_NOT_FOUND; // Forbidden
|
||||
}
|
||||
|
||||
const values = _.pick(inputs, [
|
||||
'position',
|
||||
'name',
|
||||
'description',
|
||||
'dueDate',
|
||||
'timer'
|
||||
]);
|
||||
const values = _.pick(inputs, ['position', 'name', 'description', 'dueDate', 'timer']);
|
||||
|
||||
const card = await sails.helpers.createCard(
|
||||
list,
|
||||
values,
|
||||
currentUser,
|
||||
this.req
|
||||
);
|
||||
const card = await sails.helpers.createCard(list, values, currentUser, this.req);
|
||||
|
||||
return exits.success({
|
||||
item: card
|
||||
item: card,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
}
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,26 +9,29 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { card, project } = await sails.helpers
|
||||
const cardToProjectPath = await sails.helpers
|
||||
.getCardToProjectPath(inputs.id)
|
||||
.intercept('notFound', () => Errors.CARD_NOT_FOUND);
|
||||
|
||||
let { card } = cardToProjectPath;
|
||||
const { project } = cardToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -42,7 +45,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: card
|
||||
item: card,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
}
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,17 +9,17 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { card, project } = await sails.helpers
|
||||
|
@ -28,7 +28,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -36,7 +36,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: card
|
||||
item: card,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,11 +2,11 @@ const moment = require('moment');
|
|||
|
||||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
LIST_NOT_FOUND: {
|
||||
notFound: 'List is not found'
|
||||
}
|
||||
notFound: 'List is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -14,59 +14,60 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
listId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/
|
||||
regex: /^[0-9]+$/,
|
||||
},
|
||||
position: {
|
||||
type: 'number'
|
||||
type: 'number',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true
|
||||
allowNull: true,
|
||||
},
|
||||
dueDate: {
|
||||
type: 'string',
|
||||
custom: value => moment(value, moment.ISO_8601, true).isValid(),
|
||||
allowNull: true
|
||||
custom: (value) => moment(value, moment.ISO_8601, true).isValid(),
|
||||
allowNull: true,
|
||||
},
|
||||
timer: {
|
||||
type: 'json',
|
||||
custom: value =>
|
||||
_.isPlainObject(value) &&
|
||||
_.size(value) === 2 &&
|
||||
(_.isNull(value.startedAt) ||
|
||||
moment(value.startedAt, moment.ISO_8601, true).isValid()) &&
|
||||
_.isFinite(value.total)
|
||||
custom: (value) => _.isPlainObject(value)
|
||||
&& _.size(value) === 2
|
||||
&& (_.isNull(value.startedAt) || moment(value.startedAt, moment.ISO_8601, true).isValid())
|
||||
&& _.isFinite(value.total),
|
||||
},
|
||||
isSubscribed: {
|
||||
type: 'boolean'
|
||||
}
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { card, list, project } = await sails.helpers
|
||||
const cardToProjectPath = await sails.helpers
|
||||
.getCardToProjectPath(inputs.id)
|
||||
.intercept('notFound', () => Errors.CARD_NOT_FOUND);
|
||||
|
||||
let { card } = cardToProjectPath;
|
||||
const { list, project } = cardToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -77,7 +78,7 @@ module.exports = {
|
|||
if (!_.isUndefined(inputs.listId) && inputs.listId !== list.id) {
|
||||
toList = await List.findOne({
|
||||
id: inputs.listId,
|
||||
boardId: card.boardId
|
||||
boardId: card.boardId,
|
||||
});
|
||||
|
||||
if (!toList) {
|
||||
|
@ -91,24 +92,17 @@ module.exports = {
|
|||
'description',
|
||||
'dueDate',
|
||||
'timer',
|
||||
'isSubscribed'
|
||||
'isSubscribed',
|
||||
]);
|
||||
|
||||
card = await sails.helpers.updateCard(
|
||||
card,
|
||||
values,
|
||||
toList,
|
||||
list,
|
||||
currentUser,
|
||||
this.req
|
||||
);
|
||||
card = await sails.helpers.updateCard(card, values, toList, list, currentUser, this.req);
|
||||
|
||||
if (!card) {
|
||||
throw Errors.CARD_NOT_FOUND;
|
||||
}
|
||||
|
||||
return exits.success({
|
||||
item: card
|
||||
item: card,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
}
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,21 +9,21 @@ module.exports = {
|
|||
cardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
text: {
|
||||
type: 'string',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { card, project } = await sails.helpers
|
||||
|
@ -32,7 +32,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -41,13 +41,13 @@ module.exports = {
|
|||
|
||||
const values = {
|
||||
type: 'commentCard',
|
||||
data: _.pick(inputs, ['text'])
|
||||
data: _.pick(inputs, ['text']),
|
||||
};
|
||||
|
||||
const action = await sails.helpers.createAction(card, currentUser, values, this.req);
|
||||
|
||||
return exits.success({
|
||||
item: action
|
||||
item: action,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
COMMENT_ACTION_NOT_FOUND: {
|
||||
notFound: 'Comment action is not found'
|
||||
}
|
||||
notFound: 'Comment action is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,35 +9,38 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const criteria = {
|
||||
id: inputs.id,
|
||||
type: 'commentCard'
|
||||
type: 'commentCard',
|
||||
};
|
||||
|
||||
if (!currentUser.isAdmin) {
|
||||
criteria.userId = currentUser.id;
|
||||
}
|
||||
|
||||
let { action, board, project } = await sails.helpers
|
||||
const actionToProjectPath = await sails.helpers
|
||||
.getActionToProjectPath(criteria)
|
||||
.intercept('notFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
|
||||
|
||||
let { action } = actionToProjectPath;
|
||||
const { board, project } = actionToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -51,7 +54,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: action
|
||||
item: action,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
COMMENT_ACTION_NOT_FOUND: {
|
||||
notFound: 'Comment action is not found'
|
||||
}
|
||||
notFound: 'Comment action is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,34 +9,37 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
text: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
}
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { action, board, project } = await sails.helpers
|
||||
const actionToProjectPath = await sails.helpers
|
||||
.getActionToProjectPath({
|
||||
id: inputs.id,
|
||||
type: 'commentCard',
|
||||
userId: currentUser.id
|
||||
userId: currentUser.id,
|
||||
})
|
||||
.intercept('notFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
|
||||
|
||||
let { action } = actionToProjectPath;
|
||||
const { board, project } = actionToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -44,7 +47,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
const values = {
|
||||
data: _.pick(inputs, ['text'])
|
||||
data: _.pick(inputs, ['text']),
|
||||
};
|
||||
|
||||
action = await sails.helpers.updateAction(action, values, board, this.req);
|
||||
|
@ -54,7 +57,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: action
|
||||
item: action,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
BOARD_NOT_FOUND: {
|
||||
notFound: 'Board is not found'
|
||||
}
|
||||
notFound: 'Board is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,27 +9,27 @@ module.exports = {
|
|||
boardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true
|
||||
allowNull: true,
|
||||
},
|
||||
color: {
|
||||
type: 'string',
|
||||
isIn: Label.COLORS,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { board, project } = await sails.helpers
|
||||
|
@ -38,7 +38,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -50,7 +50,7 @@ module.exports = {
|
|||
const label = await sails.helpers.createLabel(board, values, this.req);
|
||||
|
||||
return exits.success({
|
||||
item: label
|
||||
item: label,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
LABEL_NOT_FOUND: {
|
||||
notFound: 'Label is not found'
|
||||
}
|
||||
notFound: 'Label is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,26 +9,29 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { label, project } = await sails.helpers
|
||||
const labelToProjectPath = await sails.helpers
|
||||
.getLabelToProjectPath(inputs.id)
|
||||
.intercept('notFound', () => Errors.LABEL_NOT_FOUND);
|
||||
|
||||
let { label } = labelToProjectPath;
|
||||
const { project } = labelToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -42,7 +45,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: label
|
||||
item: label,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
LABEL_NOT_FOUND: {
|
||||
notFound: 'Label is not found'
|
||||
}
|
||||
notFound: 'Label is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,36 +9,39 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true
|
||||
allowNull: true,
|
||||
},
|
||||
color: {
|
||||
type: 'string',
|
||||
isIn: Label.COLORS,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { label, project } = await sails.helpers
|
||||
const labelToProjectPath = await sails.helpers
|
||||
.getLabelToProjectPath(inputs.id)
|
||||
.intercept('notFound', () => Errors.LABEL_NOT_FOUND);
|
||||
|
||||
let { label } = labelToProjectPath;
|
||||
const { project } = labelToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -50,7 +53,7 @@ module.exports = {
|
|||
label = await sails.helpers.updateLabel(label, values, this.req);
|
||||
|
||||
return exits.success({
|
||||
item: label
|
||||
item: label,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
BOARD_NOT_FOUND: {
|
||||
notFound: 'Board is not found'
|
||||
}
|
||||
notFound: 'Board is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,25 +9,25 @@ module.exports = {
|
|||
boardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
position: {
|
||||
type: 'number',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { board, project } = await sails.helpers
|
||||
|
@ -36,7 +36,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -48,7 +48,7 @@ module.exports = {
|
|||
const list = await sails.helpers.createList(board, values, this.req);
|
||||
|
||||
return exits.success({
|
||||
item: list
|
||||
item: list,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
LIST_NOT_FOUND: {
|
||||
notFound: 'List is not found'
|
||||
}
|
||||
notFound: 'List is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,26 +9,29 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { list, project } = await sails.helpers
|
||||
const listToProjectPath = await sails.helpers
|
||||
.getListToProjectPath(inputs.id)
|
||||
.intercept('notFound', () => Errors.LIST_NOT_FOUND);
|
||||
|
||||
let { list } = listToProjectPath;
|
||||
const { project } = listToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -42,7 +45,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: list
|
||||
item: list,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
LIST_NOT_FOUND: {
|
||||
notFound: 'List is not found'
|
||||
}
|
||||
notFound: 'List is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,33 +9,36 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
position: {
|
||||
type: 'number'
|
||||
type: 'number',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
}
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { list, project } = await sails.helpers
|
||||
const listToProjectPath = await sails.helpers
|
||||
.getListToProjectPath(inputs.id)
|
||||
.intercept('notFound', () => Errors.LIST_NOT_FOUND);
|
||||
|
||||
let { list } = listToProjectPath;
|
||||
const { project } = listToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -51,7 +54,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: list
|
||||
item: list,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
module.exports = {
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const notifications = await sails.helpers.getNotificationsForUser(
|
||||
currentUser.id
|
||||
);
|
||||
const notifications = await sails.helpers.getNotificationsForUser(currentUser.id);
|
||||
|
||||
const actionIds = sails.helpers.mapRecords(notifications, 'actionId');
|
||||
const actions = await sails.helpers.getActions(actionIds);
|
||||
|
@ -20,8 +18,8 @@ module.exports = {
|
|||
included: {
|
||||
users,
|
||||
cards,
|
||||
actions
|
||||
}
|
||||
actions,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,20 +3,20 @@ module.exports = {
|
|||
ids: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
regex: /^[0-9]+(,[0-9]+)*$/
|
||||
regex: /^[0-9]+(,[0-9]+)*$/,
|
||||
},
|
||||
isRead: {
|
||||
type: 'boolean'
|
||||
}
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const values = _.pick(inputs, ['isRead']);
|
||||
|
@ -25,11 +25,11 @@ module.exports = {
|
|||
inputs.ids.split(','),
|
||||
currentUser,
|
||||
values,
|
||||
this.req
|
||||
this.req,
|
||||
);
|
||||
|
||||
return exits.success({
|
||||
items: notifications
|
||||
items: notifications,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
const Errors = {
|
||||
PROJECT_NOT_FOUND: {
|
||||
notFound: 'Project is not found'
|
||||
notFound: 'Project is not found',
|
||||
},
|
||||
USER_NOT_FOUND: {
|
||||
notFound: 'User is not found'
|
||||
notFound: 'User is not found',
|
||||
},
|
||||
PROJECT_MEMBERSHIP_EXIST: {
|
||||
conflict: 'Project membership is already exist'
|
||||
}
|
||||
conflict: 'Project membership is already exist',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -15,25 +15,25 @@ module.exports = {
|
|||
projectId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
responseType: 'notFound',
|
||||
},
|
||||
conflict: {
|
||||
responseType: 'conflict'
|
||||
}
|
||||
responseType: 'conflict',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const project = await Project.findOne(inputs.projectId);
|
||||
|
||||
if (!project) {
|
||||
|
@ -53,8 +53,8 @@ module.exports = {
|
|||
return exits.success({
|
||||
item: projectMembership,
|
||||
included: {
|
||||
users: [user]
|
||||
}
|
||||
users: [user],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
PROJECT_MEMBERSHIP_NOT_FOUND: {
|
||||
notFound: 'Project membership is not found'
|
||||
}
|
||||
notFound: 'Project membership is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,34 +9,31 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
let projectMembership = await ProjectMembership.findOne(inputs.id);
|
||||
|
||||
if (!projectMembership) {
|
||||
throw Errors.PROJECT_MEMBERSHIP_NOT_FOUND;
|
||||
}
|
||||
|
||||
projectMembership = await sails.helpers.deleteProjectMembership(
|
||||
projectMembership,
|
||||
this.req
|
||||
);
|
||||
projectMembership = await sails.helpers.deleteProjectMembership(projectMembership, this.req);
|
||||
|
||||
if (!projectMembership) {
|
||||
throw Errors.PROJECT_MEMBERSHIP_NOT_FOUND;
|
||||
}
|
||||
|
||||
return exits.success({
|
||||
item: projectMembership
|
||||
item: projectMembership,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,11 +2,11 @@ module.exports = {
|
|||
inputs: {
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const values = _.pick(inputs, ['name']);
|
||||
|
@ -15,7 +15,7 @@ module.exports = {
|
|||
values,
|
||||
currentUser,
|
||||
this.req,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
return exits.success({
|
||||
|
@ -23,8 +23,8 @@ module.exports = {
|
|||
included: {
|
||||
users: [currentUser],
|
||||
projectMemberships: [projectMembership],
|
||||
boards: []
|
||||
}
|
||||
boards: [],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
PROJECT_NOT_FOUND: {
|
||||
notFound: 'Project is not found'
|
||||
}
|
||||
notFound: 'Project is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,17 +9,17 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
let project = await Project.findOne(inputs.id);
|
||||
|
||||
if (!project) {
|
||||
|
@ -33,7 +33,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: project
|
||||
item: project,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
module.exports = {
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const projectIds = await sails.helpers.getMembershipProjectIdsForUser(
|
||||
currentUser.id
|
||||
);
|
||||
const projectIds = await sails.helpers.getMembershipProjectIdsForUser(currentUser.id);
|
||||
|
||||
const projects = await sails.helpers.getProjects(projectIds);
|
||||
|
||||
const {
|
||||
userIds,
|
||||
projectMemberships
|
||||
} = await sails.helpers.getMembershipUserIdsForProject(projectIds, true);
|
||||
const { userIds, projectMemberships } = await sails.helpers.getMembershipUserIdsForProject(
|
||||
projectIds,
|
||||
true,
|
||||
);
|
||||
|
||||
const users = await sails.helpers.getUsers(userIds);
|
||||
|
||||
|
@ -22,8 +20,8 @@ module.exports = {
|
|||
included: {
|
||||
users,
|
||||
projectMemberships,
|
||||
boards
|
||||
}
|
||||
boards,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
PROJECT_NOT_FOUND: {
|
||||
notFound: 'Project is not found'
|
||||
}
|
||||
notFound: 'Project is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,21 +9,21 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
}
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
let project = await Project.findOne(inputs.id);
|
||||
|
||||
if (!project) {
|
||||
|
@ -39,7 +39,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: project
|
||||
item: project,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
CARD_NOT_FOUND: {
|
||||
notFound: 'Card is not found'
|
||||
}
|
||||
notFound: 'Card is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,24 +9,24 @@ module.exports = {
|
|||
cardId: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
isCompleted: {
|
||||
type: 'boolean'
|
||||
}
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const { card, project } = await sails.helpers
|
||||
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -47,7 +47,7 @@ module.exports = {
|
|||
const task = await sails.helpers.createTask(card, values, this.req);
|
||||
|
||||
return exits.success({
|
||||
item: task
|
||||
item: task,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
TASK_NOT_FOUND: {
|
||||
notFound: 'Task is not found'
|
||||
}
|
||||
notFound: 'Task is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,26 +9,29 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { task, board, project } = await sails.helpers
|
||||
const taskToProjectPath = await sails.helpers
|
||||
.getTaskToProjectPath(inputs.id)
|
||||
.intercept('notFound', () => Errors.TASK_NOT_FOUND);
|
||||
|
||||
let { task } = taskToProjectPath;
|
||||
const { board, project } = taskToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -42,7 +45,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: task
|
||||
item: task,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
TASK_NOT_FOUND: {
|
||||
notFound: 'Task is not found'
|
||||
}
|
||||
notFound: 'Task is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,33 +9,36 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
isCompleted: {
|
||||
type: 'boolean'
|
||||
}
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let { task, board, project } = await sails.helpers
|
||||
const taskToProjectPath = await sails.helpers
|
||||
.getTaskToProjectPath(inputs.id)
|
||||
.intercept('notFound', () => Errors.TASK_NOT_FOUND);
|
||||
|
||||
let { task } = taskToProjectPath;
|
||||
const { board, project } = taskToProjectPath;
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
|
@ -51,7 +54,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: task
|
||||
item: task,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
USER_EXIST: {
|
||||
conflict: 'User is already exist'
|
||||
}
|
||||
conflict: 'User is already exist',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,25 +9,25 @@ module.exports = {
|
|||
email: {
|
||||
type: 'string',
|
||||
isEmail: true,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
password: {
|
||||
type: 'string',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
conflict: {
|
||||
responseType: 'conflict'
|
||||
}
|
||||
responseType: 'conflict',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const values = _.pick(inputs, ['email', 'password', 'name']);
|
||||
|
||||
const user = await sails.helpers
|
||||
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
.intercept('conflict', () => Errors.USER_EXIST);
|
||||
|
||||
return exits.success({
|
||||
item: user
|
||||
item: user,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
USER_NOT_FOUND: {
|
||||
notFound: 'User is not found'
|
||||
}
|
||||
notFound: 'User is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,17 +9,17 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
let user = await sails.helpers.getUser(inputs.id);
|
||||
|
||||
if (!user) {
|
||||
|
@ -33,7 +33,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: user
|
||||
item: user,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module.exports = {
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const users = await sails.helpers.getUsers();
|
||||
|
||||
return exits.success({
|
||||
items: users
|
||||
items: users,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
// TODO: allow over HTTP without subscription
|
||||
if (!this.req.isSocket) {
|
||||
return this.res.badRequest();
|
||||
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
sails.sockets.join(this.req, `user:${currentUser.id}`); // TODO: only when subscription needed
|
||||
|
||||
return exits.success({
|
||||
item: currentUser
|
||||
item: currentUser,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,14 +2,14 @@ const bcrypt = require('bcrypt');
|
|||
|
||||
const Errors = {
|
||||
USER_NOT_FOUND: {
|
||||
notFound: 'User is not found'
|
||||
notFound: 'User is not found',
|
||||
},
|
||||
CURRENT_PASSWORD_NOT_VALID: {
|
||||
forbidden: 'Current password is not valid'
|
||||
forbidden: 'Current password is not valid',
|
||||
},
|
||||
USER_EXIST: {
|
||||
conflict: 'User is already exist'
|
||||
}
|
||||
conflict: 'User is already exist',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -17,32 +17,32 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
email: {
|
||||
type: 'string',
|
||||
isEmail: true,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
currentPassword: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
}
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
responseType: 'notFound',
|
||||
},
|
||||
forbidden: {
|
||||
responseType: 'forbidden'
|
||||
responseType: 'forbidden',
|
||||
},
|
||||
conflict: {
|
||||
responseType: 'conflict'
|
||||
}
|
||||
responseType: 'conflict',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
if (inputs.id === currentUser.id) {
|
||||
|
@ -60,8 +60,8 @@ module.exports = {
|
|||
}
|
||||
|
||||
if (
|
||||
inputs.id === currentUser.id &&
|
||||
!bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
inputs.id === currentUser.id
|
||||
&& !bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
) {
|
||||
throw Errors.CURRENT_PASSWORD_NOT_VALID;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: user.email
|
||||
item: user.email,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,11 +2,11 @@ const bcrypt = require('bcrypt');
|
|||
|
||||
const Errors = {
|
||||
USER_NOT_FOUND: {
|
||||
notFound: 'User is not found'
|
||||
notFound: 'User is not found',
|
||||
},
|
||||
CURRENT_PASSWORD_NOT_VALID: {
|
||||
forbidden: 'Current password is not valid'
|
||||
}
|
||||
forbidden: 'Current password is not valid',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -14,28 +14,28 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
password: {
|
||||
type: 'string',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
currentPassword: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
}
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
responseType: 'notFound',
|
||||
},
|
||||
forbidden: {
|
||||
responseType: 'forbidden'
|
||||
}
|
||||
responseType: 'forbidden',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
if (inputs.id === currentUser.id) {
|
||||
|
@ -53,8 +53,8 @@ module.exports = {
|
|||
}
|
||||
|
||||
if (
|
||||
inputs.id === currentUser.id &&
|
||||
!bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
inputs.id === currentUser.id
|
||||
&& !bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
) {
|
||||
throw Errors.CURRENT_PASSWORD_NOT_VALID;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: null
|
||||
item: null,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Errors = {
|
||||
USER_NOT_FOUND: {
|
||||
notFound: 'User is not found'
|
||||
}
|
||||
notFound: 'User is not found',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,28 +9,28 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
isAdmin: {
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
avatar: {
|
||||
type: 'json',
|
||||
custom: value => _.isNull(value)
|
||||
}
|
||||
custom: (value) => _.isNull(value),
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
}
|
||||
responseType: 'notFound',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
if (!currentUser.isAdmin) {
|
||||
|
@ -56,7 +56,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
return exits.success({
|
||||
item: user
|
||||
item: user,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,27 +1,31 @@
|
|||
const stream = require('stream');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
const stream = require('stream');
|
||||
const uuid = require('uuid/v4');
|
||||
const sharp = require('sharp');
|
||||
|
||||
const Errors = {
|
||||
USER_NOT_FOUND: {
|
||||
notFound: 'User is not found'
|
||||
}
|
||||
notFound: 'User is not found',
|
||||
},
|
||||
};
|
||||
|
||||
const pipeline = util.promisify(stream.pipeline);
|
||||
|
||||
const createReceiver = () => {
|
||||
const receiver = require('stream').Writable({ objectMode: true });
|
||||
const receiver = stream.Writable({ objectMode: true });
|
||||
|
||||
let firstFileHandled = false;
|
||||
receiver._write = (file, encoding, done) => {
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
receiver._write = async (file, receiverEncoding, done) => {
|
||||
if (firstFileHandled) {
|
||||
file.pipe(
|
||||
new stream.Writable({
|
||||
write(chunk, encoding, callback) {
|
||||
write(chunk, streamEncoding, callback) {
|
||||
callback();
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
return done();
|
||||
|
@ -33,30 +37,25 @@ const createReceiver = () => {
|
|||
.jpeg();
|
||||
|
||||
const transform = new stream.Transform({
|
||||
transform(chunk, encoding, callback) {
|
||||
transform(chunk, streamEncoding, callback) {
|
||||
callback(null, chunk);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
stream.pipeline(file, resize, transform, error => {
|
||||
if (error) {
|
||||
return done(error.message);
|
||||
}
|
||||
try {
|
||||
await pipeline(file, resize, transform);
|
||||
|
||||
file.fd = `${uuid()}.jpg`;
|
||||
|
||||
const output = fs.createWriteStream(
|
||||
path.join(sails.config.custom.uploadsPath, file.fd)
|
||||
await pipeline(
|
||||
transform,
|
||||
fs.createWriteStream(path.join(sails.config.custom.uploadsPath, file.fd)),
|
||||
);
|
||||
|
||||
stream.pipeline(transform, output, error => {
|
||||
if (error) {
|
||||
return done(error);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
return done();
|
||||
} catch (error) {
|
||||
return done(error);
|
||||
}
|
||||
};
|
||||
|
||||
return receiver;
|
||||
|
@ -67,20 +66,20 @@ module.exports = {
|
|||
id: {
|
||||
type: 'string',
|
||||
regex: /^[0-9]+$/,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {
|
||||
responseType: 'notFound'
|
||||
responseType: 'notFound',
|
||||
},
|
||||
unprocessableEntity: {
|
||||
responseType: 'unprocessableEntity'
|
||||
}
|
||||
responseType: 'unprocessableEntity',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
let user;
|
||||
|
@ -98,7 +97,7 @@ module.exports = {
|
|||
|
||||
this.req.file('file').upload(createReceiver(), async (error, files) => {
|
||||
if (error) {
|
||||
return exits.unprocessableEntity(error);
|
||||
return exits.unprocessableEntity(error.message);
|
||||
}
|
||||
|
||||
if (files.length === 0) {
|
||||
|
@ -108,18 +107,18 @@ module.exports = {
|
|||
user = await sails.helpers.updateUser(
|
||||
user,
|
||||
{
|
||||
avatar: files[0].fd
|
||||
avatar: files[0].fd,
|
||||
},
|
||||
this.req
|
||||
this.req,
|
||||
);
|
||||
|
||||
if (!user) {
|
||||
throw Errors.USER_NOT_FOUND;
|
||||
}
|
||||
|
||||
return this.res.json({
|
||||
item: user.avatar
|
||||
return exits.success({
|
||||
item: user.toJSON().avatar,
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,47 +2,44 @@ module.exports = {
|
|||
inputs: {
|
||||
card: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const action = await Action.create({
|
||||
...inputs.values,
|
||||
cardId: inputs.card.id,
|
||||
userId: inputs.user.id
|
||||
userId: inputs.user.id,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`board:${inputs.card.boardId}`,
|
||||
'actionCreate',
|
||||
{
|
||||
item: action
|
||||
item: action,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
const userIds = await sails.helpers.getSubscriptionUserIdsForCard(
|
||||
action.cardId,
|
||||
action.userId
|
||||
);
|
||||
const userIds = await sails.helpers.getSubscriptionUserIdsForCard(action.cardId, action.userId);
|
||||
|
||||
userIds.forEach(async userId => {
|
||||
userIds.forEach(async (userId) => {
|
||||
const notification = await Notification.create({
|
||||
userId,
|
||||
actionId: action.id,
|
||||
cardId: action.cardId
|
||||
cardId: action.cardId,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(`user:${userId}`, 'notificationCreate', {
|
||||
|
@ -50,11 +47,11 @@ module.exports = {
|
|||
included: {
|
||||
users: [inputs.user],
|
||||
cards: [inputs.card],
|
||||
actions: [action]
|
||||
}
|
||||
actions: [action],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
return exits.success(action);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,44 +2,42 @@ module.exports = {
|
|||
inputs: {
|
||||
project: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true
|
||||
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const boards = await sails.helpers.getBoardsForProject(inputs.project.id);
|
||||
|
||||
const { position, repositions } = sails.helpers.insertToPositionables(
|
||||
inputs.values.position,
|
||||
boards
|
||||
boards,
|
||||
);
|
||||
|
||||
const userIds = await sails.helpers.getMembershipUserIdsForProject(
|
||||
inputs.project.id
|
||||
);
|
||||
const userIds = await sails.helpers.getMembershipUserIdsForProject(inputs.project.id);
|
||||
|
||||
repositions.forEach(async ({ id, position }) => {
|
||||
repositions.forEach(async ({ id, position: nextPosition }) => {
|
||||
await Board.update({
|
||||
id,
|
||||
projectId: inputs.project.id
|
||||
projectId: inputs.project.id,
|
||||
}).set({
|
||||
position
|
||||
position: nextPosition,
|
||||
});
|
||||
|
||||
userIds.forEach(userId => {
|
||||
userIds.forEach((userId) => {
|
||||
sails.sockets.broadcast(`user:${userId}`, 'boardUpdate', {
|
||||
item: {
|
||||
id,
|
||||
position
|
||||
}
|
||||
position: nextPosition,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -47,10 +45,10 @@ module.exports = {
|
|||
const board = await Board.create({
|
||||
...inputs.values,
|
||||
position,
|
||||
projectId: inputs.project.id
|
||||
projectId: inputs.project.id,
|
||||
}).fetch();
|
||||
|
||||
userIds.forEach(userId => {
|
||||
userIds.forEach((userId) => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'boardCreate',
|
||||
|
@ -58,13 +56,13 @@ module.exports = {
|
|||
item: board,
|
||||
included: {
|
||||
lists: [],
|
||||
labels: []
|
||||
}
|
||||
labels: [],
|
||||
},
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
});
|
||||
|
||||
return exits.success(board);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,21 +2,21 @@ module.exports = {
|
|||
inputs: {
|
||||
card: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
label: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const cardLabel = await CardLabel.create({
|
||||
cardId: inputs.card.id,
|
||||
labelId: inputs.label.id
|
||||
labelId: inputs.label.id,
|
||||
})
|
||||
.intercept('E_UNIQUE', 'conflict')
|
||||
.fetch();
|
||||
|
@ -25,11 +25,11 @@ module.exports = {
|
|||
`board:${inputs.card.boardId}`,
|
||||
'cardLabelCreate',
|
||||
{
|
||||
item: cardLabel
|
||||
item: cardLabel,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
return exits.success(cardLabel);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,24 +2,24 @@ module.exports = {
|
|||
inputs: {
|
||||
card: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
userOrUserId: {
|
||||
type: 'ref',
|
||||
custom: value => _.isPlainObject(value) || _.isString(value),
|
||||
required: true
|
||||
custom: (value) => _.isPlainObject(value) || _.isString(value),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const { userId = inputs.userOrUserId } = inputs.userOrUserId;
|
||||
|
||||
const cardMembership = await CardMembership.create({
|
||||
userId,
|
||||
cardId: inputs.card.id
|
||||
cardId: inputs.card.id,
|
||||
})
|
||||
.intercept('E_UNIQUE', 'conflict')
|
||||
.fetch();
|
||||
|
@ -28,15 +28,15 @@ module.exports = {
|
|||
`board:${inputs.card.boardId}`,
|
||||
'cardMembershipCreate',
|
||||
{
|
||||
item: cardMembership
|
||||
item: cardMembership,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
const cardSubscription = await CardSubscription.create({
|
||||
cardId: cardMembership.cardId,
|
||||
userId: cardMembership.userId,
|
||||
isPermanent: false
|
||||
isPermanent: false,
|
||||
})
|
||||
.tolerate('E_UNIQUE')
|
||||
.fetch();
|
||||
|
@ -48,13 +48,13 @@ module.exports = {
|
|||
{
|
||||
item: {
|
||||
id: cardMembership.cardId,
|
||||
isSubscribed: true
|
||||
}
|
||||
isSubscribed: true,
|
||||
},
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
}
|
||||
|
||||
return exits.success(cardMembership);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,43 +2,43 @@ module.exports = {
|
|||
inputs: {
|
||||
list: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true
|
||||
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const cards = await sails.helpers.getCardsForList(inputs.list.id);
|
||||
|
||||
const { position, repositions } = sails.helpers.insertToPositionables(
|
||||
inputs.values.position,
|
||||
cards
|
||||
cards,
|
||||
);
|
||||
|
||||
repositions.forEach(async ({ id, position }) => {
|
||||
repositions.forEach(async ({ id, position: nextPosition }) => {
|
||||
await Card.update({
|
||||
id,
|
||||
listId: inputs.list.id
|
||||
listId: inputs.list.id,
|
||||
}).set({
|
||||
position
|
||||
position: nextPosition,
|
||||
});
|
||||
|
||||
sails.sockets.broadcast(`board:${list.boardId}`, 'cardUpdate', {
|
||||
item: {
|
||||
id,
|
||||
position
|
||||
}
|
||||
position: nextPosition,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -46,27 +46,27 @@ module.exports = {
|
|||
...inputs.values,
|
||||
position,
|
||||
listId: inputs.list.id,
|
||||
boardId: inputs.list.boardId
|
||||
boardId: inputs.list.boardId,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`board:${card.boardId}`,
|
||||
'cardCreate',
|
||||
{
|
||||
item: card
|
||||
item: card,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
const values = {
|
||||
type: 'createCard',
|
||||
data: {
|
||||
list: _.pick(inputs.list, ['id', 'name'])
|
||||
}
|
||||
list: _.pick(inputs.list, ['id', 'name']),
|
||||
},
|
||||
};
|
||||
|
||||
await sails.helpers.createAction(card, inputs.user, values);
|
||||
|
||||
return exits.success(card);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,32 +2,32 @@ module.exports = {
|
|||
inputs: {
|
||||
board: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const label = await Label.create({
|
||||
...inputs.values,
|
||||
boardId: inputs.board.id
|
||||
boardId: inputs.board.id,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`board:${label.boardId}`,
|
||||
'labelCreate',
|
||||
{
|
||||
item: label
|
||||
item: label,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
return exits.success(label);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,57 +2,57 @@ module.exports = {
|
|||
inputs: {
|
||||
board: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true
|
||||
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const lists = await sails.helpers.getListsForBoard(inputs.board.id);
|
||||
|
||||
const { position, repositions } = sails.helpers.insertToPositionables(
|
||||
inputs.values.position,
|
||||
lists
|
||||
lists,
|
||||
);
|
||||
|
||||
repositions.forEach(async ({ id, position }) => {
|
||||
repositions.forEach(async ({ id, position: nextPosition }) => {
|
||||
await List.update({
|
||||
id,
|
||||
boardId: inputs.board.id
|
||||
boardId: inputs.board.id,
|
||||
}).set({
|
||||
position
|
||||
position: nextPosition,
|
||||
});
|
||||
|
||||
sails.sockets.broadcast(`board:${inputs.board.id}`, 'listUpdate', {
|
||||
item: {
|
||||
id,
|
||||
position
|
||||
}
|
||||
position: nextPosition,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
const list = await List.create({
|
||||
...inputs.values,
|
||||
position,
|
||||
boardId: inputs.board.id
|
||||
boardId: inputs.board.id,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`board:${list.boardId}`,
|
||||
'listCreate',
|
||||
{
|
||||
item: list
|
||||
item: list,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
return exits.success(list);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,38 +2,35 @@ module.exports = {
|
|||
inputs: {
|
||||
project: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
conflict: {}
|
||||
conflict: {},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const projectMembership = await ProjectMembership.create({
|
||||
projectId: inputs.project.id,
|
||||
userId: inputs.user.id
|
||||
userId: inputs.user.id,
|
||||
})
|
||||
.intercept('E_UNIQUE', 'conflict')
|
||||
.fetch();
|
||||
|
||||
const {
|
||||
userIds,
|
||||
projectMemberships
|
||||
} = await sails.helpers.getMembershipUserIdsForProject(
|
||||
const { userIds, projectMemberships } = await sails.helpers.getMembershipUserIdsForProject(
|
||||
projectMembership.projectId,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
userIds.forEach(userId => {
|
||||
userIds.forEach((userId) => {
|
||||
if (userId !== projectMembership.userId) {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
|
@ -41,33 +38,27 @@ module.exports = {
|
|||
{
|
||||
item: projectMembership,
|
||||
included: {
|
||||
users: [inputs.user]
|
||||
}
|
||||
users: [inputs.user],
|
||||
},
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
const users = await sails.helpers.getUsers(userIds);
|
||||
|
||||
const boards = await sails.helpers.getBoardsForProject(
|
||||
projectMembership.projectId
|
||||
);
|
||||
const boards = await sails.helpers.getBoardsForProject(projectMembership.projectId);
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`user:${projectMembership.userId}`,
|
||||
'projectCreate',
|
||||
{
|
||||
item: inputs.project,
|
||||
included: {
|
||||
users,
|
||||
projectMemberships,
|
||||
boards
|
||||
}
|
||||
}
|
||||
);
|
||||
sails.sockets.broadcast(`user:${projectMembership.userId}`, 'projectCreate', {
|
||||
item: inputs.project,
|
||||
included: {
|
||||
users,
|
||||
projectMemberships,
|
||||
boards,
|
||||
},
|
||||
});
|
||||
|
||||
return exits.success(projectMembership);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,27 +2,27 @@ module.exports = {
|
|||
inputs: {
|
||||
values: {
|
||||
type: 'json',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
type: 'ref',
|
||||
},
|
||||
withProjectMembership: {
|
||||
type: 'boolean',
|
||||
defaultsTo: false
|
||||
}
|
||||
defaultsTo: false,
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const project = await Project.create(inputs.values).fetch();
|
||||
|
||||
const projectMembership = await ProjectMembership.create({
|
||||
projectId: project.id,
|
||||
userId: inputs.user.id
|
||||
userId: inputs.user.id,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
|
@ -33,19 +33,19 @@ module.exports = {
|
|||
included: {
|
||||
users: [inputs.user],
|
||||
projectMemberships: [projectMembership],
|
||||
boards: []
|
||||
}
|
||||
boards: [],
|
||||
},
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
return exits.success(
|
||||
inputs.withProjectMembership
|
||||
? {
|
||||
project,
|
||||
projectMembership
|
||||
projectMembership,
|
||||
}
|
||||
: project
|
||||
: project,
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,32 +2,32 @@ module.exports = {
|
|||
inputs: {
|
||||
card: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const task = await Task.create({
|
||||
...inputs.values,
|
||||
cardId: inputs.card.id
|
||||
cardId: inputs.card.id,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`board:${inputs.card.boardId}`,
|
||||
'taskCreate',
|
||||
{
|
||||
item: task
|
||||
item: task,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
return exits.success(task);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -4,45 +4,47 @@ module.exports = {
|
|||
inputs: {
|
||||
values: {
|
||||
type: 'json',
|
||||
custom: value =>
|
||||
_.isPlainObject(value) &&
|
||||
_.isString(value.email) &&
|
||||
_.isString(value.password),
|
||||
required: true
|
||||
// eslint-disable-next-line max-len
|
||||
custom: (value) => _.isPlainObject(value) && _.isString(value.email) && _.isString(value.password),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
conflict: {}
|
||||
conflict: {},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const user = await User.create({
|
||||
...inputs.values,
|
||||
email: inputs.values.email.toLowerCase(),
|
||||
password: bcrypt.hashSync(inputs.values.password, 10)
|
||||
password: bcrypt.hashSync(inputs.values.password, 10),
|
||||
})
|
||||
.intercept({
|
||||
message: 'Unexpected error from database adapter: conflicting key value violates exclusion constraint "user_email_unique"'
|
||||
}, 'conflict')
|
||||
.intercept(
|
||||
{
|
||||
message:
|
||||
'Unexpected error from database adapter: conflicting key value violates exclusion constraint "user_email_unique"',
|
||||
},
|
||||
'conflict',
|
||||
)
|
||||
.fetch();
|
||||
|
||||
const userIds = await sails.helpers.getAdminUserIds();
|
||||
|
||||
userIds.forEach(userId => {
|
||||
userIds.forEach((userId) => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'userCreate',
|
||||
{
|
||||
item: user
|
||||
item: user,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
});
|
||||
|
||||
return exits.success(user);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,18 +2,18 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
board: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const action = await Action.archiveOne(inputs.record.id);
|
||||
|
||||
if (action) {
|
||||
|
@ -21,12 +21,12 @@ module.exports = {
|
|||
`board:${inputs.board.id}`,
|
||||
'actionDelete',
|
||||
{
|
||||
item: action
|
||||
item: action,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
}
|
||||
|
||||
return exits.success(action);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,35 +2,33 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const board = await Board.archiveOne(inputs.record.id);
|
||||
|
||||
if (board) {
|
||||
sails.sockets.leaveAll(`board:${board.id}`);
|
||||
|
||||
const userIds = await sails.helpers.getMembershipUserIdsForProject(
|
||||
board.projectId
|
||||
);
|
||||
const userIds = await sails.helpers.getMembershipUserIdsForProject(board.projectId);
|
||||
|
||||
userIds.forEach(userId => {
|
||||
userIds.forEach((userId) => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'boardDelete',
|
||||
{
|
||||
item: board
|
||||
item: board,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return exits.success(board);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,18 +2,18 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
board: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const cardLabel = await CardLabel.destroyOne(inputs.record.id);
|
||||
|
||||
if (cardLabel) {
|
||||
|
@ -21,12 +21,12 @@ module.exports = {
|
|||
`board:${inputs.board.id}`,
|
||||
'cardLabelDelete',
|
||||
{
|
||||
item: cardLabel
|
||||
item: cardLabel,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
}
|
||||
|
||||
return exits.success(cardLabel);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,18 +2,18 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
board: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const cardMembership = await CardMembership.destroyOne(inputs.record.id);
|
||||
|
||||
if (cardMembership) {
|
||||
|
@ -21,27 +21,27 @@ module.exports = {
|
|||
`board:${inputs.board.id}`,
|
||||
'cardMembershipDelete',
|
||||
{
|
||||
item: cardMembership
|
||||
item: cardMembership,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
const cardSubscription = await CardSubscription.destroyOne({
|
||||
cardId: cardMembership.cardId,
|
||||
userId: cardMembership.userId,
|
||||
isPermanent: false
|
||||
isPermanent: false,
|
||||
});
|
||||
|
||||
if (cardSubscription) {
|
||||
sails.sockets.broadcast(`user:${cardMembership.userId}`, 'cardUpdate', {
|
||||
item: {
|
||||
id: cardMembership.cardId,
|
||||
isSubscribed: false
|
||||
}
|
||||
isSubscribed: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return exits.success(cardMembership);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,14 +2,14 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const card = await Card.archiveOne(inputs.record.id);
|
||||
|
||||
if (card) {
|
||||
|
@ -17,12 +17,12 @@ module.exports = {
|
|||
`board:${card.boardId}`,
|
||||
'cardDelete',
|
||||
{
|
||||
item: card
|
||||
item: card,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
}
|
||||
|
||||
return exits.success(card);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,16 +2,16 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
await CardLabel.destroy({
|
||||
labelId: inputs.record.id
|
||||
labelId: inputs.record.id,
|
||||
});
|
||||
|
||||
const label = await Label.archiveOne(inputs.record.id);
|
||||
|
@ -21,12 +21,12 @@ module.exports = {
|
|||
`board:${label.boardId}`,
|
||||
'labelDelete',
|
||||
{
|
||||
item: label
|
||||
item: label,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
}
|
||||
|
||||
return exits.success(label);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,25 +2,25 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const list = await List.archiveOne(inputs.record.id);
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`board:${list.boardId}`,
|
||||
'listDelete',
|
||||
{
|
||||
item: list
|
||||
item: list,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
return exits.success(list);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,17 +2,15 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
const boards = await sails.helpers.getBoardsForProject(
|
||||
inputs.record.projectId
|
||||
);
|
||||
async fn(inputs, exits) {
|
||||
const boards = await sails.helpers.getBoardsForProject(inputs.record.projectId);
|
||||
|
||||
const boardIds = sails.helpers.mapRecords(boards);
|
||||
|
||||
|
@ -21,50 +19,44 @@ module.exports = {
|
|||
|
||||
await CardSubscription.destroy({
|
||||
cardId: cardIds,
|
||||
userId: inputs.record.userId
|
||||
userId: inputs.record.userId,
|
||||
});
|
||||
|
||||
await CardMembership.destroy({
|
||||
cardId: cardIds,
|
||||
userId: inputs.record.userId
|
||||
userId: inputs.record.userId,
|
||||
});
|
||||
|
||||
const projectMembership = await ProjectMembership.destroyOne(
|
||||
inputs.record.id
|
||||
);
|
||||
const projectMembership = await ProjectMembership.destroyOne(inputs.record.id);
|
||||
|
||||
if (projectMembership) {
|
||||
const userIds = await sails.helpers.getMembershipUserIdsForProject(
|
||||
projectMembership.projectId
|
||||
projectMembership.projectId,
|
||||
);
|
||||
|
||||
userIds.forEach(userId => {
|
||||
userIds.forEach((userId) => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'projectMembershipDelete',
|
||||
{
|
||||
item: projectMembership
|
||||
item: projectMembership,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
});
|
||||
|
||||
sails.sockets.removeRoomMembersFromRooms(
|
||||
`user:${projectMembership.userId}`,
|
||||
boardIds.map(boardId => `board:${boardId}`)
|
||||
boardIds.map((boardId) => `board:${boardId}`),
|
||||
);
|
||||
|
||||
const project = await Project.findOne(projectMembership.projectId);
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`user:${projectMembership.userId}`,
|
||||
'projectDelete',
|
||||
{
|
||||
item: project
|
||||
}
|
||||
);
|
||||
sails.sockets.broadcast(`user:${projectMembership.userId}`, 'projectDelete', {
|
||||
item: project,
|
||||
});
|
||||
}
|
||||
|
||||
return exits.success(projectMembership);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,16 +2,16 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const projectMemberships = await ProjectMembership.destroy({
|
||||
projectId: inputs.record.id
|
||||
projectId: inputs.record.id,
|
||||
}).fetch();
|
||||
|
||||
const project = await Project.archiveOne(inputs.record.id);
|
||||
|
@ -20,22 +20,22 @@ module.exports = {
|
|||
const userIds = sails.helpers.mapRecords(projectMemberships, 'userId');
|
||||
|
||||
const boards = await sails.helpers.getBoardsForProject(project.id);
|
||||
const boardRooms = boards.map(board => `board:${board.id}`);
|
||||
const boardRooms = boards.map((board) => `board:${board.id}`);
|
||||
|
||||
userIds.forEach(userId => {
|
||||
userIds.forEach((userId) => {
|
||||
sails.sockets.removeRoomMembersFromRooms(`user:${userId}`, boardRooms);
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'projectDelete',
|
||||
{
|
||||
item: project
|
||||
item: project,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return exits.success(project);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,18 +2,18 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
board: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const task = await Task.archiveOne(inputs.record.id);
|
||||
|
||||
if (task) {
|
||||
|
@ -21,12 +21,12 @@ module.exports = {
|
|||
`board:${inputs.board.id}`,
|
||||
'taskDelete',
|
||||
{
|
||||
item: task
|
||||
item: task,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
}
|
||||
|
||||
return exits.success(task);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,58 +2,54 @@ module.exports = {
|
|||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref'
|
||||
}
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
await ProjectMembership.destroy({
|
||||
userId: inputs.record.id
|
||||
userId: inputs.record.id,
|
||||
});
|
||||
|
||||
await CardSubscription.destroy({
|
||||
userId: inputs.record.id
|
||||
userId: inputs.record.id,
|
||||
});
|
||||
|
||||
await CardMembership.destroy({
|
||||
userId: inputs.record.id
|
||||
userId: inputs.record.id,
|
||||
});
|
||||
|
||||
const user = await User.updateOne({
|
||||
id: inputs.record.id,
|
||||
deletedAt: null
|
||||
deletedAt: null,
|
||||
}).set({
|
||||
deletedAt: new Date().toUTCString()
|
||||
deletedAt: new Date().toUTCString(),
|
||||
});
|
||||
|
||||
if (user) {
|
||||
const adminUserIds = await sails.helpers.getAdminUserIds();
|
||||
|
||||
const projectIds = await sails.helpers.getMembershipProjectIdsForUser(
|
||||
user.id
|
||||
);
|
||||
const projectIds = await sails.helpers.getMembershipProjectIdsForUser(user.id);
|
||||
|
||||
const userIdsForProject = await sails.helpers.getMembershipUserIdsForProject(
|
||||
projectIds
|
||||
);
|
||||
const userIdsForProject = await sails.helpers.getMembershipUserIdsForProject(projectIds);
|
||||
|
||||
const userIds = _.union([user.id], adminUserIds, userIdsForProject);
|
||||
|
||||
userIds.forEach(userId => {
|
||||
userIds.forEach((userId) => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'userDelete',
|
||||
{
|
||||
item: user
|
||||
item: user,
|
||||
},
|
||||
inputs.request
|
||||
inputs.request,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return exits.success(user);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,15 +2,15 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {}
|
||||
notFound: {},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const action = await Action.findOne(inputs.criteria);
|
||||
|
||||
if (!action) {
|
||||
|
@ -19,16 +19,16 @@ module.exports = {
|
|||
|
||||
const path = await sails.helpers
|
||||
.getCardToProjectPath(action.cardId)
|
||||
.intercept('notFound', path => ({
|
||||
.intercept('notFound', (nodes) => ({
|
||||
notFound: {
|
||||
action,
|
||||
...path
|
||||
}
|
||||
...nodes,
|
||||
},
|
||||
}));
|
||||
|
||||
return exits.success({
|
||||
action,
|
||||
...path
|
||||
...path,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -4,27 +4,27 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
beforeId: {
|
||||
type: 'string'
|
||||
}
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const criteria = {
|
||||
cardId: inputs.id
|
||||
cardId: inputs.id,
|
||||
};
|
||||
|
||||
if (!_.isUndefined(inputs.beforeId)) {
|
||||
criteria.id = {
|
||||
'<': inputs.beforeId
|
||||
'<': inputs.beforeId,
|
||||
};
|
||||
}
|
||||
|
||||
const actions = await sails.helpers.getActions(criteria, LIMIT);
|
||||
|
||||
return exits.success(actions);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,18 +2,18 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value)
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
limit: {
|
||||
type: 'number'
|
||||
}
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const actions = await Action.find(inputs.criteria)
|
||||
.sort('id DESC')
|
||||
.limit(inputs.limit);
|
||||
|
||||
return exits.success(actions);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module.exports = {
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const users = await sails.helpers.getUsers({
|
||||
isAdmin: true
|
||||
isAdmin: true,
|
||||
});
|
||||
|
||||
const userIds = sails.helpers.mapRecords(users);
|
||||
|
||||
return exits.success(userIds);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,15 +2,15 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {}
|
||||
notFound: {},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const board = await Board.findOne(inputs.criteria);
|
||||
|
||||
if (!board) {
|
||||
|
@ -22,14 +22,14 @@ module.exports = {
|
|||
if (!project) {
|
||||
throw {
|
||||
notFound: {
|
||||
board
|
||||
}
|
||||
board,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return exits.success({
|
||||
board,
|
||||
project
|
||||
project,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,28 +2,28 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
exceptBoardId: {
|
||||
type: 'json',
|
||||
custom: value => _.isString(value) || _.isArray(value)
|
||||
}
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const criteria = {
|
||||
projectId: inputs.id
|
||||
projectId: inputs.id,
|
||||
};
|
||||
|
||||
if (!_.isUndefined(inputs.exceptBoardId)) {
|
||||
criteria.id = {
|
||||
'!=': inputs.exceptBoardId
|
||||
'!=': inputs.exceptBoardId,
|
||||
};
|
||||
}
|
||||
|
||||
const boards = await sails.helpers.getBoards(criteria);
|
||||
|
||||
return exits.success(boards);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,13 +2,13 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value)
|
||||
}
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const boards = await Board.find(inputs.criteria).sort('position');
|
||||
|
||||
return exits.success(boards);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,16 +2,16 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true
|
||||
}
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const cardLabels = await sails.helpers.getCardLabels({
|
||||
cardId: inputs.id
|
||||
cardId: inputs.id,
|
||||
});
|
||||
|
||||
return exits.success(cardLabels);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,13 +2,13 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value)
|
||||
}
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const cardLabels = await CardLabel.find(inputs.criteria).sort('id');
|
||||
|
||||
return exits.success(cardLabels);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,15 +2,13 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value)
|
||||
}
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
const cardMemberships = await CardMembership.find(inputs.criteria).sort(
|
||||
'id'
|
||||
);
|
||||
async fn(inputs, exits) {
|
||||
const cardMemberships = await CardMembership.find(inputs.criteria).sort('id');
|
||||
|
||||
return exits.success(cardMemberships);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,15 +2,13 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value)
|
||||
}
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
const cardSubscriptions = await CardSubscription.find(inputs.criteria).sort(
|
||||
'id'
|
||||
);
|
||||
async fn(inputs, exits) {
|
||||
const cardSubscriptions = await CardSubscription.find(inputs.criteria).sort('id');
|
||||
|
||||
return exits.success(cardSubscriptions);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,15 +2,15 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {}
|
||||
notFound: {},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const card = await Card.findOne(inputs.criteria);
|
||||
|
||||
if (!card) {
|
||||
|
@ -19,16 +19,16 @@ module.exports = {
|
|||
|
||||
const path = await sails.helpers
|
||||
.getListToProjectPath(card.listId)
|
||||
.intercept('notFound', path => ({
|
||||
.intercept('notFound', (nodes) => ({
|
||||
notFound: {
|
||||
card,
|
||||
...path
|
||||
}
|
||||
...nodes,
|
||||
},
|
||||
}));
|
||||
|
||||
return exits.success({
|
||||
card,
|
||||
...path
|
||||
...path,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,16 +2,16 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true
|
||||
}
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const cards = await sails.helpers.getCards({
|
||||
boardId: inputs.id
|
||||
boardId: inputs.id,
|
||||
});
|
||||
|
||||
return exits.success(cards);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,28 +2,28 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
exceptCardId: {
|
||||
type: 'json',
|
||||
custom: value => _.isString(value) || _.isArray(value)
|
||||
}
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const criteria = {
|
||||
listId: inputs.id
|
||||
listId: inputs.id,
|
||||
};
|
||||
|
||||
if (!_.isUndefined(inputs.exceptCardId)) {
|
||||
criteria.id = {
|
||||
'!=': inputs.exceptCardId
|
||||
'!=': inputs.exceptCardId,
|
||||
};
|
||||
}
|
||||
|
||||
const cards = await sails.helpers.getCards(criteria);
|
||||
|
||||
return exits.success(cards);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,13 +2,13 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value)
|
||||
}
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
async fn(inputs, exits) {
|
||||
const cards = await Card.find(inputs.criteria).sort('position');
|
||||
|
||||
return exits.success(cards);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue