1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 21:29:43 +02:00

Code formatting with prettier, change eslint config for the server

This commit is contained in:
Maksim Eltyshev 2019-11-05 18:01:42 +05:00
parent bc87c1d883
commit 7a3805e64c
191 changed files with 4321 additions and 2880 deletions

1
client/.env Normal file
View file

@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true

732
client/package-lock.json generated
View file

@ -1696,9 +1696,10 @@
} }
}, },
"acorn": { "acorn": {
"version": "7.1.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz",
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==" "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==",
"dev": true
}, },
"acorn-globals": { "acorn-globals": {
"version": "4.3.4", "version": "4.3.4",
@ -1717,9 +1718,9 @@
} }
}, },
"acorn-jsx": { "acorn-jsx": {
"version": "5.0.2", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.2.tgz", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz",
"integrity": "sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==" "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw=="
}, },
"acorn-walk": { "acorn-walk": {
"version": "6.2.0", "version": "6.2.0",
@ -2503,6 +2504,12 @@
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" "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": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "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", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" "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": { "caniuse-api": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz",
@ -4413,6 +4431,12 @@
"path-type": "^3.0.0" "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": { "dns-equal": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz",
@ -4796,61 +4820,73 @@
} }
}, },
"eslint": { "eslint": {
"version": "6.5.1", "version": "5.16.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.5.1.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz",
"integrity": "sha512-32h99BoLYStT1iq1v2P9uwpyznQ4M2jRiFB6acitKz52Gqn+vPaMDUTB1bYi1WN4Nquj2w+t+bimYUG83DC55A==", "integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==",
"dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.0.0", "@babel/code-frame": "^7.0.0",
"ajv": "^6.10.0", "ajv": "^6.9.1",
"chalk": "^2.1.0", "chalk": "^2.1.0",
"cross-spawn": "^6.0.5", "cross-spawn": "^6.0.5",
"debug": "^4.0.1", "debug": "^4.0.1",
"doctrine": "^3.0.0", "doctrine": "^3.0.0",
"eslint-scope": "^5.0.0", "eslint-scope": "^4.0.3",
"eslint-utils": "^1.4.2", "eslint-utils": "^1.3.1",
"eslint-visitor-keys": "^1.1.0", "eslint-visitor-keys": "^1.0.0",
"espree": "^6.1.1", "espree": "^5.0.1",
"esquery": "^1.0.1", "esquery": "^1.0.1",
"esutils": "^2.0.2", "esutils": "^2.0.2",
"file-entry-cache": "^5.0.1", "file-entry-cache": "^5.0.1",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"glob-parent": "^5.0.0", "glob": "^7.1.2",
"globals": "^11.7.0", "globals": "^11.7.0",
"ignore": "^4.0.6", "ignore": "^4.0.6",
"import-fresh": "^3.0.0", "import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4", "imurmurhash": "^0.1.4",
"inquirer": "^6.4.1", "inquirer": "^6.2.2",
"is-glob": "^4.0.0", "js-yaml": "^3.13.0",
"js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1", "json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.3.0", "levn": "^0.3.0",
"lodash": "^4.17.14", "lodash": "^4.17.11",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"optionator": "^0.8.2", "optionator": "^0.8.2",
"path-is-inside": "^1.0.2",
"progress": "^2.0.0", "progress": "^2.0.0",
"regexpp": "^2.0.1", "regexpp": "^2.0.1",
"semver": "^6.1.2", "semver": "^5.5.1",
"strip-ansi": "^5.2.0", "strip-ansi": "^4.0.0",
"strip-json-comments": "^3.0.1", "strip-json-comments": "^2.0.1",
"table": "^5.2.3", "table": "^5.2.3",
"text-table": "^0.2.0", "text-table": "^0.2.0"
"v8-compile-cache": "^2.0.3"
}, },
"dependencies": { "dependencies": {
"debug": { "debug": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"dev": true,
"requires": { "requires": {
"ms": "^2.1.1" "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": { "import-fresh": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz",
"integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==",
"dev": true,
"requires": { "requires": {
"parent-module": "^1.0.0", "parent-module": "^1.0.0",
"resolve-from": "^4.0.0" "resolve-from": "^4.0.0"
@ -4859,12 +4895,29 @@
"ms": { "ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "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": { "resolve-from": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "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": { "eslint-plugin-react": {
"version": "7.14.3", "version": "7.16.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.16.0.tgz",
"integrity": "sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==", "integrity": "sha512-GacBAATewhhptbK3/vTP09CbFrgUJmBSaaRcWdbQLFvUZy9yVcQxigBNHGPU/KE2AyHpzj3AWXpxoMTsIDiHug==",
"dev": true,
"requires": { "requires": {
"array-includes": "^3.0.3", "array-includes": "^3.0.3",
"doctrine": "^2.1.0", "doctrine": "^2.1.0",
"has": "^1.0.3", "has": "^1.0.3",
"jsx-ast-utils": "^2.1.0", "jsx-ast-utils": "^2.2.1",
"object.entries": "^1.1.0", "object.entries": "^1.1.0",
"object.fromentries": "^2.0.0", "object.fromentries": "^2.0.0",
"object.values": "^1.1.0", "object.values": "^1.1.0",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"resolve": "^1.10.1" "resolve": "^1.12.0"
}, },
"dependencies": { "dependencies": {
"doctrine": { "doctrine": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"requires": { "requires": {
"esutils": "^2.0.2" "esutils": "^2.0.2"
} }
@ -5224,13 +5279,14 @@
"integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==" "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A=="
}, },
"espree": { "espree": {
"version": "6.1.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-6.1.1.tgz", "resolved": "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz",
"integrity": "sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ==", "integrity": "sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==",
"dev": true,
"requires": { "requires": {
"acorn": "^7.0.0", "acorn": "^6.0.7",
"acorn-jsx": "^5.0.2", "acorn-jsx": "^5.0.0",
"eslint-visitor-keys": "^1.1.0" "eslint-visitor-keys": "^1.0.0"
} }
}, },
"esprima": { "esprima": {
@ -5959,6 +6015,12 @@
"resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz", "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz",
"integrity": "sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg==" "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": { "get-stream": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
@ -6099,9 +6161,9 @@
"integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ==" "integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ=="
}, },
"handlebars": { "handlebars": {
"version": "4.4.2", "version": "4.5.1",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.2.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz",
"integrity": "sha512-cIv17+GhL8pHHnRJzGu2wwcthL5sb8uDKBHvZ2Dtu5s1YNt0ljbzKbamnc+gr69y7bzwQiBdr5+hOpRd5pnOdg==", "integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==",
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
"optimist": "^0.6.1", "optimist": "^0.6.1",
@ -6601,6 +6663,12 @@
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" "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": { "indexes-of": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
@ -6644,6 +6712,7 @@
"version": "6.5.2", "version": "6.5.2",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz",
"integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==",
"dev": true,
"requires": { "requires": {
"ansi-escapes": "^3.2.0", "ansi-escapes": "^3.2.0",
"chalk": "^2.4.2", "chalk": "^2.4.2",
@ -8385,6 +8454,12 @@
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=" "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": { "lodash.sortby": {
"version": "4.7.0", "version": "4.7.0",
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", "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", "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.4.tgz",
"integrity": "sha512-p0b6mOGKcGa+7nnmKbpzR6qloPbrgLcnio++E+14Vo/XffOGwZtRpUhr8dTH/x2oCMmEoIU0Zwm3ZauhvYD17g==" "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": { "loose-envify": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "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": { "makeerror": {
"version": "1.0.11", "version": "1.0.11",
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", "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", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
"integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" "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": { "map-visit": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", "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", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz",
"integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==" "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": { "methods": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
@ -9184,14 +9349,14 @@
} }
}, },
"object.fromentries": { "object.fromentries": {
"version": "2.0.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.0.tgz", "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.1.tgz",
"integrity": "sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA==", "integrity": "sha512-PUQv8Hbg3j2QX0IQYv3iAGCbGcu4yY4KQ92/dhA4sFSixBmSmp13UpDLs6jGK8rBtbmhNNIK99LD2k293jpiGA==",
"requires": { "requires": {
"define-properties": "^1.1.2", "define-properties": "^1.1.3",
"es-abstract": "^1.11.0", "es-abstract": "^1.15.0",
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
"has": "^1.0.1" "has": "^1.0.3"
} }
}, },
"object.getownpropertydescriptors": { "object.getownpropertydescriptors": {
@ -10562,6 +10727,179 @@
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" "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": { "pretty-bytes": {
"version": "5.3.0", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.3.0.tgz", "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", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz",
"integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==" "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": { "raf": {
"version": "3.4.1", "version": "3.4.1",
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
@ -11095,6 +11439,224 @@
"webpack-dev-server": "3.2.1", "webpack-dev-server": "3.2.1",
"webpack-manifest-plugin": "2.1.1", "webpack-manifest-plugin": "2.1.1",
"workbox-webpack-plugin": "4.3.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": { "react-textarea-autosize": {
@ -11516,6 +12078,12 @@
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" "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": { "requires-port": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
@ -12745,9 +13313,10 @@
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
}, },
"strip-json-comments": { "strip-json-comments": {
"version": "3.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==" "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
"dev": true
}, },
"style-loader": { "style-loader": {
"version": "1.0.0", "version": "1.0.0",
@ -13160,6 +13729,12 @@
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" "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": { "typescript-compare": {
"version": "0.0.2", "version": "0.0.2",
"resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz", "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", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz",
"integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=" "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": { "w3c-hr-time": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz",

View file

@ -4,6 +4,7 @@
"scripts": { "scripts": {
"build": "react-scripts build", "build": "react-scripts build",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"format": "prettier-eslint --write \"src/**/*.*(js|jsx)\"",
"lint": "eslint --ext js,jsx src", "lint": "eslint --ext js,jsx src",
"start": "react-scripts start", "start": "react-scripts start",
"test": "react-scripts test" "test": "react-scripts test"
@ -64,6 +65,12 @@
"whatwg-fetch": "^3.0.0" "whatwg-fetch": "^3.0.0"
}, },
"devDependencies": { "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"
} }
} }

View file

@ -42,11 +42,7 @@ const Projects = React.memo(({
))} ))}
{isEditable && ( {isEditable && (
<Grid.Column mobile={8} computer={4}> <Grid.Column mobile={8} computer={4}>
<button <button type="button" className={classNames(styles.card, styles.add)} onClick={onAdd}>
type="button"
className={classNames(styles.card, styles.add)}
onClick={onAdd}
>
<div className={styles.addTitleWrapper}> <div className={styles.addTitleWrapper}>
<div className={styles.addTitle}> <div className={styles.addTitle}>
<PlusIcon className={styles.addGridIcon} /> <PlusIcon className={styles.addGridIcon} />

View file

@ -37,135 +37,137 @@ const createMessage = (error) => {
} }
}; };
const EditEmailStep = React.memo(({ const EditEmailStep = React.memo(
defaultData, email, isSubmitting, error, onUpdate, onMessageDismiss, onBack, onClose, ({
}) => { defaultData, email, isSubmitting, error, onUpdate, onMessageDismiss, onBack, onClose,
const [t] = useTranslation(); }) => {
const wasSubmitting = usePrevious(isSubmitting); const [t] = useTranslation();
const wasSubmitting = usePrevious(isSubmitting);
const [data, handleFieldChange, setData] = useForm({ const [data, handleFieldChange, setData] = useForm({
email: '', email: '',
currentPassword: '', currentPassword: '',
...defaultData, ...defaultData,
}); });
const message = useMemo(() => createMessage(error), [error]); const message = useMemo(() => createMessage(error), [error]);
const [focusCurrentPasswordFieldState, focusCurrentPasswordField] = useToggle(); const [focusCurrentPasswordFieldState, focusCurrentPasswordField] = useToggle();
const emailField = useRef(null); const emailField = useRef(null);
const currentPasswordField = useRef(null); const currentPasswordField = useRef(null);
const handleSubmit = useCallback(() => { const handleSubmit = useCallback(() => {
const cleanData = { const cleanData = {
...data, ...data,
email: data.email.trim(), email: data.email.trim(),
}; };
if (!isEmail(cleanData.email)) { if (!isEmail(cleanData.email)) {
emailField.current.select(); emailField.current.select();
return; 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();
} }
}
}, [isSubmitting, wasSubmitting, error, onClose, setData, focusCurrentPasswordField]);
useDidUpdate(() => { if (cleanData.email === email) {
currentPasswordField.current.focus(); onClose();
}, [focusCurrentPasswordFieldState]); return;
}
return ( if (!cleanData.currentPassword) {
<> currentPasswordField.current.focus();
<Popup.Header onBack={onBack}> return;
{t('common.editEmail', { }
context: 'title',
})} onUpdate(cleanData);
</Popup.Header> }, [email, onUpdate, onClose, data]);
<Popup.Content>
{message && ( useEffect(() => {
<Message emailField.current.select();
// eslint-disable-next-line react/jsx-props-no-spreading }, []);
{...{
[message.type]: true, useEffect(() => {
}} if (wasSubmitting && !isSubmitting) {
visible if (error) {
content={t(message.content)} switch (error.message) {
onDismiss={onMessageDismiss} case 'User is already exist':
/> emailField.current.select();
)}
<Form onSubmit={handleSubmit}> break;
<div className={styles.text}>{t('common.newEmail')}</div> case 'Current password is not valid':
<Input setData((prevData) => ({
fluid ...prevData,
ref={emailField} currentPassword: '',
name="email" }));
value={data.email} focusCurrentPasswordField();
placeholder={email}
className={styles.field} break;
onChange={handleFieldChange} default:
/> }
{data.email.trim() !== email && ( } else {
<> onClose();
<div className={styles.text}>{t('common.currentPassword')}</div> }
<Input }
fluid }, [isSubmitting, wasSubmitting, error, onClose, setData, focusCurrentPasswordField]);
ref={currentPasswordField}
type="password" useDidUpdate(() => {
name="currentPassword" currentPasswordField.current.focus();
value={data.currentPassword} }, [focusCurrentPasswordFieldState]);
className={styles.field}
onChange={handleFieldChange} 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 <Form onSubmit={handleSubmit}>
positive <div className={styles.text}>{t('common.newEmail')}</div>
content={t('action.save')} <Input
loading={isSubmitting} fluid
disabled={isSubmitting} ref={emailField}
/> name="email"
</Form> value={data.email}
</Popup.Content> 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 = { EditEmailStep.propTypes = {
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types

View file

@ -31,110 +31,112 @@ const createMessage = (error) => {
} }
}; };
const EditPasswordStep = React.memo(({ const EditPasswordStep = React.memo(
defaultData, isSubmitting, error, onUpdate, onMessageDismiss, onBack, onClose, ({
}) => { defaultData, isSubmitting, error, onUpdate, onMessageDismiss, onBack, onClose,
const [t] = useTranslation(); }) => {
const wasSubmitting = usePrevious(isSubmitting); const [t] = useTranslation();
const wasSubmitting = usePrevious(isSubmitting);
const [data, handleFieldChange, setData] = useForm({ const [data, handleFieldChange, setData] = useForm({
password: '', password: '',
currentPassword: '', currentPassword: '',
...defaultData, ...defaultData,
}); });
const message = useMemo(() => createMessage(error), [error]); const message = useMemo(() => createMessage(error), [error]);
const [focusCurrentPasswordFieldState, focusCurrentPasswordField] = useToggle(); const [focusCurrentPasswordFieldState, focusCurrentPasswordField] = useToggle();
const passwordField = useRef(null); const passwordField = useRef(null);
const currentPasswordField = useRef(null); const currentPasswordField = useRef(null);
const handleSubmit = useCallback(() => { const handleSubmit = useCallback(() => {
if (!data.password) { if (!data.password) {
passwordField.current.select(); passwordField.current.select();
return; 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();
} }
}
}, [isSubmitting, wasSubmitting, error, onClose, setData, focusCurrentPasswordField]);
useDidUpdate(() => { if (!data.currentPassword) {
currentPasswordField.current.focus(); currentPasswordField.current.focus();
}, [focusCurrentPasswordFieldState]); return;
}
return ( onUpdate(data);
<> }, [onUpdate, data]);
<Popup.Header onBack={onBack}>
{t('common.editPassword', { useEffect(() => {
context: 'title', passwordField.current.select();
})} }, []);
</Popup.Header>
<Popup.Content> useEffect(() => {
{message && ( if (wasSubmitting && !isSubmitting) {
<Message if (!error) {
// eslint-disable-next-line react/jsx-props-no-spreading onClose();
{...{ } else if (error.message === 'Current password is not valid') {
[message.type]: true, setData((prevData) => ({
}} ...prevData,
visible currentPassword: '',
content={t(message.content)} }));
onDismiss={onMessageDismiss} focusCurrentPasswordField();
/> }
)} }
<Form onSubmit={handleSubmit}> }, [isSubmitting, wasSubmitting, error, onClose, setData, focusCurrentPasswordField]);
<div className={styles.text}>{t('common.newPassword')}</div>
<Input useDidUpdate(() => {
fluid currentPasswordField.current.focus();
ref={passwordField} }, [focusCurrentPasswordFieldState]);
name="password"
value={data.password} return (
className={styles.field} <>
onChange={handleFieldChange} <Popup.Header onBack={onBack}>
/> {t('common.editPassword', {
<div className={styles.text}>{t('common.currentPassword')}</div> context: 'title',
<Input })}
fluid </Popup.Header>
ref={currentPasswordField} <Popup.Content>
type="password" {message && (
name="currentPassword" <Message
value={data.currentPassword} // eslint-disable-next-line react/jsx-props-no-spreading
className={styles.field} {...{
onChange={handleFieldChange} [message.type]: true,
/> }}
<Button visible
positive content={t(message.content)}
content={t('action.save')} onDismiss={onMessageDismiss}
loading={isSubmitting} />
disabled={isSubmitting} )}
/> <Form onSubmit={handleSubmit}>
</Form> <div className={styles.text}>{t('common.newPassword')}</div>
</Popup.Content> <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 = { EditPasswordStep.propTypes = {
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types

View file

@ -15,7 +15,8 @@ export default {
addUser_title: 'Add User', addUser_title: 'Add User',
administrator: 'Administrator', administrator: 'Administrator',
all: 'All', 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?', areYouSureYouWantToDeleteThisBoard: 'Are you sure you want to delete this board?',
areYouSureYouWantToDeleteThisCard: 'Are you sure you want to delete this card?', areYouSureYouWantToDeleteThisCard: 'Are you sure you want to delete this card?',
areYouSureYouWantToDeleteThisComment: 'Are you sure you want to delete this comment?', 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?', areYouSureYouWantToDeleteThisProject: 'Are you sure you want to delete this project?',
areYouSureYouWantToDeleteThisTask: 'Are you sure you want to delete this task?', areYouSureYouWantToDeleteThisTask: 'Are you sure you want to delete this task?',
areYouSureYouWantToDeleteThisUser: 'Are you sure you want to delete this user?', 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', boardNotFound_title: 'Board Not Found',
cardActions_title: 'Card Actions', cardActions_title: 'Card Actions',
cardNotFound_title: 'Card Not Found', cardNotFound_title: 'Card Not Found',
@ -77,7 +79,8 @@ export default {
noUnreadNotifications: 'No unread notifications', noUnreadNotifications: 'No unread notifications',
openBoard_title: 'Open Board', openBoard_title: 'Open Board',
projectNotFound_title: 'Project Not Found', 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', removeMember_title: 'Remove Member',
seconds: 'Seconds', seconds: 'Seconds',
taskActions_title: 'Task Actions', taskActions_title: 'Task Actions',
@ -89,7 +92,8 @@ export default {
userIsAlreadyExist: 'User is already exist', userIsAlreadyExist: 'User is already exist',
userLeftNewCommentToCard: '{{user}} left a new comment «{{comment}}» to <2>{{card}}</2>', userLeftNewCommentToCard: '{{user}} left a new comment «{{comment}}» to <2>{{card}}</2>',
userMovedCardFromListToList: '{{user}} moved <2>{{card}}</2> from {{fromList}} to {{toList}}', 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', users: 'Users',
writeComment: 'Write a comment...', writeComment: 'Write a comment...',
}, },

View file

@ -19,7 +19,8 @@ export default {
addUser: 'Добавление пользователя', addUser: 'Добавление пользователя',
administrator: 'Администратор', administrator: 'Администратор',
all: 'Все', all: 'Все',
allChangesWillBeAutomaticallySavedAfterConnectionRestored: 'Все изменения сохранятся автоматически,<br />как только подключение восстановится', allChangesWillBeAutomaticallySavedAfterConnectionRestored:
'Все изменения сохранятся автоматически,<br />как только подключение восстановится',
areYouSureYouWantToDeleteThisBoard: 'Вы уверены, что хотите удалить эту доску?', areYouSureYouWantToDeleteThisBoard: 'Вы уверены, что хотите удалить эту доску?',
areYouSureYouWantToDeleteThisCard: 'Вы уверены, что хотите удалить эту карточку?', areYouSureYouWantToDeleteThisCard: 'Вы уверены, что хотите удалить эту карточку?',
areYouSureYouWantToDeleteThisComment: 'Вы уверены, что хотите удалить этот комментарий?', areYouSureYouWantToDeleteThisComment: 'Вы уверены, что хотите удалить этот комментарий?',
@ -28,7 +29,8 @@ export default {
areYouSureYouWantToDeleteThisProject: 'Вы уверены, что хотите удалить этот проект?', areYouSureYouWantToDeleteThisProject: 'Вы уверены, что хотите удалить этот проект?',
areYouSureYouWantToDeleteThisTask: 'Вы уверены, что хотите удалить эту задачу?', areYouSureYouWantToDeleteThisTask: 'Вы уверены, что хотите удалить эту задачу?',
areYouSureYouWantToDeleteThisUser: 'Вы уверены, что хотите удалить этого пользователя?', areYouSureYouWantToDeleteThisUser: 'Вы уверены, что хотите удалить этого пользователя?',
areYouSureYouWantToRemoveThisMemberFromProject: 'Вы уверены, что хотите удалить этого участника из проекта?', areYouSureYouWantToRemoveThisMemberFromProject:
'Вы уверены, что хотите удалить этого участника из проекта?',
boardNotFound: 'Доска не найдена', boardNotFound: 'Доска не найдена',
cardActions: 'Действия с карточкой', cardActions: 'Действия с карточкой',
cardNotFound: 'Карточка не найдена', cardNotFound: 'Карточка не найдена',
@ -81,7 +83,8 @@ export default {
noUnreadNotifications: 'Уведомлений нет', noUnreadNotifications: 'Уведомлений нет',
openBoard: 'Откройте доску', openBoard: 'Откройте доску',
projectNotFound: 'Доска не найдена', projectNotFound: 'Доска не найдена',
refreshPageToLoadLastDataAndReceiveUpdates: '<0>Обновите страницу</0>, чтобы загрузить<br />актуальные данные и получать обновления', refreshPageToLoadLastDataAndReceiveUpdates:
'<0>Обновите страницу</0>, чтобы загрузить<br />актуальные данные и получать обновления',
removeMember: 'Удаление участника', removeMember: 'Удаление участника',
seconds: 'Секунды', seconds: 'Секунды',
taskActions: 'Действия с задачей', taskActions: 'Действия с задачей',
@ -92,8 +95,10 @@ export default {
userAddedThisCardToList: '<0>{{user}}</0><1> добавил(а) эту карточку в {{list}}</1>', userAddedThisCardToList: '<0>{{user}}</0><1> добавил(а) эту карточку в {{list}}</1>',
userIsAlreadyExist: 'Пользователь уже существует', userIsAlreadyExist: 'Пользователь уже существует',
userLeftNewCommentToCard: '{{user}} оставил(а) комментарий «{{comment}}» к <2>{{card}}</2>', userLeftNewCommentToCard: '{{user}} оставил(а) комментарий «{{comment}}» к <2>{{card}}</2>',
userMovedCardFromListToList: '{{user}} переместил(а) <2>{{card}}</2> из {{fromList}} в {{toList}}', userMovedCardFromListToList:
userMovedThisCardFromListToList: '<0>{{user}}</0><1> переместил(а) эту карточку из {{fromList}} в {{toList}}</1>', '{{user}} переместил(а) <2>{{card}}</2> из {{fromList}} в {{toList}}',
userMovedThisCardFromListToList:
'<0>{{user}}</0><1> переместил(а) эту карточку из {{fromList}} в {{toList}}</1>',
users: 'Пользователи', users: 'Пользователи',
writeComment: 'Напишите комментарий...', writeComment: 'Напишите комментарий...',
}, },

View file

@ -4,8 +4,6 @@ import { fetchActionsInCurrentCardService } from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes'; import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield takeLatest( // eslint-disable-next-line max-len
EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH, yield takeLatest(EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH, () => fetchActionsInCurrentCardService());
() => fetchActionsInCurrentCardService(),
);
} }

View file

@ -10,18 +10,11 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield all([ yield all([
takeLatest( /* eslint-disable max-len */
EntryActionTypes.BOARD_IN_CURRENT_PROJECT_CREATE, takeLatest(EntryActionTypes.BOARD_IN_CURRENT_PROJECT_CREATE, ({ payload: { data } }) => createBoardInCurrentProjectService(data)),
({ payload: { data } }) => createBoardInCurrentProjectService(data), takeLatest(EntryActionTypes.BOARD_UPDATE, ({ payload: { id, data } }) => updateBoardService(id, data)),
), takeLatest(EntryActionTypes.BOARD_MOVE, ({ payload: { id, index } }) => moveBoardService(id, index)),
takeLatest( /* eslint-enable max-len */
EntryActionTypes.BOARD_UPDATE,
({ payload: { id, data } }) => updateBoardService(id, data),
),
takeLatest(
EntryActionTypes.BOARD_MOVE,
({ payload: { id, index } }) => moveBoardService(id, index),
),
takeLatest(EntryActionTypes.BOARD_DELETE, ({ payload: { id } }) => deleteBoardService(id)), takeLatest(EntryActionTypes.BOARD_DELETE, ({ payload: { id } }) => deleteBoardService(id)),
]); ]);
} }

View file

@ -12,22 +12,12 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield all([ yield all([
takeLatest( /* eslint-disable max-len */
EntryActionTypes.CARD_CREATE, takeLatest(EntryActionTypes.CARD_CREATE, ({ payload: { listId, data } }) => createCardService(listId, data)),
({ 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( takeLatest(EntryActionTypes.CARD_MOVE, ({ payload: { id, listId, index } }) => moveCardService(id, listId, index)),
EntryActionTypes.CARD_UPDATE, /* eslint-enable max-len */
({ 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),
),
takeLatest(EntryActionTypes.CARD_DELETE, ({ payload: { id } }) => deleteCardService(id)), takeLatest(EntryActionTypes.CARD_DELETE, ({ payload: { id } }) => deleteCardService(id)),
takeLatest(EntryActionTypes.CURRENT_CARD_DELETE, () => deleteCurrentCardService()), takeLatest(EntryActionTypes.CURRENT_CARD_DELETE, () => deleteCurrentCardService()),
]); ]);

View file

@ -9,17 +9,10 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield all([ yield all([
takeLatest( /* eslint-disable max-len */
EntryActionTypes.COMMENT_ACTION_IN_CURRENT_CARD_CREATE, takeLatest(EntryActionTypes.COMMENT_ACTION_IN_CURRENT_CARD_CREATE, ({ payload: { data } }) => createCommentActionInCurrentCardService(data)),
({ payload: { data } }) => createCommentActionInCurrentCardService(data), takeLatest(EntryActionTypes.COMMENT_ACTION_UPDATE, ({ payload: { id, data } }) => updateCommentActionService(id, data)),
), takeLatest(EntryActionTypes.COMMENT_ACTION_DELETE, ({ payload: { id } }) => deleteCommentActionService(id)),
takeLatest( /* eslint-enable max-len */
EntryActionTypes.COMMENT_ACTION_UPDATE,
({ payload: { id, data } }) => updateCommentActionService(id, data),
),
takeLatest(
EntryActionTypes.COMMENT_ACTION_DELETE,
({ payload: { id } }) => deleteCommentActionService(id),
),
]); ]);
} }

View file

@ -15,38 +15,18 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield all([ yield all([
takeLatest( /* eslint-disable max-len */
EntryActionTypes.LABEL_IN_CURRENT_BOARD_CREATE, takeLatest(EntryActionTypes.LABEL_IN_CURRENT_BOARD_CREATE, ({ payload: { data } }) => createLabelInCurrentBoardService(data)),
({ payload: { data } }) => createLabelInCurrentBoardService(data), takeLatest(EntryActionTypes.LABEL_UPDATE, ({ payload: { id, data } }) => updateLabelService(id, data)),
), /* eslint-enable max-len */
takeLatest(
EntryActionTypes.LABEL_UPDATE,
({ payload: { id, data } }) => updateLabelService(id, data),
),
takeLatest(EntryActionTypes.LABEL_DELETE, ({ payload: { id } }) => deleteLabelService(id)), takeLatest(EntryActionTypes.LABEL_DELETE, ({ payload: { id } }) => deleteLabelService(id)),
takeLatest( /* eslint-disable max-len */
EntryActionTypes.LABEL_TO_CARD_ADD, takeLatest(EntryActionTypes.LABEL_TO_CARD_ADD, ({ payload: { id, cardId } }) => addLabelToCardService(id, cardId)),
({ 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( takeLatest(EntryActionTypes.LABEL_FROM_CURRENT_CARD_REMOVE, ({ payload: { id } }) => removeLabelFromCurrentCardService(id)),
EntryActionTypes.LABEL_TO_CURRENT_CARD_ADD, takeLatest(EntryActionTypes.LABEL_TO_FILTER_IN_CURRENT_BOARD_ADD, ({ payload: { id } }) => addLabelToFilterInCurrentBoardService(id)),
({ payload: { id } }) => addLabelToCurrentCardService(id), takeLatest(EntryActionTypes.LABEL_FROM_FILTER_IN_CURRENT_BOARD_REMOVE, ({ payload: { id } }) => removeLabelFromFilterInCurrentBoardService(id)),
), /* eslint-enable max-len */
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),
),
]); ]);
} }

View file

@ -10,18 +10,11 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield all([ yield all([
takeLatest( /* eslint-disable max-len */
EntryActionTypes.LIST_IN_CURRENT_BOARD_CREATE, takeLatest(EntryActionTypes.LIST_IN_CURRENT_BOARD_CREATE, ({ payload: { data } }) => createListInCurrentBoardService(data)),
({ payload: { data } }) => createListInCurrentBoardService(data), takeLatest(EntryActionTypes.LIST_UPDATE, ({ payload: { id, data } }) => updateListService(id, data)),
), takeLatest(EntryActionTypes.LIST_MOVE, ({ payload: { id, index } }) => moveListService(id, index)),
takeLatest( /* eslint-enable max-len */
EntryActionTypes.LIST_UPDATE,
({ payload: { id, data } }) => updateListService(id, data),
),
takeLatest(
EntryActionTypes.LIST_MOVE,
({ payload: { id, index } }) => moveListService(id, index),
),
takeLatest(EntryActionTypes.LIST_DELETE, ({ payload: { id } }) => deleteListService(id)), takeLatest(EntryActionTypes.LIST_DELETE, ({ payload: { id } }) => deleteListService(id)),
]); ]);
} }

View file

@ -4,8 +4,6 @@ import { deleteNotificationService } from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes'; import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield takeLatest( // eslint-disable-next-line max-len
EntryActionTypes.NOTIFICATION_DELETE, yield takeLatest(EntryActionTypes.NOTIFICATION_DELETE, ({ payload: { id } }) => deleteNotificationService(id));
({ payload: { id } }) => deleteNotificationService(id),
);
} }

View file

@ -8,13 +8,9 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield all([ yield all([
takeLatest( /* eslint-disable max-len */
EntryActionTypes.MEMBERSHIP_IN_CURRENT_PROJECT_CREATE, takeLatest(EntryActionTypes.MEMBERSHIP_IN_CURRENT_PROJECT_CREATE, ({ payload: { data } }) => createMembershipInCurrentProjectService(data)),
({ payload: { data } }) => createMembershipInCurrentProjectService(data), takeLatest(EntryActionTypes.PROJECT_MEMBERSHIP_DELETE, ({ payload: { id } }) => deleteProjectMembershipService(id)),
), /* eslint-enable max-len */
takeLatest(
EntryActionTypes.PROJECT_MEMBERSHIP_DELETE,
({ payload: { id } }) => deleteProjectMembershipService(id),
),
]); ]);
} }

View file

@ -9,14 +9,10 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield all([ yield all([
takeLatest( /* eslint-disable max-len */
EntryActionTypes.PROJECT_CREATE, takeLatest(EntryActionTypes.PROJECT_CREATE, ({ payload: { data } }) => createProjectService(data)),
({ payload: { data } }) => createProjectService(data), takeLatest(EntryActionTypes.CURRENT_PROJECT_UPDATE, ({ payload: { data } }) => updateCurrentProjectService(data)),
), /* eslint-enable max-len */
takeLatest(
EntryActionTypes.CURRENT_PROJECT_UPDATE,
({ payload: { data } }) => updateCurrentProjectService(data),
),
takeLatest(EntryActionTypes.CURRENT_PROJECT_DELETE, () => deleteCurrentProjectService()), takeLatest(EntryActionTypes.CURRENT_PROJECT_DELETE, () => deleteCurrentProjectService()),
]); ]);
} }

View file

@ -5,14 +5,10 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () { export default function* () {
yield all([ yield all([
takeLatest( /* eslint-disable max-len */
EntryActionTypes.TASK_IN_CURRENT_CARD_CREATE, takeLatest(EntryActionTypes.TASK_IN_CURRENT_CARD_CREATE, ({ payload: { data } }) => createTaskInCurrentCardService(data)),
({ payload: { data } }) => createTaskInCurrentCardService(data), takeLatest(EntryActionTypes.TASK_UPDATE, ({ payload: { id, data } }) => updateTaskService(id, data)),
), /* eslint-enable max-len */
takeLatest(
EntryActionTypes.TASK_UPDATE,
({ payload: { id, data } }) => updateTaskService(id, data),
),
takeLatest(EntryActionTypes.TASK_DELETE, ({ payload: { id } }) => deleteTaskService(id)), takeLatest(EntryActionTypes.TASK_DELETE, ({ payload: { id } }) => deleteTaskService(id)),
]); ]);
} }

View file

@ -24,58 +24,23 @@ export default function* () {
yield all([ yield all([
takeLatest(EntryActionTypes.USER_CREATE, ({ payload: { data } }) => createUserService(data)), takeLatest(EntryActionTypes.USER_CREATE, ({ payload: { data } }) => createUserService(data)),
takeLatest(EntryActionTypes.USER_CREATE_ERROR_CLEAR, () => clearUserCreateErrorService()), takeLatest(EntryActionTypes.USER_CREATE_ERROR_CLEAR, () => clearUserCreateErrorService()),
takeLatest( /* eslint-disable max-len */
EntryActionTypes.USER_UPDATE, takeLatest(EntryActionTypes.USER_UPDATE, ({ payload: { id, data } }) => updateUserService(id, data)),
({ 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( takeLatest(EntryActionTypes.CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR, () => clearCurrentUserEmailUpdateErrorService()),
EntryActionTypes.CURRENT_USER_UPDATE, takeLatest(EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE, ({ payload: { data } }) => updateCurrentUserPasswordService(data)),
({ payload: { data } }) => updateCurrentUserService(data), takeLatest(EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR, () => clearCurrentUserPasswordUpdateErrorService()),
), takeLatest(EntryActionTypes.CURRENT_USER_AVATAR_UPLOAD, ({ payload: { file } }) => uploadCurrentUserAvatarService(file)),
takeLatest( /* eslint-enable max-len */
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),
),
takeLatest(EntryActionTypes.USER_DELETE, ({ payload: { id } }) => deleteUserService(id)), takeLatest(EntryActionTypes.USER_DELETE, ({ payload: { id } }) => deleteUserService(id)),
takeLatest( /* eslint-disable max-len */
EntryActionTypes.USER_TO_CARD_ADD, takeLatest(EntryActionTypes.USER_TO_CARD_ADD, ({ payload: { id, cardId } }) => addUserToCardService(id, cardId)),
({ 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( takeLatest(EntryActionTypes.USER_FROM_CURRENT_CARD_REMOVE, ({ payload: { id } }) => removeUserFromCurrentCardService(id)),
EntryActionTypes.USER_TO_CURRENT_CARD_ADD, takeLatest(EntryActionTypes.USER_TO_FILTER_IN_CURRENT_BOARD_ADD, ({ payload: { id } }) => addUserToFilterInCurrentBoardService(id)),
({ payload: { id } }) => addUserToCurrentCardService(id), takeLatest(EntryActionTypes.USER_FROM_FILTER_IN_CURRENT_BOARD_REMOVE, ({ payload: { id } }) => removeUserFromFilterInCurrentBoardService(id)),
), /* eslint-enable max-len */
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),
),
]); ]);
} }

View file

@ -11,10 +11,8 @@ export const pathnameSelector = ({
}, },
}) => pathname; }) => pathname;
export const pathsMatchSelector = createReselectSelector( // eslint-disable-next-line max-len
pathnameSelector, export const pathsMatchSelector = createReselectSelector(pathnameSelector, (pathname) => matchPaths(pathname, Object.values(Paths)));
(pathname) => matchPaths(pathname, Object.values(Paths)),
);
export const pathSelector = createReduxOrmSelector( export const pathSelector = createReduxOrmSelector(
orm, orm,

View file

@ -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"]
}
}

View file

@ -2,11 +2,11 @@ const bcrypt = require('bcrypt');
const Errors = { const Errors = {
EMAIL_NOT_EXIST: { EMAIL_NOT_EXIST: {
unauthorized: 'Email does not exist' unauthorized: 'Email does not exist',
}, },
PASSWORD_NOT_VALID: { PASSWORD_NOT_VALID: {
unauthorized: 'Password is not valid' unauthorized: 'Password is not valid',
} },
}; };
module.exports = { module.exports = {
@ -14,23 +14,23 @@ module.exports = {
email: { email: {
type: 'string', type: 'string',
required: true, required: true,
isEmail: true isEmail: true,
}, },
password: { password: {
type: 'string', type: 'string',
required: true required: true,
} },
}, },
exits: { exits: {
unauthorized: { unauthorized: {
responseType: 'unauthorized' responseType: 'unauthorized',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const user = await sails.helpers.getUser({ const user = await sails.helpers.getUser({
email: inputs.email.toLowerCase() email: inputs.email.toLowerCase(),
}); });
if (!user) { if (!user) {
@ -42,7 +42,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: sails.helpers.signToken(user.id) item: sails.helpers.signToken(user.id),
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,21 +9,21 @@ module.exports = {
cardId: { cardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
beforeId: { beforeId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/ regex: /^[0-9]+$/,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { project } = await sails.helpers const { project } = await sails.helpers
@ -32,17 +32,14 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
throw Errors.CARD_NOT_FOUND; // Forbidden throw Errors.CARD_NOT_FOUND; // Forbidden
} }
const actions = await sails.helpers.getActionsForCard( const actions = await sails.helpers.getActionsForCard(inputs.cardId, inputs.beforeId);
inputs.cardId,
inputs.beforeId
);
const userIds = sails.helpers.mapRecords(actions, 'userId', true); const userIds = sails.helpers.mapRecords(actions, 'userId', true);
const users = await sails.helpers.getUsers(userIds); const users = await sails.helpers.getUsers(userIds);
@ -50,8 +47,8 @@ module.exports = {
return exits.success({ return exits.success({
items: actions, items: actions,
included: { included: {
users users,
} },
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
PROJECT_NOT_FOUND: { PROJECT_NOT_FOUND: {
notFound: 'Project is not found' notFound: 'Project is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,25 +9,25 @@ module.exports = {
projectId: { projectId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
position: { position: {
type: 'number', type: 'number',
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const project = await Project.findOne(inputs.projectId); const project = await Project.findOne(inputs.projectId);
if (!project) { if (!project) {
@ -42,8 +42,8 @@ module.exports = {
item: board, item: board,
included: { included: {
lists: [], lists: [],
labels: [] labels: [],
} },
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
BOARD_NOT_FOUND: { BOARD_NOT_FOUND: {
notFound: 'Board is not found' notFound: 'Board is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,17 +9,17 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
let board = await Board.findOne(inputs.id); let board = await Board.findOne(inputs.id);
if (!board) { if (!board) {
@ -33,7 +33,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: board item: board,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
BOARD_NOT_FOUND: { BOARD_NOT_FOUND: {
notFound: 'Board is not found' notFound: 'Board is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,17 +9,17 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
// TODO: allow over HTTP without subscription // TODO: allow over HTTP without subscription
if (!this.req.isSocket) { if (!this.req.isSocket) {
return this.res.badRequest(); return this.res.badRequest();
@ -33,7 +33,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -48,7 +48,7 @@ module.exports = {
const cardSubscriptions = await sails.helpers.getSubscriptionsByUserForCard( const cardSubscriptions = await sails.helpers.getSubscriptionsByUserForCard(
cardIds, cardIds,
currentUser.id currentUser.id,
); );
const cardMemberships = await sails.helpers.getMembershipsForCard(cardIds); const cardMemberships = await sails.helpers.getMembershipsForCard(cardIds);
@ -59,12 +59,12 @@ module.exports = {
const isSubscribedByCardId = cardSubscriptions.reduce( const isSubscribedByCardId = cardSubscriptions.reduce(
(result, cardSubscription) => ({ (result, cardSubscription) => ({
...result, ...result,
[cardSubscription.cardId]: true [cardSubscription.cardId]: true,
}), }),
{} {},
); );
cards.forEach(card => { cards.forEach((card) => {
card.isSubscribed = isSubscribedByCardId[card.id] || false; card.isSubscribed = isSubscribedByCardId[card.id] || false;
}); });
@ -78,8 +78,8 @@ module.exports = {
cards, cards,
cardMemberships, cardMemberships,
cardLabels, cardLabels,
tasks tasks,
} },
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
BOARD_NOT_FOUND: { BOARD_NOT_FOUND: {
notFound: 'Board is not found' notFound: 'Board is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,24 +9,24 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
position: { position: {
type: 'number' type: 'number',
}, },
name: { name: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
let board = await Board.findOne(inputs.id); let board = await Board.findOne(inputs.id);
if (!board) { if (!board) {
@ -42,7 +42,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: board item: board,
}); });
} },
}; };

View file

@ -1,13 +1,13 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
}, },
LABEL_NOT_FOUND: { LABEL_NOT_FOUND: {
notFound: 'Label is not found' notFound: 'Label is not found',
}, },
CARD_LABEL_EXIST: { CARD_LABEL_EXIST: {
conflict: 'Card label is already exist' conflict: 'Card label is already exist',
} },
}; };
module.exports = { module.exports = {
@ -15,25 +15,25 @@ module.exports = {
cardId: { cardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
labelId: { labelId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
}, },
conflict: { conflict: {
responseType: 'conflict' responseType: 'conflict',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { card, project } = await sails.helpers const { card, project } = await sails.helpers
@ -42,7 +42,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -51,7 +51,7 @@ module.exports = {
const label = await Label.findOne({ const label = await Label.findOne({
id: inputs.labelId, id: inputs.labelId,
boardId: card.boardId boardId: card.boardId,
}); });
if (!label) { if (!label) {
@ -63,7 +63,7 @@ module.exports = {
.intercept('conflict', () => Errors.CARD_LABEL_EXIST); .intercept('conflict', () => Errors.CARD_LABEL_EXIST);
return exits.success({ return exits.success({
item: cardLabel item: cardLabel,
}); });
} },
}; };

View file

@ -1,10 +1,10 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
}, },
CARD_LABEL_NOT_FOUND: { CARD_LABEL_NOT_FOUND: {
notFound: 'Card label is not found' notFound: 'Card label is not found',
} },
}; };
module.exports = { module.exports = {
@ -12,22 +12,22 @@ module.exports = {
cardId: { cardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
labelId: { labelId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { board, project } = await sails.helpers const { board, project } = await sails.helpers
@ -36,7 +36,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -45,7 +45,7 @@ module.exports = {
let cardLabel = await CardLabel.findOne({ let cardLabel = await CardLabel.findOne({
cardId: inputs.cardId, cardId: inputs.cardId,
labelId: inputs.labelId labelId: inputs.labelId,
}); });
if (!cardLabel) { if (!cardLabel) {
@ -59,7 +59,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: cardLabel item: cardLabel,
}); });
} },
}; };

View file

@ -1,13 +1,13 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
}, },
USER_NOT_FOUND: { USER_NOT_FOUND: {
notFound: 'User is not found' notFound: 'User is not found',
}, },
CARD_MEMBERSHIP_EXIST: { CARD_MEMBERSHIP_EXIST: {
conflict: 'Card membership is already exist' conflict: 'Card membership is already exist',
} },
}; };
module.exports = { module.exports = {
@ -15,25 +15,25 @@ module.exports = {
cardId: { cardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
userId: { userId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
}, },
conflict: { conflict: {
responseType: 'conflict' responseType: 'conflict',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { card, project } = await sails.helpers const { card, project } = await sails.helpers
@ -42,17 +42,14 @@ module.exports = {
let isUserMemberForProject = await sails.helpers.isUserMemberForProject( let isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
throw Errors.CARD_NOT_FOUND; // Forbidden throw Errors.CARD_NOT_FOUND; // Forbidden
} }
isUserMemberForProject = await sails.helpers.isUserMemberForProject( isUserMemberForProject = await sails.helpers.isUserMemberForProject(project.id, inputs.userId);
project.id,
inputs.userId
);
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
throw Errors.USER_NOT_FOUND; throw Errors.USER_NOT_FOUND;
@ -63,7 +60,7 @@ module.exports = {
.intercept('conflict', () => Errors.CARD_MEMBERSHIP_EXIST); .intercept('conflict', () => Errors.CARD_MEMBERSHIP_EXIST);
return exits.success({ return exits.success({
item: cardMembership item: cardMembership,
}); });
} },
}; };

View file

@ -1,10 +1,10 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
}, },
CARD_MEMBERSHIP_NOT_FOUND: { CARD_MEMBERSHIP_NOT_FOUND: {
notFound: 'Card membership is not found' notFound: 'Card membership is not found',
} },
}; };
module.exports = { module.exports = {
@ -12,22 +12,22 @@ module.exports = {
cardId: { cardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
userId: { userId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { board, project } = await sails.helpers const { board, project } = await sails.helpers
@ -36,7 +36,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -45,25 +45,21 @@ module.exports = {
let cardMembership = await CardMembership.findOne({ let cardMembership = await CardMembership.findOne({
cardId: inputs.cardId, cardId: inputs.cardId,
userId: inputs.userId userId: inputs.userId,
}); });
if (!cardMembership) { if (!cardMembership) {
throw Errors.CARD_MEMBERSHIP_NOT_FOUND; throw Errors.CARD_MEMBERSHIP_NOT_FOUND;
} }
cardMembership = await sails.helpers.deleteCardMembership( cardMembership = await sails.helpers.deleteCardMembership(cardMembership, board, this.req);
cardMembership,
board,
this.req
);
if (!cardMembership) { if (!cardMembership) {
throw Errors.CARD_MEMBERSHIP_NOT_FOUND; throw Errors.CARD_MEMBERSHIP_NOT_FOUND;
} }
return exits.success({ return exits.success({
item: cardMembership item: cardMembership,
}); });
} },
}; };

View file

@ -2,8 +2,8 @@ const moment = require('moment');
const Errors = { const Errors = {
LIST_NOT_FOUND: { LIST_NOT_FOUND: {
notFound: 'List is not found' notFound: 'List is not found',
} },
}; };
module.exports = { module.exports = {
@ -11,43 +11,41 @@ module.exports = {
listId: { listId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
position: { position: {
type: 'number', type: 'number',
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
required: true required: true,
}, },
description: { description: {
type: 'string', type: 'string',
isNotEmptyString: true, isNotEmptyString: true,
allowNull: true allowNull: true,
}, },
dueDate: { dueDate: {
type: 'string', type: 'string',
custom: value => moment(value, moment.ISO_8601, true).isValid() custom: (value) => moment(value, moment.ISO_8601, true).isValid(),
}, },
timer: { timer: {
type: 'json', type: 'json',
custom: value => custom: (value) => _.isPlainObject(value)
_.isPlainObject(value) && && _.size(value) === 2
_.size(value) === 2 && && (_.isNull(value.startedAt) || moment(value.startedAt, moment.ISO_8601, true).isValid())
(_.isNull(value.startedAt) || && _.isFinite(value.total),
moment(value.startedAt, moment.ISO_8601, true).isValid()) && },
_.isFinite(value.total)
}
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { list, project } = await sails.helpers const { list, project } = await sails.helpers
@ -56,30 +54,19 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
throw Errors.LIST_NOT_FOUND; // Forbidden throw Errors.LIST_NOT_FOUND; // Forbidden
} }
const values = _.pick(inputs, [ const values = _.pick(inputs, ['position', 'name', 'description', 'dueDate', 'timer']);
'position',
'name',
'description',
'dueDate',
'timer'
]);
const card = await sails.helpers.createCard( const card = await sails.helpers.createCard(list, values, currentUser, this.req);
list,
values,
currentUser,
this.req
);
return exits.success({ return exits.success({
item: card item: card,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,26 +9,29 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { card, project } = await sails.helpers const cardToProjectPath = await sails.helpers
.getCardToProjectPath(inputs.id) .getCardToProjectPath(inputs.id)
.intercept('notFound', () => Errors.CARD_NOT_FOUND); .intercept('notFound', () => Errors.CARD_NOT_FOUND);
let { card } = cardToProjectPath;
const { project } = cardToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -42,7 +45,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: card item: card,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,17 +9,17 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { card, project } = await sails.helpers const { card, project } = await sails.helpers
@ -28,7 +28,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -36,7 +36,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: card item: card,
}); });
} },
}; };

View file

@ -2,11 +2,11 @@ const moment = require('moment');
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
}, },
LIST_NOT_FOUND: { LIST_NOT_FOUND: {
notFound: 'List is not found' notFound: 'List is not found',
} },
}; };
module.exports = { module.exports = {
@ -14,59 +14,60 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
listId: { listId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/ regex: /^[0-9]+$/,
}, },
position: { position: {
type: 'number' type: 'number',
}, },
name: { name: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
}, },
description: { description: {
type: 'string', type: 'string',
isNotEmptyString: true, isNotEmptyString: true,
allowNull: true allowNull: true,
}, },
dueDate: { dueDate: {
type: 'string', type: 'string',
custom: value => moment(value, moment.ISO_8601, true).isValid(), custom: (value) => moment(value, moment.ISO_8601, true).isValid(),
allowNull: true allowNull: true,
}, },
timer: { timer: {
type: 'json', type: 'json',
custom: value => custom: (value) => _.isPlainObject(value)
_.isPlainObject(value) && && _.size(value) === 2
_.size(value) === 2 && && (_.isNull(value.startedAt) || moment(value.startedAt, moment.ISO_8601, true).isValid())
(_.isNull(value.startedAt) || && _.isFinite(value.total),
moment(value.startedAt, moment.ISO_8601, true).isValid()) &&
_.isFinite(value.total)
}, },
isSubscribed: { isSubscribed: {
type: 'boolean' type: 'boolean',
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { card, list, project } = await sails.helpers const cardToProjectPath = await sails.helpers
.getCardToProjectPath(inputs.id) .getCardToProjectPath(inputs.id)
.intercept('notFound', () => Errors.CARD_NOT_FOUND); .intercept('notFound', () => Errors.CARD_NOT_FOUND);
let { card } = cardToProjectPath;
const { list, project } = cardToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -77,7 +78,7 @@ module.exports = {
if (!_.isUndefined(inputs.listId) && inputs.listId !== list.id) { if (!_.isUndefined(inputs.listId) && inputs.listId !== list.id) {
toList = await List.findOne({ toList = await List.findOne({
id: inputs.listId, id: inputs.listId,
boardId: card.boardId boardId: card.boardId,
}); });
if (!toList) { if (!toList) {
@ -91,24 +92,17 @@ module.exports = {
'description', 'description',
'dueDate', 'dueDate',
'timer', 'timer',
'isSubscribed' 'isSubscribed',
]); ]);
card = await sails.helpers.updateCard( card = await sails.helpers.updateCard(card, values, toList, list, currentUser, this.req);
card,
values,
toList,
list,
currentUser,
this.req
);
if (!card) { if (!card) {
throw Errors.CARD_NOT_FOUND; throw Errors.CARD_NOT_FOUND;
} }
return exits.success({ return exits.success({
item: card item: card,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,21 +9,21 @@ module.exports = {
cardId: { cardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
text: { text: {
type: 'string', type: 'string',
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { card, project } = await sails.helpers const { card, project } = await sails.helpers
@ -32,7 +32,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -41,13 +41,13 @@ module.exports = {
const values = { const values = {
type: 'commentCard', type: 'commentCard',
data: _.pick(inputs, ['text']) data: _.pick(inputs, ['text']),
}; };
const action = await sails.helpers.createAction(card, currentUser, values, this.req); const action = await sails.helpers.createAction(card, currentUser, values, this.req);
return exits.success({ return exits.success({
item: action item: action,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
COMMENT_ACTION_NOT_FOUND: { COMMENT_ACTION_NOT_FOUND: {
notFound: 'Comment action is not found' notFound: 'Comment action is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,35 +9,38 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const criteria = { const criteria = {
id: inputs.id, id: inputs.id,
type: 'commentCard' type: 'commentCard',
}; };
if (!currentUser.isAdmin) { if (!currentUser.isAdmin) {
criteria.userId = currentUser.id; criteria.userId = currentUser.id;
} }
let { action, board, project } = await sails.helpers const actionToProjectPath = await sails.helpers
.getActionToProjectPath(criteria) .getActionToProjectPath(criteria)
.intercept('notFound', () => Errors.COMMENT_ACTION_NOT_FOUND); .intercept('notFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
let { action } = actionToProjectPath;
const { board, project } = actionToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -51,7 +54,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: action item: action,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
COMMENT_ACTION_NOT_FOUND: { COMMENT_ACTION_NOT_FOUND: {
notFound: 'Comment action is not found' notFound: 'Comment action is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,34 +9,37 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
text: { text: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { action, board, project } = await sails.helpers const actionToProjectPath = await sails.helpers
.getActionToProjectPath({ .getActionToProjectPath({
id: inputs.id, id: inputs.id,
type: 'commentCard', type: 'commentCard',
userId: currentUser.id userId: currentUser.id,
}) })
.intercept('notFound', () => Errors.COMMENT_ACTION_NOT_FOUND); .intercept('notFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
let { action } = actionToProjectPath;
const { board, project } = actionToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -44,7 +47,7 @@ module.exports = {
} }
const values = { const values = {
data: _.pick(inputs, ['text']) data: _.pick(inputs, ['text']),
}; };
action = await sails.helpers.updateAction(action, values, board, this.req); action = await sails.helpers.updateAction(action, values, board, this.req);
@ -54,7 +57,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: action item: action,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
BOARD_NOT_FOUND: { BOARD_NOT_FOUND: {
notFound: 'Board is not found' notFound: 'Board is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,27 +9,27 @@ module.exports = {
boardId: { boardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
isNotEmptyString: true, isNotEmptyString: true,
allowNull: true allowNull: true,
}, },
color: { color: {
type: 'string', type: 'string',
isIn: Label.COLORS, isIn: Label.COLORS,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { board, project } = await sails.helpers const { board, project } = await sails.helpers
@ -38,7 +38,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -50,7 +50,7 @@ module.exports = {
const label = await sails.helpers.createLabel(board, values, this.req); const label = await sails.helpers.createLabel(board, values, this.req);
return exits.success({ return exits.success({
item: label item: label,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
LABEL_NOT_FOUND: { LABEL_NOT_FOUND: {
notFound: 'Label is not found' notFound: 'Label is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,26 +9,29 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { label, project } = await sails.helpers const labelToProjectPath = await sails.helpers
.getLabelToProjectPath(inputs.id) .getLabelToProjectPath(inputs.id)
.intercept('notFound', () => Errors.LABEL_NOT_FOUND); .intercept('notFound', () => Errors.LABEL_NOT_FOUND);
let { label } = labelToProjectPath;
const { project } = labelToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -42,7 +45,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: label item: label,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
LABEL_NOT_FOUND: { LABEL_NOT_FOUND: {
notFound: 'Label is not found' notFound: 'Label is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,36 +9,39 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
isNotEmptyString: true, isNotEmptyString: true,
allowNull: true allowNull: true,
}, },
color: { color: {
type: 'string', type: 'string',
isIn: Label.COLORS, isIn: Label.COLORS,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { label, project } = await sails.helpers const labelToProjectPath = await sails.helpers
.getLabelToProjectPath(inputs.id) .getLabelToProjectPath(inputs.id)
.intercept('notFound', () => Errors.LABEL_NOT_FOUND); .intercept('notFound', () => Errors.LABEL_NOT_FOUND);
let { label } = labelToProjectPath;
const { project } = labelToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -50,7 +53,7 @@ module.exports = {
label = await sails.helpers.updateLabel(label, values, this.req); label = await sails.helpers.updateLabel(label, values, this.req);
return exits.success({ return exits.success({
item: label item: label,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
BOARD_NOT_FOUND: { BOARD_NOT_FOUND: {
notFound: 'Board is not found' notFound: 'Board is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,25 +9,25 @@ module.exports = {
boardId: { boardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
position: { position: {
type: 'number', type: 'number',
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { board, project } = await sails.helpers const { board, project } = await sails.helpers
@ -36,7 +36,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -48,7 +48,7 @@ module.exports = {
const list = await sails.helpers.createList(board, values, this.req); const list = await sails.helpers.createList(board, values, this.req);
return exits.success({ return exits.success({
item: list item: list,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
LIST_NOT_FOUND: { LIST_NOT_FOUND: {
notFound: 'List is not found' notFound: 'List is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,26 +9,29 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { list, project } = await sails.helpers const listToProjectPath = await sails.helpers
.getListToProjectPath(inputs.id) .getListToProjectPath(inputs.id)
.intercept('notFound', () => Errors.LIST_NOT_FOUND); .intercept('notFound', () => Errors.LIST_NOT_FOUND);
let { list } = listToProjectPath;
const { project } = listToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -42,7 +45,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: list item: list,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
LIST_NOT_FOUND: { LIST_NOT_FOUND: {
notFound: 'List is not found' notFound: 'List is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,33 +9,36 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
position: { position: {
type: 'number' type: 'number',
}, },
name: { name: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { list, project } = await sails.helpers const listToProjectPath = await sails.helpers
.getListToProjectPath(inputs.id) .getListToProjectPath(inputs.id)
.intercept('notFound', () => Errors.LIST_NOT_FOUND); .intercept('notFound', () => Errors.LIST_NOT_FOUND);
let { list } = listToProjectPath;
const { project } = listToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -51,7 +54,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: list item: list,
}); });
} },
}; };

View file

@ -1,10 +1,8 @@
module.exports = { module.exports = {
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const notifications = await sails.helpers.getNotificationsForUser( const notifications = await sails.helpers.getNotificationsForUser(currentUser.id);
currentUser.id
);
const actionIds = sails.helpers.mapRecords(notifications, 'actionId'); const actionIds = sails.helpers.mapRecords(notifications, 'actionId');
const actions = await sails.helpers.getActions(actionIds); const actions = await sails.helpers.getActions(actionIds);
@ -20,8 +18,8 @@ module.exports = {
included: { included: {
users, users,
cards, cards,
actions actions,
} },
}); });
} },
}; };

View file

@ -3,20 +3,20 @@ module.exports = {
ids: { ids: {
type: 'string', type: 'string',
required: true, required: true,
regex: /^[0-9]+(,[0-9]+)*$/ regex: /^[0-9]+(,[0-9]+)*$/,
}, },
isRead: { isRead: {
type: 'boolean' type: 'boolean',
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const values = _.pick(inputs, ['isRead']); const values = _.pick(inputs, ['isRead']);
@ -25,11 +25,11 @@ module.exports = {
inputs.ids.split(','), inputs.ids.split(','),
currentUser, currentUser,
values, values,
this.req this.req,
); );
return exits.success({ return exits.success({
items: notifications items: notifications,
}); });
} },
}; };

View file

@ -1,13 +1,13 @@
const Errors = { const Errors = {
PROJECT_NOT_FOUND: { PROJECT_NOT_FOUND: {
notFound: 'Project is not found' notFound: 'Project is not found',
}, },
USER_NOT_FOUND: { USER_NOT_FOUND: {
notFound: 'User is not found' notFound: 'User is not found',
}, },
PROJECT_MEMBERSHIP_EXIST: { PROJECT_MEMBERSHIP_EXIST: {
conflict: 'Project membership is already exist' conflict: 'Project membership is already exist',
} },
}; };
module.exports = { module.exports = {
@ -15,25 +15,25 @@ module.exports = {
projectId: { projectId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
userId: { userId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
}, },
conflict: { conflict: {
responseType: 'conflict' responseType: 'conflict',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const project = await Project.findOne(inputs.projectId); const project = await Project.findOne(inputs.projectId);
if (!project) { if (!project) {
@ -53,8 +53,8 @@ module.exports = {
return exits.success({ return exits.success({
item: projectMembership, item: projectMembership,
included: { included: {
users: [user] users: [user],
} },
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
PROJECT_MEMBERSHIP_NOT_FOUND: { PROJECT_MEMBERSHIP_NOT_FOUND: {
notFound: 'Project membership is not found' notFound: 'Project membership is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,34 +9,31 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
let projectMembership = await ProjectMembership.findOne(inputs.id); let projectMembership = await ProjectMembership.findOne(inputs.id);
if (!projectMembership) { if (!projectMembership) {
throw Errors.PROJECT_MEMBERSHIP_NOT_FOUND; throw Errors.PROJECT_MEMBERSHIP_NOT_FOUND;
} }
projectMembership = await sails.helpers.deleteProjectMembership( projectMembership = await sails.helpers.deleteProjectMembership(projectMembership, this.req);
projectMembership,
this.req
);
if (!projectMembership) { if (!projectMembership) {
throw Errors.PROJECT_MEMBERSHIP_NOT_FOUND; throw Errors.PROJECT_MEMBERSHIP_NOT_FOUND;
} }
return exits.success({ return exits.success({
item: projectMembership item: projectMembership,
}); });
} },
}; };

View file

@ -2,11 +2,11 @@ module.exports = {
inputs: { inputs: {
name: { name: {
type: 'string', type: 'string',
required: true required: true,
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const values = _.pick(inputs, ['name']); const values = _.pick(inputs, ['name']);
@ -15,7 +15,7 @@ module.exports = {
values, values,
currentUser, currentUser,
this.req, this.req,
true true,
); );
return exits.success({ return exits.success({
@ -23,8 +23,8 @@ module.exports = {
included: { included: {
users: [currentUser], users: [currentUser],
projectMemberships: [projectMembership], projectMemberships: [projectMembership],
boards: [] boards: [],
} },
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
PROJECT_NOT_FOUND: { PROJECT_NOT_FOUND: {
notFound: 'Project is not found' notFound: 'Project is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,17 +9,17 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
let project = await Project.findOne(inputs.id); let project = await Project.findOne(inputs.id);
if (!project) { if (!project) {
@ -33,7 +33,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: project item: project,
}); });
} },
}; };

View file

@ -1,17 +1,15 @@
module.exports = { module.exports = {
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const projectIds = await sails.helpers.getMembershipProjectIdsForUser( const projectIds = await sails.helpers.getMembershipProjectIdsForUser(currentUser.id);
currentUser.id
);
const projects = await sails.helpers.getProjects(projectIds); const projects = await sails.helpers.getProjects(projectIds);
const { const { userIds, projectMemberships } = await sails.helpers.getMembershipUserIdsForProject(
userIds, projectIds,
projectMemberships true,
} = await sails.helpers.getMembershipUserIdsForProject(projectIds, true); );
const users = await sails.helpers.getUsers(userIds); const users = await sails.helpers.getUsers(userIds);
@ -22,8 +20,8 @@ module.exports = {
included: { included: {
users, users,
projectMemberships, projectMemberships,
boards boards,
} },
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
PROJECT_NOT_FOUND: { PROJECT_NOT_FOUND: {
notFound: 'Project is not found' notFound: 'Project is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,21 +9,21 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
let project = await Project.findOne(inputs.id); let project = await Project.findOne(inputs.id);
if (!project) { if (!project) {
@ -39,7 +39,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: project item: project,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
CARD_NOT_FOUND: { CARD_NOT_FOUND: {
notFound: 'Card is not found' notFound: 'Card is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,24 +9,24 @@ module.exports = {
cardId: { cardId: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
required: true required: true,
}, },
isCompleted: { isCompleted: {
type: 'boolean' type: 'boolean',
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { card, project } = await sails.helpers const { card, project } = await sails.helpers
@ -35,7 +35,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -47,7 +47,7 @@ module.exports = {
const task = await sails.helpers.createTask(card, values, this.req); const task = await sails.helpers.createTask(card, values, this.req);
return exits.success({ return exits.success({
item: task item: task,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
TASK_NOT_FOUND: { TASK_NOT_FOUND: {
notFound: 'Task is not found' notFound: 'Task is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,26 +9,29 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { task, board, project } = await sails.helpers const taskToProjectPath = await sails.helpers
.getTaskToProjectPath(inputs.id) .getTaskToProjectPath(inputs.id)
.intercept('notFound', () => Errors.TASK_NOT_FOUND); .intercept('notFound', () => Errors.TASK_NOT_FOUND);
let { task } = taskToProjectPath;
const { board, project } = taskToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -42,7 +45,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: task item: task,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
TASK_NOT_FOUND: { TASK_NOT_FOUND: {
notFound: 'Task is not found' notFound: 'Task is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,33 +9,36 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
}, },
isCompleted: { isCompleted: {
type: 'boolean' type: 'boolean',
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { task, board, project } = await sails.helpers const taskToProjectPath = await sails.helpers
.getTaskToProjectPath(inputs.id) .getTaskToProjectPath(inputs.id)
.intercept('notFound', () => Errors.TASK_NOT_FOUND); .intercept('notFound', () => Errors.TASK_NOT_FOUND);
let { task } = taskToProjectPath;
const { board, project } = taskToProjectPath;
const isUserMemberForProject = await sails.helpers.isUserMemberForProject( const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id, project.id,
currentUser.id currentUser.id,
); );
if (!isUserMemberForProject) { if (!isUserMemberForProject) {
@ -51,7 +54,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: task item: task,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
USER_EXIST: { USER_EXIST: {
conflict: 'User is already exist' conflict: 'User is already exist',
} },
}; };
module.exports = { module.exports = {
@ -9,25 +9,25 @@ module.exports = {
email: { email: {
type: 'string', type: 'string',
isEmail: true, isEmail: true,
required: true required: true,
}, },
password: { password: {
type: 'string', type: 'string',
required: true required: true,
}, },
name: { name: {
type: 'string', type: 'string',
required: true required: true,
} },
}, },
exits: { exits: {
conflict: { conflict: {
responseType: 'conflict' responseType: 'conflict',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const values = _.pick(inputs, ['email', 'password', 'name']); const values = _.pick(inputs, ['email', 'password', 'name']);
const user = await sails.helpers const user = await sails.helpers
@ -35,7 +35,7 @@ module.exports = {
.intercept('conflict', () => Errors.USER_EXIST); .intercept('conflict', () => Errors.USER_EXIST);
return exits.success({ return exits.success({
item: user item: user,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
USER_NOT_FOUND: { USER_NOT_FOUND: {
notFound: 'User is not found' notFound: 'User is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,17 +9,17 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
let user = await sails.helpers.getUser(inputs.id); let user = await sails.helpers.getUser(inputs.id);
if (!user) { if (!user) {
@ -33,7 +33,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: user item: user,
}); });
} },
}; };

View file

@ -1,9 +1,9 @@
module.exports = { module.exports = {
fn: async function(inputs, exits) { async fn(inputs, exits) {
const users = await sails.helpers.getUsers(); const users = await sails.helpers.getUsers();
return exits.success({ return exits.success({
items: users items: users,
}); });
} },
}; };

View file

@ -1,5 +1,5 @@
module.exports = { module.exports = {
fn: async function(inputs, exits) { async fn(inputs, exits) {
// TODO: allow over HTTP without subscription // TODO: allow over HTTP without subscription
if (!this.req.isSocket) { if (!this.req.isSocket) {
return this.res.badRequest(); return this.res.badRequest();
@ -10,7 +10,7 @@ module.exports = {
sails.sockets.join(this.req, `user:${currentUser.id}`); // TODO: only when subscription needed sails.sockets.join(this.req, `user:${currentUser.id}`); // TODO: only when subscription needed
return exits.success({ return exits.success({
item: currentUser item: currentUser,
}); });
} },
}; };

View file

@ -2,14 +2,14 @@ const bcrypt = require('bcrypt');
const Errors = { const Errors = {
USER_NOT_FOUND: { USER_NOT_FOUND: {
notFound: 'User is not found' notFound: 'User is not found',
}, },
CURRENT_PASSWORD_NOT_VALID: { CURRENT_PASSWORD_NOT_VALID: {
forbidden: 'Current password is not valid' forbidden: 'Current password is not valid',
}, },
USER_EXIST: { USER_EXIST: {
conflict: 'User is already exist' conflict: 'User is already exist',
} },
}; };
module.exports = { module.exports = {
@ -17,32 +17,32 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
email: { email: {
type: 'string', type: 'string',
isEmail: true, isEmail: true,
required: true required: true,
}, },
currentPassword: { currentPassword: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
}, },
forbidden: { forbidden: {
responseType: 'forbidden' responseType: 'forbidden',
}, },
conflict: { conflict: {
responseType: 'conflict' responseType: 'conflict',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
if (inputs.id === currentUser.id) { if (inputs.id === currentUser.id) {
@ -60,8 +60,8 @@ module.exports = {
} }
if ( if (
inputs.id === currentUser.id && inputs.id === currentUser.id
!bcrypt.compareSync(inputs.currentPassword, user.password) && !bcrypt.compareSync(inputs.currentPassword, user.password)
) { ) {
throw Errors.CURRENT_PASSWORD_NOT_VALID; throw Errors.CURRENT_PASSWORD_NOT_VALID;
} }
@ -77,7 +77,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: user.email item: user.email,
}); });
} },
}; };

View file

@ -2,11 +2,11 @@ const bcrypt = require('bcrypt');
const Errors = { const Errors = {
USER_NOT_FOUND: { USER_NOT_FOUND: {
notFound: 'User is not found' notFound: 'User is not found',
}, },
CURRENT_PASSWORD_NOT_VALID: { CURRENT_PASSWORD_NOT_VALID: {
forbidden: 'Current password is not valid' forbidden: 'Current password is not valid',
} },
}; };
module.exports = { module.exports = {
@ -14,28 +14,28 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
password: { password: {
type: 'string', type: 'string',
required: true required: true,
}, },
currentPassword: { currentPassword: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
}, },
forbidden: { forbidden: {
responseType: 'forbidden' responseType: 'forbidden',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
if (inputs.id === currentUser.id) { if (inputs.id === currentUser.id) {
@ -53,8 +53,8 @@ module.exports = {
} }
if ( if (
inputs.id === currentUser.id && inputs.id === currentUser.id
!bcrypt.compareSync(inputs.currentPassword, user.password) && !bcrypt.compareSync(inputs.currentPassword, user.password)
) { ) {
throw Errors.CURRENT_PASSWORD_NOT_VALID; throw Errors.CURRENT_PASSWORD_NOT_VALID;
} }
@ -68,7 +68,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: null item: null,
}); });
} },
}; };

View file

@ -1,7 +1,7 @@
const Errors = { const Errors = {
USER_NOT_FOUND: { USER_NOT_FOUND: {
notFound: 'User is not found' notFound: 'User is not found',
} },
}; };
module.exports = { module.exports = {
@ -9,28 +9,28 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
}, },
isAdmin: { isAdmin: {
type: 'boolean' type: 'boolean',
}, },
name: { name: {
type: 'string', type: 'string',
isNotEmptyString: true isNotEmptyString: true,
}, },
avatar: { avatar: {
type: 'json', type: 'json',
custom: value => _.isNull(value) custom: (value) => _.isNull(value),
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
if (!currentUser.isAdmin) { if (!currentUser.isAdmin) {
@ -56,7 +56,7 @@ module.exports = {
} }
return exits.success({ return exits.success({
item: user item: user,
}); });
} },
}; };

View file

@ -1,27 +1,31 @@
const stream = require('stream');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const util = require('util');
const stream = require('stream');
const uuid = require('uuid/v4'); const uuid = require('uuid/v4');
const sharp = require('sharp'); const sharp = require('sharp');
const Errors = { const Errors = {
USER_NOT_FOUND: { USER_NOT_FOUND: {
notFound: 'User is not found' notFound: 'User is not found',
} },
}; };
const pipeline = util.promisify(stream.pipeline);
const createReceiver = () => { const createReceiver = () => {
const receiver = require('stream').Writable({ objectMode: true }); const receiver = stream.Writable({ objectMode: true });
let firstFileHandled = false; let firstFileHandled = false;
receiver._write = (file, encoding, done) => { // eslint-disable-next-line no-underscore-dangle
receiver._write = async (file, receiverEncoding, done) => {
if (firstFileHandled) { if (firstFileHandled) {
file.pipe( file.pipe(
new stream.Writable({ new stream.Writable({
write(chunk, encoding, callback) { write(chunk, streamEncoding, callback) {
callback(); callback();
} },
}) }),
); );
return done(); return done();
@ -33,30 +37,25 @@ const createReceiver = () => {
.jpeg(); .jpeg();
const transform = new stream.Transform({ const transform = new stream.Transform({
transform(chunk, encoding, callback) { transform(chunk, streamEncoding, callback) {
callback(null, chunk); callback(null, chunk);
} },
}); });
stream.pipeline(file, resize, transform, error => { try {
if (error) { await pipeline(file, resize, transform);
return done(error.message);
}
file.fd = `${uuid()}.jpg`; file.fd = `${uuid()}.jpg`;
const output = fs.createWriteStream( await pipeline(
path.join(sails.config.custom.uploadsPath, file.fd) transform,
fs.createWriteStream(path.join(sails.config.custom.uploadsPath, file.fd)),
); );
stream.pipeline(transform, output, error => { return done();
if (error) { } catch (error) {
return done(error); return done(error);
} }
done();
});
});
}; };
return receiver; return receiver;
@ -67,20 +66,20 @@ module.exports = {
id: { id: {
type: 'string', type: 'string',
regex: /^[0-9]+$/, regex: /^[0-9]+$/,
required: true required: true,
} },
}, },
exits: { exits: {
notFound: { notFound: {
responseType: 'notFound' responseType: 'notFound',
}, },
unprocessableEntity: { unprocessableEntity: {
responseType: 'unprocessableEntity' responseType: 'unprocessableEntity',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
let user; let user;
@ -98,7 +97,7 @@ module.exports = {
this.req.file('file').upload(createReceiver(), async (error, files) => { this.req.file('file').upload(createReceiver(), async (error, files) => {
if (error) { if (error) {
return exits.unprocessableEntity(error); return exits.unprocessableEntity(error.message);
} }
if (files.length === 0) { if (files.length === 0) {
@ -108,18 +107,18 @@ module.exports = {
user = await sails.helpers.updateUser( user = await sails.helpers.updateUser(
user, user,
{ {
avatar: files[0].fd avatar: files[0].fd,
}, },
this.req this.req,
); );
if (!user) { if (!user) {
throw Errors.USER_NOT_FOUND; throw Errors.USER_NOT_FOUND;
} }
return this.res.json({ return exits.success({
item: user.avatar item: user.toJSON().avatar,
}); });
}); });
} },
}; };

View file

@ -2,47 +2,44 @@ module.exports = {
inputs: { inputs: {
card: { card: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
user: { user: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
values: { values: {
type: 'json', type: 'json',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const action = await Action.create({ const action = await Action.create({
...inputs.values, ...inputs.values,
cardId: inputs.card.id, cardId: inputs.card.id,
userId: inputs.user.id userId: inputs.user.id,
}).fetch(); }).fetch();
sails.sockets.broadcast( sails.sockets.broadcast(
`board:${inputs.card.boardId}`, `board:${inputs.card.boardId}`,
'actionCreate', 'actionCreate',
{ {
item: action item: action,
}, },
inputs.request inputs.request,
); );
const userIds = await sails.helpers.getSubscriptionUserIdsForCard( const userIds = await sails.helpers.getSubscriptionUserIdsForCard(action.cardId, action.userId);
action.cardId,
action.userId
);
userIds.forEach(async userId => { userIds.forEach(async (userId) => {
const notification = await Notification.create({ const notification = await Notification.create({
userId, userId,
actionId: action.id, actionId: action.id,
cardId: action.cardId cardId: action.cardId,
}).fetch(); }).fetch();
sails.sockets.broadcast(`user:${userId}`, 'notificationCreate', { sails.sockets.broadcast(`user:${userId}`, 'notificationCreate', {
@ -50,11 +47,11 @@ module.exports = {
included: { included: {
users: [inputs.user], users: [inputs.user],
cards: [inputs.card], cards: [inputs.card],
actions: [action] actions: [action],
} },
}); });
}); });
return exits.success(action); return exits.success(action);
} },
}; };

View file

@ -2,44 +2,42 @@ module.exports = {
inputs: { inputs: {
project: { project: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
values: { values: {
type: 'json', type: 'json',
custom: value => _.isPlainObject(value) && _.isFinite(value.position), custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const boards = await sails.helpers.getBoardsForProject(inputs.project.id); const boards = await sails.helpers.getBoardsForProject(inputs.project.id);
const { position, repositions } = sails.helpers.insertToPositionables( const { position, repositions } = sails.helpers.insertToPositionables(
inputs.values.position, inputs.values.position,
boards boards,
); );
const userIds = await sails.helpers.getMembershipUserIdsForProject( const userIds = await sails.helpers.getMembershipUserIdsForProject(inputs.project.id);
inputs.project.id
);
repositions.forEach(async ({ id, position }) => { repositions.forEach(async ({ id, position: nextPosition }) => {
await Board.update({ await Board.update({
id, id,
projectId: inputs.project.id projectId: inputs.project.id,
}).set({ }).set({
position position: nextPosition,
}); });
userIds.forEach(userId => { userIds.forEach((userId) => {
sails.sockets.broadcast(`user:${userId}`, 'boardUpdate', { sails.sockets.broadcast(`user:${userId}`, 'boardUpdate', {
item: { item: {
id, id,
position position: nextPosition,
} },
}); });
}); });
}); });
@ -47,10 +45,10 @@ module.exports = {
const board = await Board.create({ const board = await Board.create({
...inputs.values, ...inputs.values,
position, position,
projectId: inputs.project.id projectId: inputs.project.id,
}).fetch(); }).fetch();
userIds.forEach(userId => { userIds.forEach((userId) => {
sails.sockets.broadcast( sails.sockets.broadcast(
`user:${userId}`, `user:${userId}`,
'boardCreate', 'boardCreate',
@ -58,13 +56,13 @@ module.exports = {
item: board, item: board,
included: { included: {
lists: [], lists: [],
labels: [] labels: [],
} },
}, },
inputs.request inputs.request,
); );
}); });
return exits.success(board); return exits.success(board);
} },
}; };

View file

@ -2,21 +2,21 @@ module.exports = {
inputs: { inputs: {
card: { card: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
label: { label: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const cardLabel = await CardLabel.create({ const cardLabel = await CardLabel.create({
cardId: inputs.card.id, cardId: inputs.card.id,
labelId: inputs.label.id labelId: inputs.label.id,
}) })
.intercept('E_UNIQUE', 'conflict') .intercept('E_UNIQUE', 'conflict')
.fetch(); .fetch();
@ -25,11 +25,11 @@ module.exports = {
`board:${inputs.card.boardId}`, `board:${inputs.card.boardId}`,
'cardLabelCreate', 'cardLabelCreate',
{ {
item: cardLabel item: cardLabel,
}, },
inputs.request inputs.request,
); );
return exits.success(cardLabel); return exits.success(cardLabel);
} },
}; };

View file

@ -2,24 +2,24 @@ module.exports = {
inputs: { inputs: {
card: { card: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
userOrUserId: { userOrUserId: {
type: 'ref', type: 'ref',
custom: value => _.isPlainObject(value) || _.isString(value), custom: (value) => _.isPlainObject(value) || _.isString(value),
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const { userId = inputs.userOrUserId } = inputs.userOrUserId; const { userId = inputs.userOrUserId } = inputs.userOrUserId;
const cardMembership = await CardMembership.create({ const cardMembership = await CardMembership.create({
userId, userId,
cardId: inputs.card.id cardId: inputs.card.id,
}) })
.intercept('E_UNIQUE', 'conflict') .intercept('E_UNIQUE', 'conflict')
.fetch(); .fetch();
@ -28,15 +28,15 @@ module.exports = {
`board:${inputs.card.boardId}`, `board:${inputs.card.boardId}`,
'cardMembershipCreate', 'cardMembershipCreate',
{ {
item: cardMembership item: cardMembership,
}, },
inputs.request inputs.request,
); );
const cardSubscription = await CardSubscription.create({ const cardSubscription = await CardSubscription.create({
cardId: cardMembership.cardId, cardId: cardMembership.cardId,
userId: cardMembership.userId, userId: cardMembership.userId,
isPermanent: false isPermanent: false,
}) })
.tolerate('E_UNIQUE') .tolerate('E_UNIQUE')
.fetch(); .fetch();
@ -48,13 +48,13 @@ module.exports = {
{ {
item: { item: {
id: cardMembership.cardId, id: cardMembership.cardId,
isSubscribed: true isSubscribed: true,
} },
}, },
inputs.request inputs.request,
); );
} }
return exits.success(cardMembership); return exits.success(cardMembership);
} },
}; };

View file

@ -2,43 +2,43 @@ module.exports = {
inputs: { inputs: {
list: { list: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
values: { values: {
type: 'json', type: 'json',
custom: value => _.isPlainObject(value) && _.isFinite(value.position), custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
required: true required: true,
}, },
user: { user: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const cards = await sails.helpers.getCardsForList(inputs.list.id); const cards = await sails.helpers.getCardsForList(inputs.list.id);
const { position, repositions } = sails.helpers.insertToPositionables( const { position, repositions } = sails.helpers.insertToPositionables(
inputs.values.position, inputs.values.position,
cards cards,
); );
repositions.forEach(async ({ id, position }) => { repositions.forEach(async ({ id, position: nextPosition }) => {
await Card.update({ await Card.update({
id, id,
listId: inputs.list.id listId: inputs.list.id,
}).set({ }).set({
position position: nextPosition,
}); });
sails.sockets.broadcast(`board:${list.boardId}`, 'cardUpdate', { sails.sockets.broadcast(`board:${list.boardId}`, 'cardUpdate', {
item: { item: {
id, id,
position position: nextPosition,
} },
}); });
}); });
@ -46,27 +46,27 @@ module.exports = {
...inputs.values, ...inputs.values,
position, position,
listId: inputs.list.id, listId: inputs.list.id,
boardId: inputs.list.boardId boardId: inputs.list.boardId,
}).fetch(); }).fetch();
sails.sockets.broadcast( sails.sockets.broadcast(
`board:${card.boardId}`, `board:${card.boardId}`,
'cardCreate', 'cardCreate',
{ {
item: card item: card,
}, },
inputs.request inputs.request,
); );
const values = { const values = {
type: 'createCard', type: 'createCard',
data: { data: {
list: _.pick(inputs.list, ['id', 'name']) list: _.pick(inputs.list, ['id', 'name']),
} },
}; };
await sails.helpers.createAction(card, inputs.user, values); await sails.helpers.createAction(card, inputs.user, values);
return exits.success(card); return exits.success(card);
} },
}; };

View file

@ -2,32 +2,32 @@ module.exports = {
inputs: { inputs: {
board: { board: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
values: { values: {
type: 'json', type: 'json',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const label = await Label.create({ const label = await Label.create({
...inputs.values, ...inputs.values,
boardId: inputs.board.id boardId: inputs.board.id,
}).fetch(); }).fetch();
sails.sockets.broadcast( sails.sockets.broadcast(
`board:${label.boardId}`, `board:${label.boardId}`,
'labelCreate', 'labelCreate',
{ {
item: label item: label,
}, },
inputs.request inputs.request,
); );
return exits.success(label); return exits.success(label);
} },
}; };

View file

@ -2,57 +2,57 @@ module.exports = {
inputs: { inputs: {
board: { board: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
values: { values: {
type: 'json', type: 'json',
custom: value => _.isPlainObject(value) && _.isFinite(value.position), custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const lists = await sails.helpers.getListsForBoard(inputs.board.id); const lists = await sails.helpers.getListsForBoard(inputs.board.id);
const { position, repositions } = sails.helpers.insertToPositionables( const { position, repositions } = sails.helpers.insertToPositionables(
inputs.values.position, inputs.values.position,
lists lists,
); );
repositions.forEach(async ({ id, position }) => { repositions.forEach(async ({ id, position: nextPosition }) => {
await List.update({ await List.update({
id, id,
boardId: inputs.board.id boardId: inputs.board.id,
}).set({ }).set({
position position: nextPosition,
}); });
sails.sockets.broadcast(`board:${inputs.board.id}`, 'listUpdate', { sails.sockets.broadcast(`board:${inputs.board.id}`, 'listUpdate', {
item: { item: {
id, id,
position position: nextPosition,
} },
}); });
}); });
const list = await List.create({ const list = await List.create({
...inputs.values, ...inputs.values,
position, position,
boardId: inputs.board.id boardId: inputs.board.id,
}).fetch(); }).fetch();
sails.sockets.broadcast( sails.sockets.broadcast(
`board:${list.boardId}`, `board:${list.boardId}`,
'listCreate', 'listCreate',
{ {
item: list item: list,
}, },
inputs.request inputs.request,
); );
return exits.success(list); return exits.success(list);
} },
}; };

View file

@ -2,38 +2,35 @@ module.exports = {
inputs: { inputs: {
project: { project: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
user: { user: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
exits: { exits: {
conflict: {} conflict: {},
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const projectMembership = await ProjectMembership.create({ const projectMembership = await ProjectMembership.create({
projectId: inputs.project.id, projectId: inputs.project.id,
userId: inputs.user.id userId: inputs.user.id,
}) })
.intercept('E_UNIQUE', 'conflict') .intercept('E_UNIQUE', 'conflict')
.fetch(); .fetch();
const { const { userIds, projectMemberships } = await sails.helpers.getMembershipUserIdsForProject(
userIds,
projectMemberships
} = await sails.helpers.getMembershipUserIdsForProject(
projectMembership.projectId, projectMembership.projectId,
true true,
); );
userIds.forEach(userId => { userIds.forEach((userId) => {
if (userId !== projectMembership.userId) { if (userId !== projectMembership.userId) {
sails.sockets.broadcast( sails.sockets.broadcast(
`user:${userId}`, `user:${userId}`,
@ -41,33 +38,27 @@ module.exports = {
{ {
item: projectMembership, item: projectMembership,
included: { included: {
users: [inputs.user] users: [inputs.user],
} },
}, },
inputs.request inputs.request,
); );
} }
}); });
const users = await sails.helpers.getUsers(userIds); const users = await sails.helpers.getUsers(userIds);
const boards = await sails.helpers.getBoardsForProject( const boards = await sails.helpers.getBoardsForProject(projectMembership.projectId);
projectMembership.projectId
);
sails.sockets.broadcast( sails.sockets.broadcast(`user:${projectMembership.userId}`, 'projectCreate', {
`user:${projectMembership.userId}`, item: inputs.project,
'projectCreate', included: {
{ users,
item: inputs.project, projectMemberships,
included: { boards,
users, },
projectMemberships, });
boards
}
}
);
return exits.success(projectMembership); return exits.success(projectMembership);
} },
}; };

View file

@ -2,27 +2,27 @@ module.exports = {
inputs: { inputs: {
values: { values: {
type: 'json', type: 'json',
required: true required: true,
}, },
user: { user: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
}, },
withProjectMembership: { withProjectMembership: {
type: 'boolean', type: 'boolean',
defaultsTo: false defaultsTo: false,
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const project = await Project.create(inputs.values).fetch(); const project = await Project.create(inputs.values).fetch();
const projectMembership = await ProjectMembership.create({ const projectMembership = await ProjectMembership.create({
projectId: project.id, projectId: project.id,
userId: inputs.user.id userId: inputs.user.id,
}).fetch(); }).fetch();
sails.sockets.broadcast( sails.sockets.broadcast(
@ -33,19 +33,19 @@ module.exports = {
included: { included: {
users: [inputs.user], users: [inputs.user],
projectMemberships: [projectMembership], projectMemberships: [projectMembership],
boards: [] boards: [],
} },
}, },
inputs.request inputs.request,
); );
return exits.success( return exits.success(
inputs.withProjectMembership inputs.withProjectMembership
? { ? {
project, project,
projectMembership projectMembership,
} }
: project : project,
); );
} },
}; };

View file

@ -2,32 +2,32 @@ module.exports = {
inputs: { inputs: {
card: { card: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
values: { values: {
type: 'json', type: 'json',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const task = await Task.create({ const task = await Task.create({
...inputs.values, ...inputs.values,
cardId: inputs.card.id cardId: inputs.card.id,
}).fetch(); }).fetch();
sails.sockets.broadcast( sails.sockets.broadcast(
`board:${inputs.card.boardId}`, `board:${inputs.card.boardId}`,
'taskCreate', 'taskCreate',
{ {
item: task item: task,
}, },
inputs.request inputs.request,
); );
return exits.success(task); return exits.success(task);
} },
}; };

View file

@ -4,45 +4,47 @@ module.exports = {
inputs: { inputs: {
values: { values: {
type: 'json', type: 'json',
custom: value => // eslint-disable-next-line max-len
_.isPlainObject(value) && custom: (value) => _.isPlainObject(value) && _.isString(value.email) && _.isString(value.password),
_.isString(value.email) && required: true,
_.isString(value.password),
required: true
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
exits: { exits: {
conflict: {} conflict: {},
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const user = await User.create({ const user = await User.create({
...inputs.values, ...inputs.values,
email: inputs.values.email.toLowerCase(), email: inputs.values.email.toLowerCase(),
password: bcrypt.hashSync(inputs.values.password, 10) password: bcrypt.hashSync(inputs.values.password, 10),
}) })
.intercept({ .intercept(
message: 'Unexpected error from database adapter: conflicting key value violates exclusion constraint "user_email_unique"' {
}, 'conflict') message:
'Unexpected error from database adapter: conflicting key value violates exclusion constraint "user_email_unique"',
},
'conflict',
)
.fetch(); .fetch();
const userIds = await sails.helpers.getAdminUserIds(); const userIds = await sails.helpers.getAdminUserIds();
userIds.forEach(userId => { userIds.forEach((userId) => {
sails.sockets.broadcast( sails.sockets.broadcast(
`user:${userId}`, `user:${userId}`,
'userCreate', 'userCreate',
{ {
item: user item: user,
}, },
inputs.request inputs.request,
); );
}); });
return exits.success(user); return exits.success(user);
} },
}; };

View file

@ -2,18 +2,18 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
board: { board: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const action = await Action.archiveOne(inputs.record.id); const action = await Action.archiveOne(inputs.record.id);
if (action) { if (action) {
@ -21,12 +21,12 @@ module.exports = {
`board:${inputs.board.id}`, `board:${inputs.board.id}`,
'actionDelete', 'actionDelete',
{ {
item: action item: action,
}, },
inputs.request inputs.request,
); );
} }
return exits.success(action); return exits.success(action);
} },
}; };

View file

@ -2,35 +2,33 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const board = await Board.archiveOne(inputs.record.id); const board = await Board.archiveOne(inputs.record.id);
if (board) { if (board) {
sails.sockets.leaveAll(`board:${board.id}`); sails.sockets.leaveAll(`board:${board.id}`);
const userIds = await sails.helpers.getMembershipUserIdsForProject( const userIds = await sails.helpers.getMembershipUserIdsForProject(board.projectId);
board.projectId
);
userIds.forEach(userId => { userIds.forEach((userId) => {
sails.sockets.broadcast( sails.sockets.broadcast(
`user:${userId}`, `user:${userId}`,
'boardDelete', 'boardDelete',
{ {
item: board item: board,
}, },
inputs.request inputs.request,
); );
}); });
} }
return exits.success(board); return exits.success(board);
} },
}; };

View file

@ -2,18 +2,18 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
board: { board: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const cardLabel = await CardLabel.destroyOne(inputs.record.id); const cardLabel = await CardLabel.destroyOne(inputs.record.id);
if (cardLabel) { if (cardLabel) {
@ -21,12 +21,12 @@ module.exports = {
`board:${inputs.board.id}`, `board:${inputs.board.id}`,
'cardLabelDelete', 'cardLabelDelete',
{ {
item: cardLabel item: cardLabel,
}, },
inputs.request inputs.request,
); );
} }
return exits.success(cardLabel); return exits.success(cardLabel);
} },
}; };

View file

@ -2,18 +2,18 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
board: { board: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const cardMembership = await CardMembership.destroyOne(inputs.record.id); const cardMembership = await CardMembership.destroyOne(inputs.record.id);
if (cardMembership) { if (cardMembership) {
@ -21,27 +21,27 @@ module.exports = {
`board:${inputs.board.id}`, `board:${inputs.board.id}`,
'cardMembershipDelete', 'cardMembershipDelete',
{ {
item: cardMembership item: cardMembership,
}, },
inputs.request inputs.request,
); );
const cardSubscription = await CardSubscription.destroyOne({ const cardSubscription = await CardSubscription.destroyOne({
cardId: cardMembership.cardId, cardId: cardMembership.cardId,
userId: cardMembership.userId, userId: cardMembership.userId,
isPermanent: false isPermanent: false,
}); });
if (cardSubscription) { if (cardSubscription) {
sails.sockets.broadcast(`user:${cardMembership.userId}`, 'cardUpdate', { sails.sockets.broadcast(`user:${cardMembership.userId}`, 'cardUpdate', {
item: { item: {
id: cardMembership.cardId, id: cardMembership.cardId,
isSubscribed: false isSubscribed: false,
} },
}); });
} }
} }
return exits.success(cardMembership); return exits.success(cardMembership);
} },
}; };

View file

@ -2,14 +2,14 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const card = await Card.archiveOne(inputs.record.id); const card = await Card.archiveOne(inputs.record.id);
if (card) { if (card) {
@ -17,12 +17,12 @@ module.exports = {
`board:${card.boardId}`, `board:${card.boardId}`,
'cardDelete', 'cardDelete',
{ {
item: card item: card,
}, },
inputs.request inputs.request,
); );
} }
return exits.success(card); return exits.success(card);
} },
}; };

View file

@ -2,16 +2,16 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
await CardLabel.destroy({ await CardLabel.destroy({
labelId: inputs.record.id labelId: inputs.record.id,
}); });
const label = await Label.archiveOne(inputs.record.id); const label = await Label.archiveOne(inputs.record.id);
@ -21,12 +21,12 @@ module.exports = {
`board:${label.boardId}`, `board:${label.boardId}`,
'labelDelete', 'labelDelete',
{ {
item: label item: label,
}, },
inputs.request inputs.request,
); );
} }
return exits.success(label); return exits.success(label);
} },
}; };

View file

@ -2,25 +2,25 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const list = await List.archiveOne(inputs.record.id); const list = await List.archiveOne(inputs.record.id);
sails.sockets.broadcast( sails.sockets.broadcast(
`board:${list.boardId}`, `board:${list.boardId}`,
'listDelete', 'listDelete',
{ {
item: list item: list,
}, },
inputs.request inputs.request,
); );
return exits.success(list); return exits.success(list);
} },
}; };

View file

@ -2,17 +2,15 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const boards = await sails.helpers.getBoardsForProject( const boards = await sails.helpers.getBoardsForProject(inputs.record.projectId);
inputs.record.projectId
);
const boardIds = sails.helpers.mapRecords(boards); const boardIds = sails.helpers.mapRecords(boards);
@ -21,50 +19,44 @@ module.exports = {
await CardSubscription.destroy({ await CardSubscription.destroy({
cardId: cardIds, cardId: cardIds,
userId: inputs.record.userId userId: inputs.record.userId,
}); });
await CardMembership.destroy({ await CardMembership.destroy({
cardId: cardIds, cardId: cardIds,
userId: inputs.record.userId userId: inputs.record.userId,
}); });
const projectMembership = await ProjectMembership.destroyOne( const projectMembership = await ProjectMembership.destroyOne(inputs.record.id);
inputs.record.id
);
if (projectMembership) { if (projectMembership) {
const userIds = await sails.helpers.getMembershipUserIdsForProject( const userIds = await sails.helpers.getMembershipUserIdsForProject(
projectMembership.projectId projectMembership.projectId,
); );
userIds.forEach(userId => { userIds.forEach((userId) => {
sails.sockets.broadcast( sails.sockets.broadcast(
`user:${userId}`, `user:${userId}`,
'projectMembershipDelete', 'projectMembershipDelete',
{ {
item: projectMembership item: projectMembership,
}, },
inputs.request inputs.request,
); );
}); });
sails.sockets.removeRoomMembersFromRooms( sails.sockets.removeRoomMembersFromRooms(
`user:${projectMembership.userId}`, `user:${projectMembership.userId}`,
boardIds.map(boardId => `board:${boardId}`) boardIds.map((boardId) => `board:${boardId}`),
); );
const project = await Project.findOne(projectMembership.projectId); const project = await Project.findOne(projectMembership.projectId);
sails.sockets.broadcast( sails.sockets.broadcast(`user:${projectMembership.userId}`, 'projectDelete', {
`user:${projectMembership.userId}`, item: project,
'projectDelete', });
{
item: project
}
);
} }
return exits.success(projectMembership); return exits.success(projectMembership);
} },
}; };

View file

@ -2,16 +2,16 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const projectMemberships = await ProjectMembership.destroy({ const projectMemberships = await ProjectMembership.destroy({
projectId: inputs.record.id projectId: inputs.record.id,
}).fetch(); }).fetch();
const project = await Project.archiveOne(inputs.record.id); const project = await Project.archiveOne(inputs.record.id);
@ -20,22 +20,22 @@ module.exports = {
const userIds = sails.helpers.mapRecords(projectMemberships, 'userId'); const userIds = sails.helpers.mapRecords(projectMemberships, 'userId');
const boards = await sails.helpers.getBoardsForProject(project.id); 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.removeRoomMembersFromRooms(`user:${userId}`, boardRooms);
sails.sockets.broadcast( sails.sockets.broadcast(
`user:${userId}`, `user:${userId}`,
'projectDelete', 'projectDelete',
{ {
item: project item: project,
}, },
inputs.request inputs.request,
); );
}); });
} }
return exits.success(project); return exits.success(project);
} },
}; };

View file

@ -2,18 +2,18 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
board: { board: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const task = await Task.archiveOne(inputs.record.id); const task = await Task.archiveOne(inputs.record.id);
if (task) { if (task) {
@ -21,12 +21,12 @@ module.exports = {
`board:${inputs.board.id}`, `board:${inputs.board.id}`,
'taskDelete', 'taskDelete',
{ {
item: task item: task,
}, },
inputs.request inputs.request,
); );
} }
return exits.success(task); return exits.success(task);
} },
}; };

View file

@ -2,58 +2,54 @@ module.exports = {
inputs: { inputs: {
record: { record: {
type: 'ref', type: 'ref',
required: true required: true,
}, },
request: { request: {
type: 'ref' type: 'ref',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
await ProjectMembership.destroy({ await ProjectMembership.destroy({
userId: inputs.record.id userId: inputs.record.id,
}); });
await CardSubscription.destroy({ await CardSubscription.destroy({
userId: inputs.record.id userId: inputs.record.id,
}); });
await CardMembership.destroy({ await CardMembership.destroy({
userId: inputs.record.id userId: inputs.record.id,
}); });
const user = await User.updateOne({ const user = await User.updateOne({
id: inputs.record.id, id: inputs.record.id,
deletedAt: null deletedAt: null,
}).set({ }).set({
deletedAt: new Date().toUTCString() deletedAt: new Date().toUTCString(),
}); });
if (user) { if (user) {
const adminUserIds = await sails.helpers.getAdminUserIds(); const adminUserIds = await sails.helpers.getAdminUserIds();
const projectIds = await sails.helpers.getMembershipProjectIdsForUser( const projectIds = await sails.helpers.getMembershipProjectIdsForUser(user.id);
user.id
);
const userIdsForProject = await sails.helpers.getMembershipUserIdsForProject( const userIdsForProject = await sails.helpers.getMembershipUserIdsForProject(projectIds);
projectIds
);
const userIds = _.union([user.id], adminUserIds, userIdsForProject); const userIds = _.union([user.id], adminUserIds, userIdsForProject);
userIds.forEach(userId => { userIds.forEach((userId) => {
sails.sockets.broadcast( sails.sockets.broadcast(
`user:${userId}`, `user:${userId}`,
'userDelete', 'userDelete',
{ {
item: user item: user,
}, },
inputs.request inputs.request,
); );
}); });
} }
return exits.success(user); return exits.success(user);
} },
}; };

View file

@ -2,15 +2,15 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', type: 'json',
required: true required: true,
} },
}, },
exits: { exits: {
notFound: {} notFound: {},
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const action = await Action.findOne(inputs.criteria); const action = await Action.findOne(inputs.criteria);
if (!action) { if (!action) {
@ -19,16 +19,16 @@ module.exports = {
const path = await sails.helpers const path = await sails.helpers
.getCardToProjectPath(action.cardId) .getCardToProjectPath(action.cardId)
.intercept('notFound', path => ({ .intercept('notFound', (nodes) => ({
notFound: { notFound: {
action, action,
...path ...nodes,
} },
})); }));
return exits.success({ return exits.success({
action, action,
...path ...path,
}); });
} },
}; };

View file

@ -4,27 +4,27 @@ module.exports = {
inputs: { inputs: {
id: { id: {
type: 'json', type: 'json',
custom: value => _.isString(value) || _.isArray(value), custom: (value) => _.isString(value) || _.isArray(value),
required: true required: true,
}, },
beforeId: { beforeId: {
type: 'string' type: 'string',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const criteria = { const criteria = {
cardId: inputs.id cardId: inputs.id,
}; };
if (!_.isUndefined(inputs.beforeId)) { if (!_.isUndefined(inputs.beforeId)) {
criteria.id = { criteria.id = {
'<': inputs.beforeId '<': inputs.beforeId,
}; };
} }
const actions = await sails.helpers.getActions(criteria, LIMIT); const actions = await sails.helpers.getActions(criteria, LIMIT);
return exits.success(actions); return exits.success(actions);
} },
}; };

View file

@ -2,18 +2,18 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', type: 'json',
custom: value => _.isArray(value) || _.isPlainObject(value) custom: (value) => _.isArray(value) || _.isPlainObject(value),
}, },
limit: { limit: {
type: 'number' type: 'number',
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const actions = await Action.find(inputs.criteria) const actions = await Action.find(inputs.criteria)
.sort('id DESC') .sort('id DESC')
.limit(inputs.limit); .limit(inputs.limit);
return exits.success(actions); return exits.success(actions);
} },
}; };

View file

@ -1,11 +1,11 @@
module.exports = { module.exports = {
fn: async function(inputs, exits) { async fn(inputs, exits) {
const users = await sails.helpers.getUsers({ const users = await sails.helpers.getUsers({
isAdmin: true isAdmin: true,
}); });
const userIds = sails.helpers.mapRecords(users); const userIds = sails.helpers.mapRecords(users);
return exits.success(userIds); return exits.success(userIds);
} },
}; };

View file

@ -2,15 +2,15 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', type: 'json',
required: true required: true,
} },
}, },
exits: { exits: {
notFound: {} notFound: {},
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const board = await Board.findOne(inputs.criteria); const board = await Board.findOne(inputs.criteria);
if (!board) { if (!board) {
@ -22,14 +22,14 @@ module.exports = {
if (!project) { if (!project) {
throw { throw {
notFound: { notFound: {
board board,
} },
}; };
} }
return exits.success({ return exits.success({
board, board,
project project,
}); });
} },
}; };

View file

@ -2,28 +2,28 @@ module.exports = {
inputs: { inputs: {
id: { id: {
type: 'json', type: 'json',
custom: value => _.isString(value) || _.isArray(value), custom: (value) => _.isString(value) || _.isArray(value),
required: true required: true,
}, },
exceptBoardId: { exceptBoardId: {
type: 'json', 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 = { const criteria = {
projectId: inputs.id projectId: inputs.id,
}; };
if (!_.isUndefined(inputs.exceptBoardId)) { if (!_.isUndefined(inputs.exceptBoardId)) {
criteria.id = { criteria.id = {
'!=': inputs.exceptBoardId '!=': inputs.exceptBoardId,
}; };
} }
const boards = await sails.helpers.getBoards(criteria); const boards = await sails.helpers.getBoards(criteria);
return exits.success(boards); return exits.success(boards);
} },
}; };

View file

@ -2,13 +2,13 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', 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'); const boards = await Board.find(inputs.criteria).sort('position');
return exits.success(boards); return exits.success(boards);
} },
}; };

View file

@ -2,16 +2,16 @@ module.exports = {
inputs: { inputs: {
id: { id: {
type: 'json', type: 'json',
custom: value => _.isString(value) || _.isArray(value), custom: (value) => _.isString(value) || _.isArray(value),
required: true required: true,
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const cardLabels = await sails.helpers.getCardLabels({ const cardLabels = await sails.helpers.getCardLabels({
cardId: inputs.id cardId: inputs.id,
}); });
return exits.success(cardLabels); return exits.success(cardLabels);
} },
}; };

View file

@ -2,13 +2,13 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', 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'); const cardLabels = await CardLabel.find(inputs.criteria).sort('id');
return exits.success(cardLabels); return exits.success(cardLabels);
} },
}; };

View file

@ -2,15 +2,13 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', type: 'json',
custom: value => _.isArray(value) || _.isPlainObject(value) custom: (value) => _.isArray(value) || _.isPlainObject(value),
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const cardMemberships = await CardMembership.find(inputs.criteria).sort( const cardMemberships = await CardMembership.find(inputs.criteria).sort('id');
'id'
);
return exits.success(cardMemberships); return exits.success(cardMemberships);
} },
}; };

View file

@ -2,15 +2,13 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', type: 'json',
custom: value => _.isArray(value) || _.isPlainObject(value) custom: (value) => _.isArray(value) || _.isPlainObject(value),
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const cardSubscriptions = await CardSubscription.find(inputs.criteria).sort( const cardSubscriptions = await CardSubscription.find(inputs.criteria).sort('id');
'id'
);
return exits.success(cardSubscriptions); return exits.success(cardSubscriptions);
} },
}; };

View file

@ -2,15 +2,15 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', type: 'json',
required: true required: true,
} },
}, },
exits: { exits: {
notFound: {} notFound: {},
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const card = await Card.findOne(inputs.criteria); const card = await Card.findOne(inputs.criteria);
if (!card) { if (!card) {
@ -19,16 +19,16 @@ module.exports = {
const path = await sails.helpers const path = await sails.helpers
.getListToProjectPath(card.listId) .getListToProjectPath(card.listId)
.intercept('notFound', path => ({ .intercept('notFound', (nodes) => ({
notFound: { notFound: {
card, card,
...path ...nodes,
} },
})); }));
return exits.success({ return exits.success({
card, card,
...path ...path,
}); });
} },
}; };

View file

@ -2,16 +2,16 @@ module.exports = {
inputs: { inputs: {
id: { id: {
type: 'json', type: 'json',
custom: value => _.isString(value) || _.isArray(value), custom: (value) => _.isString(value) || _.isArray(value),
required: true required: true,
} },
}, },
fn: async function(inputs, exits) { async fn(inputs, exits) {
const cards = await sails.helpers.getCards({ const cards = await sails.helpers.getCards({
boardId: inputs.id boardId: inputs.id,
}); });
return exits.success(cards); return exits.success(cards);
} },
}; };

View file

@ -2,28 +2,28 @@ module.exports = {
inputs: { inputs: {
id: { id: {
type: 'json', type: 'json',
custom: value => _.isString(value) || _.isArray(value), custom: (value) => _.isString(value) || _.isArray(value),
required: true required: true,
}, },
exceptCardId: { exceptCardId: {
type: 'json', 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 = { const criteria = {
listId: inputs.id listId: inputs.id,
}; };
if (!_.isUndefined(inputs.exceptCardId)) { if (!_.isUndefined(inputs.exceptCardId)) {
criteria.id = { criteria.id = {
'!=': inputs.exceptCardId '!=': inputs.exceptCardId,
}; };
} }
const cards = await sails.helpers.getCards(criteria); const cards = await sails.helpers.getCards(criteria);
return exits.success(cards); return exits.success(cards);
} },
}; };

View file

@ -2,13 +2,13 @@ module.exports = {
inputs: { inputs: {
criteria: { criteria: {
type: 'json', 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'); const cards = await Card.find(inputs.criteria).sort('position');
return exits.success(cards); return exits.success(cards);
} },
}; };

Some files were not shown because too many files have changed in this diff Show more