feat: Add new API handlers for user, project, and task management; update package dependencies

This commit is contained in:
2024-11-21 11:21:21 +02:00
parent 132f526179
commit 86c671ccd8
15 changed files with 1288 additions and 0 deletions

View File

@@ -9,12 +9,14 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@types/uuid": "^10.0.0",
"aws-sdk": "^2.1692.0"
},
"devDependencies": {
"@types/node": "^22.9.1",
"eslint": "^9.15.0",
"prettier": "^3.3.3",
"serverless-prune-plugin": "^2.1.0",
"typescript": "^5.6.3"
}
},
@@ -194,6 +196,35 @@
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@isaacs/cliui": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
"integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
"dev": true,
"peer": true,
"dependencies": {
"string-width": "^5.1.2",
"string-width-cjs": "npm:string-width@^4.2.0",
"strip-ansi": "^7.0.1",
"strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
"wrap-ansi": "^8.1.0",
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@pkgjs/parseargs": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
"integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
"dev": true,
"optional": true,
"peer": true,
"engines": {
"node": ">=14"
}
},
"node_modules/@types/estree": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
@@ -215,6 +246,11 @@
"undici-types": "~6.19.8"
}
},
"node_modules/@types/uuid": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",
"integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ=="
},
"node_modules/acorn": {
"version": "8.14.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
@@ -252,6 +288,19 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/ansi-regex": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",
"integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
"dev": true,
"peer": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
@@ -273,6 +322,13 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"dev": true,
"peer": true
},
"node_modules/available-typed-arrays": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@@ -308,6 +364,28 @@
"node": ">= 10.0.0"
}
},
"node_modules/axios": {
"version": "1.7.7",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz",
"integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==",
"dev": true,
"peer": true,
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/axios-proxy-builder": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/axios-proxy-builder/-/axios-proxy-builder-0.1.2.tgz",
"integrity": "sha512-6uBVsBZzkB3tCC8iyx59mCjQckhB8+GQrI9Cop8eC7ybIsvs/KtnNgEBfRMSEa7GqK2VBGUzgjNYMdPIfotyPA==",
"dev": true,
"peer": true,
"dependencies": {
"tunnel": "^0.0.6"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -333,6 +411,12 @@
}
]
},
"node_modules/bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
"dev": true
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -414,6 +498,19 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
"peer": true,
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -473,6 +570,30 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/eastasianwidth": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
"dev": true,
"peer": true
},
"node_modules/emoji-regex": {
"version": "9.2.2",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
"dev": true,
"peer": true
},
"node_modules/es-define-property": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
@@ -723,6 +844,27 @@
"integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==",
"dev": true
},
"node_modules/follow-redirects": {
"version": "1.15.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
"dev": true,
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"peer": true,
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/for-each": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
@@ -731,6 +873,38 @@
"is-callable": "^1.1.3"
}
},
"node_modules/foreground-child": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz",
"integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==",
"dev": true,
"peer": true,
"dependencies": {
"cross-spawn": "^7.0.0",
"signal-exit": "^4.0.1"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/form-data": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
"dev": true,
"peer": true,
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@@ -757,6 +931,27 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/glob": {
"version": "10.4.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
"integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
"dev": true,
"peer": true,
"dependencies": {
"foreground-child": "^3.1.0",
"jackspeak": "^3.1.2",
"minimatch": "^9.0.4",
"minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0",
"path-scurry": "^1.11.1"
},
"bin": {
"glob": "dist/esm/bin.mjs"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
@@ -769,6 +964,32 @@
"node": ">=10.13.0"
}
},
"node_modules/glob/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"peer": true,
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/glob/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"peer": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/globals": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
@@ -938,6 +1159,16 @@
"node": ">=0.10.0"
}
},
"node_modules/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==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
},
"node_modules/is-generator-function": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz",
@@ -989,6 +1220,22 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
},
"node_modules/jackspeak": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
"integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
"dev": true,
"peer": true,
"dependencies": {
"@isaacs/cliui": "^8.0.2"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
},
"optionalDependencies": {
"@pkgjs/parseargs": "^0.11.0"
}
},
"node_modules/jmespath": {
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz",
@@ -1070,6 +1317,36 @@
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
"dev": true
},
"node_modules/lru-cache": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"dev": true,
"peer": true
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"peer": true,
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"peer": true,
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -1082,6 +1359,16 @@
"node": "*"
}
},
"node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true,
"peer": true,
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -1141,6 +1428,13 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/package-json-from-dist": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
"dev": true,
"peer": true
},
"node_modules/parent-module": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@@ -1171,6 +1465,23 @@
"node": ">=8"
}
},
"node_modules/path-scurry": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"dev": true,
"peer": true,
"dependencies": {
"lru-cache": "^10.2.0",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
},
"engines": {
"node": ">=16 || 14 >=14.18"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/possible-typed-array-names": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz",
@@ -1203,6 +1514,13 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"dev": true,
"peer": true
},
"node_modules/punycode": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
@@ -1226,11 +1544,60 @@
"node": ">=4"
}
},
"node_modules/rimraf": {
"version": "5.0.10",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz",
"integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==",
"dev": true,
"peer": true,
"dependencies": {
"glob": "^10.3.7"
},
"bin": {
"rimraf": "dist/esm/bin.mjs"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/sax": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
"integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA=="
},
"node_modules/serverless": {
"version": "4.4.11",
"resolved": "https://registry.npmjs.org/serverless/-/serverless-4.4.11.tgz",
"integrity": "sha512-8FC58j1pfLMBlkdKrHyiFDO0FDUXQdVtHs2K+2XHDCd+gXX0J7kSxS49s2oYmAxknfjs0wlrhrzGe9DVlxpb+A==",
"dev": true,
"hasInstallScript": true,
"peer": true,
"dependencies": {
"axios": "^1.7.4",
"axios-proxy-builder": "^0.1.2",
"rimraf": "^5.0.5",
"xml2js": "0.6.2"
},
"bin": {
"serverless": "run.js",
"sls": "run.js"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/serverless-prune-plugin": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/serverless-prune-plugin/-/serverless-prune-plugin-2.1.0.tgz",
"integrity": "sha512-++22inpEFECgfw+DR2cRn8huxzcsQVgSii4Rjp5q6cPxKo2eKmFc0dfMaJ81DwQoHEnVhfVipIlGdodkauOm1g==",
"dev": true,
"dependencies": {
"bluebird": "^3.7.2"
},
"peerDependencies": {
"serverless": "1.x || 2.x || 3.x || 4.x"
}
},
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
@@ -1268,6 +1635,123 @@
"node": ">=8"
}
},
"node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true,
"peer": true,
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/string-width": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
"dev": true,
"peer": true,
"dependencies": {
"eastasianwidth": "^0.2.0",
"emoji-regex": "^9.2.2",
"strip-ansi": "^7.0.1"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/string-width-cjs": {
"name": "string-width",
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"peer": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/string-width-cjs/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
},
"node_modules/string-width-cjs/node_modules/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==",
"dev": true,
"peer": true
},
"node_modules/string-width-cjs/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/strip-ansi": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
"integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-regex": "^6.0.1"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
"node_modules/strip-ansi-cjs": {
"name": "strip-ansi",
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/strip-ansi-cjs/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
},
"node_modules/strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@@ -1292,6 +1776,16 @@
"node": ">=8"
}
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"dev": true,
"peer": true,
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
}
},
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -1412,6 +1906,101 @@
"node": ">=0.10.0"
}
},
"node_modules/wrap-ansi": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-styles": "^6.1.0",
"string-width": "^5.0.1",
"strip-ansi": "^7.0.1"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/wrap-ansi-cjs": {
"name": "wrap-ansi",
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/wrap-ansi-cjs/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi-cjs/node_modules/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==",
"dev": true,
"peer": true
},
"node_modules/wrap-ansi-cjs/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"peer": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi/node_modules/ansi-styles": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
"integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
"dev": true,
"peer": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/xml2js": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz",

View File

@@ -11,12 +11,14 @@
"license": "ISC",
"description": "",
"dependencies": {
"@types/uuid": "^10.0.0",
"aws-sdk": "^2.1692.0"
},
"devDependencies": {
"@types/node": "^22.9.1",
"eslint": "^9.15.0",
"prettier": "^3.3.3",
"serverless-prune-plugin": "^2.1.0",
"typescript": "^5.6.3"
}
}

View File

@@ -0,0 +1,164 @@
service: tasker-server
plugins:
- serverless-prune-plugin
provider:
stackName: ${self:service}
name: aws
region: ${opt:region, 'eu-north-1'}
runtime: nodejs20.x
environment:
SLS_REGION: ${self:provider.region}
TASKER_TASK_TABLE_NAME: ${ssm:/tasker/dynamodb/project-table-name}
TASKER_PROJECT_TABLE_NAME: ${ssm:/tasker/dynamodb/task-table-name}
TASKER_USER_TABLE_NAME: ${ssm:/tasker/dynamodb/user-table-name}
TASKER_TASK_EXTRA_TABLE_NAME: ${ssm:/tasker/dynamodb/task-extra-table-name}
TASKER_TEAM_TABLE_NAME: ${ssm:/tasker/dynamodb/team-table-name}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
Resource:
[
"arn:aws:dynamodb:${self:provider.region}:*:table/tasker-*",
"arn:aws:dynamodb:${self:provider.region}:*:table/tasker-*/*",
]
functions:
# POST /users
createUser:
handler: src/handlers/createUser.handler
memorySize: 1024
timeout: 60
events:
- http:
path: users
method: post
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# POST /projects
createProject:
handler: src/handlers/createProject.handler
memorySize: 1024
timeout: 60
events:
- http:
path: projects
method: post
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# POST /tasks
createTask:
handler: src/handlers/createTask.handler
memorySize: 1024
timeout: 60
events:
- http:
path: tasks
method: post
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# GET /projects
getProjects:
handler: src/handlers/getProjects.handler
memorySize: 1024
timeout: 60
events:
- http:
path: projects
method: get
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# GET /tasks?projectId=
getTasks:
handler: src/handlers/getTasks.handler
memorySize: 1024
timeout: 60
events:
- http:
path: tasks
method: get
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# GET /teams
getTeams:
handler: src/handlers/getTeams.handler
memorySize: 1024
timeout: 60
events:
- http:
path: teams
method: get
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# GET /users
getUsers:
handler: src/handlers/getUsers.handler
memorySize: 1024
timeout: 60
events:
- http:
path: users
method: get
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# GET /users/{cognitoId}
getUser:
handler: src/handlers/getUser.handler
memorySize: 1024
timeout: 60
events:
- http:
path: users/{cognitoId}
method: get
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# GET /tasks/user/${userId}
getTasksByUser:
handler: src/handlers/getTasksByUser.handler
memorySize: 1024
timeout: 60
events:
- http:
path: tasks/user/{userId}
method: get
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}
# PATCH /tasks/{taskId}/status
updateTaskStatus:
handler: src/handlers/updateTaskStatus.handler
memorySize: 1024
timeout: 60
events:
- http:
path: tasks/{taskId}/status
method: patch
cors: true
authorizer:
type: COGNITO_USER_POOLS
arn: ${ssm:/tasker/cognito/user-pool-arn}

View File

@@ -0,0 +1,40 @@
import { DynamoDB } from "aws-sdk";
import { v4 as uuidv4 } from "uuid";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_PROJECT_TABLE_NAME = process.env.TASKER_PROJECT_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
const { name, description, startDate, endDate } = event.body;
try {
const newProject = {
type: "projects",
projectId: `project#${uuidv4()}`,
name,
description,
startDate,
endDate,
};
const params = {
TableName: TASKER_PROJECT_TABLE_NAME,
Item: newProject,
};
await docClient.put(params).promise();
return {
status: 201,
body: JSON.stringify(newProject),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error creating project: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,59 @@
import { DynamoDB } from "aws-sdk";
import { v4 as uuidv4 } from "uuid";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_TASK_TABLE_NAME = process.env.TASKER_TASK_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
const {
title,
description,
status,
priority,
tags,
startDate,
dueDate,
points,
projectId,
authorUserId,
assignedUserId,
} = event.body;
try {
const newTask = {
type: "tasks",
taskId: `task#${uuidv4()}`,
title,
description,
status,
priority,
tags,
startDate,
dueDate,
points,
projectId,
authorUserId,
assignedUserId,
};
const params = {
TableName: TASKER_TASK_TABLE_NAME,
Item: newTask,
};
await docClient.put(params).promise();
return {
status: 201,
body: JSON.stringify(newTask),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error creating task: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,43 @@
import { fetchRandomTeamId } from "@/lib/util";
import { DynamoDB } from "aws-sdk";
import { v4 as uuidv4 } from "uuid";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_USER_TABLE_NAME = process.env.TASKER_USER_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
const { username, cognitoId, profilePictureUrl = "i0.jpg" } = event.body;
const teamId = fetchRandomTeamId();
try {
const newUser = {
type: "users",
cognitoId,
userId: `user#${uuidv4()}`,
username,
profilePictureUrl,
teamId,
};
const params = {
TableName: TASKER_USER_TABLE_NAME,
Item: newUser,
};
await docClient.put(params).promise();
return {
status: 201,
body: JSON.stringify(newUser),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error creating user: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,32 @@
import { DynamoDB } from "aws-sdk";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_PROJECT_TABLE_NAME = process.env.TASKER_PROJECT_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
try {
const params = {
TableName: TASKER_PROJECT_TABLE_NAME,
KeyConditionExpression: "type = :type",
ExpressionAttributeValues: {
":type": "projects",
},
};
const projects = await docClient.query(params).promise();
return {
status: 200,
body: JSON.stringify(projects.Items),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error retrieving projects: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,65 @@
import {
fetchAttachments,
fetchComments,
fetchUserWithUserId,
} from "@/lib/util";
import { DynamoDB } from "aws-sdk";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_TASK_TABLE_NAME = process.env.TASKER_TASK_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
const { projectId } = event.queryStringParameters;
try {
const params = {
TableName: TASKER_TASK_TABLE_NAME,
KeyConditionExpression: "type = :type AND projectId = :projectId",
IndexName: "GSI-project-id",
ExpressionAttributeValues: {
":type": "tasks",
":projectId": projectId,
},
};
const result = await docClient.query(params).promise();
const tasks = result.Items || [];
const tasksWithDetails = await Promise.all(
tasks.map(async (task: any) => {
const author = task.authorUserId
? await fetchUserWithUserId(task.authorUserId)
: null;
const assignee = task.assignedUserId
? await fetchUserWithUserId(task.assignedUserId)
: null;
const comments = await fetchComments(task.taskId);
const attachments = await fetchAttachments(task.taskId);
return {
...task,
author,
assignee,
comments,
attachments,
};
})
);
return {
status: 200,
body: JSON.stringify(tasksWithDetails),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error retrieving tasks: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,52 @@
import { fetchUserWithUserId } from "@/lib/util";
import { DynamoDB } from "aws-sdk";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_TEAM_TABLE_NAME = process.env.TASKER_TEAM_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
try {
const params = {
TableName: TASKER_TEAM_TABLE_NAME,
KeyConditionExpression: "type = :type",
ExpressionAttributeValues: {
":type": "teams",
},
};
const result = await docClient.query(params).promise();
const teams = result.Items || [];
const teamsWithUsernames = await Promise.all(
teams.map(async (team: any) => {
const productOwnerUsername = team.productOwnerUserId
? (await fetchUserWithUserId(team.productOwnerUserId))?.username
: null;
const projectManagerUsername = team.projectManagerUserId
? (await fetchUserWithUserId(team.projectManagerUserId))?.username
: null;
return {
...team,
productOwnerUsername,
projectManagerUsername,
};
})
);
return {
status: 200,
body: JSON.stringify(teamsWithUsernames),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error retrieving teams: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,34 @@
import { DynamoDB } from "aws-sdk";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_USER_TABLE_NAME = process.env.TASKER_USER_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
const { cognitoId } = event.pathParameters;
try {
const params = {
TableName: TASKER_USER_TABLE_NAME,
KeyConditionExpression: "type = :type AND cognitoId = :cognitoId",
ExpressionAttributeValues: {
":type": "users",
":cognitoId": cognitoId,
},
};
const user = await docClient.query(params).promise();
return {
status: 200,
body: JSON.stringify(user.Items?.[0] || {}),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error retrieving user: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,32 @@
import { queryTasks } from "@/lib/util";
export const handler = async (event: any): Promise<any> => {
const { userId } = event.pathParameters;
try {
const authorTasks = await queryTasks(
userId,
"GSI-author-user-id",
"authorUserId"
);
const assigneeTasks = await queryTasks(
userId,
"GSI-assigned-user-id",
"assignedUserId"
);
const userTasks = [...authorTasks, ...assigneeTasks];
return {
status: 200,
body: JSON.stringify(userTasks),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error retrieving tasks for user: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,32 @@
import { DynamoDB } from "aws-sdk";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_USER_TABLE_NAME = process.env.TASKER_USER_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
try {
const params = {
TableName: TASKER_USER_TABLE_NAME,
KeyConditionExpression: "type = :type",
ExpressionAttributeValues: {
":type": "users",
},
};
const users = await docClient.query(params).promise();
return {
status: 200,
body: JSON.stringify(users.Items),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error retrieving users: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,42 @@
import { DynamoDB } from "aws-sdk";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_TASK_TABLE_NAME = process.env.TASKER_TASK_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const handler = async (event: any): Promise<any> => {
const { taskId } = event.pathParameters;
const { status } = event.body;
try {
const params = {
TableName: TASKER_TASK_TABLE_NAME,
Key: {
type: "tasks",
taskId,
},
UpdateExpression: "set #status = :status",
ExpressionAttributeNames: {
"#status": "status",
},
ExpressionAttributeValues: {
":status": status,
},
ReturnValues: "ALL_NEW",
};
const updatedTask = await docClient.update(params).promise();
return {
status: 200,
body: JSON.stringify(updatedTask.Attributes),
};
} catch (error: any) {
return {
status: 500,
body: JSON.stringify({
message: `Error updating task: ${error.message}`,
}),
};
}
};

View File

@@ -0,0 +1,95 @@
import { DynamoDB } from "aws-sdk";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_PROJECT_TABLE_NAME = process.env.TASKER_PROJECT_TABLE_NAME || "";
const TASKER_USER_TABLE_NAME = process.env.TASKER_USER_TABLE_NAME || "";
const TASKER_TASK_TABLE_NAME = process.env.TASKER_TASK_TABLE_NAME || "";
const TASKER_TASK_EXTRA_TABLE_NAME =
process.env.TASKER_TASK_EXTRA_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
export const fetchRandomTeamId = async () => {
const params = {
TableName: TASKER_PROJECT_TABLE_NAME,
KeyConditionExpression: "type = :type",
ExpressionAttributeValues: {
":type": "teams",
},
};
const projects = await docClient.query(params).promise();
if (!projects.Items) {
return null;
}
const randomProject =
projects.Items[Math.floor(Math.random() * projects.Items.length)];
return randomProject.id;
};
export const fetchUserWithUserId = async (userId: string): Promise<any> => {
const params: DynamoDB.DocumentClient.QueryInput = {
TableName: TASKER_USER_TABLE_NAME,
KeyConditionExpression: "type = :type AND userId = :userId",
IndexName: "GSI-user-id",
ExpressionAttributeValues: {
":type": "users",
":userId": userId,
},
};
const result = await docClient.query(params).promise();
return result.Items?.[0];
};
export const fetchComments = async (taskId: string): Promise<any> => {
const params: DynamoDB.DocumentClient.QueryInput = {
TableName: TASKER_TASK_EXTRA_TABLE_NAME,
KeyConditionExpression: "type = :type AND taskId = :taskId",
IndexName: "GSI-task-id",
ExpressionAttributeValues: {
":type": "comments",
":taskId": taskId,
},
};
const result = await docClient.query(params).promise();
return result.Items;
};
export const fetchAttachments = async (taskId: string): Promise<any> => {
const params: DynamoDB.DocumentClient.QueryInput = {
TableName: TASKER_TASK_EXTRA_TABLE_NAME,
KeyConditionExpression: "type = :type AND taskId = :taskId",
IndexName: "GSI-task-id",
ExpressionAttributeValues: {
":type": "attachments",
":taskId": taskId,
},
};
const result = await docClient.query(params).promise();
return result.Items;
};
export const queryTasks = async (
userId: string,
indexName: string,
key: string
): Promise<DynamoDB.ItemList> => {
const params = {
TableName: TASKER_TASK_TABLE_NAME,
KeyConditionExpression: "type = :type AND #key = :userId",
IndexName: indexName,
ExpressionAttributeValues: {
":type": "tasks",
":userId": userId,
},
ExpressionAttributeNames: {
"#key": key,
},
};
const result = await docClient.query(params).promise();
return result.Items ?? [];
};

View File

@@ -76,6 +76,13 @@ resource "aws_ssm_parameter" "user_pool_id" {
value = aws_cognito_user_pool.tasker_cognito_user_pool.id
}
resource "aws_ssm_parameter" "user_pool_arn" {
name = "/tasker/cognito/user-pool-arn"
description = "Tasker Cognito User Pool ARN"
type = "String"
value = aws_cognito_user_pool.tasker_cognito_user_pool.arn
}
resource "aws_ssm_parameter" "client_id" {
name = "/tasker/cognito/client-id"
description = "Tasker Cognito Client ID"