fix(services): realtime edge cases
This commit is contained in:
parent
d3a777c82a
commit
c23239c0da
@ -12,6 +12,7 @@
|
|||||||
"prettier/prettier": "error",
|
"prettier/prettier": "error",
|
||||||
"import/extensions": ["error", "always"],
|
"import/extensions": ["error", "always"],
|
||||||
"unicorn/prevent-abbreviations": "error",
|
"unicorn/prevent-abbreviations": "error",
|
||||||
"@typescript-eslint/await-thenable": "off"
|
"@typescript-eslint/await-thenable": "off",
|
||||||
|
"@typescript-eslint/no-misused-promises": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
250
package-lock.json
generated
250
package-lock.json
generated
@ -36,7 +36,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "16.2.1",
|
"@commitlint/cli": "16.2.1",
|
||||||
"@commitlint/config-conventional": "16.2.1",
|
"@commitlint/config-conventional": "16.2.1",
|
||||||
"@saithodev/semantic-release-backmerge": "2.1.1",
|
"@saithodev/semantic-release-backmerge": "2.1.2",
|
||||||
"@swc/cli": "0.1.55",
|
"@swc/cli": "0.1.55",
|
||||||
"@swc/core": "1.2.146",
|
"@swc/core": "1.2.146",
|
||||||
"@swc/jest": "0.2.20",
|
"@swc/jest": "0.2.20",
|
||||||
@ -49,7 +49,7 @@
|
|||||||
"@types/ms": "0.7.31",
|
"@types/ms": "0.7.31",
|
||||||
"@types/node": "17.0.21",
|
"@types/node": "17.0.21",
|
||||||
"@types/nodemailer": "6.4.4",
|
"@types/nodemailer": "6.4.4",
|
||||||
"@typescript-eslint/eslint-plugin": "5.12.1",
|
"@typescript-eslint/eslint-plugin": "5.13.0",
|
||||||
"concurrently": "7.0.0",
|
"concurrently": "7.0.0",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"editorconfig-checker": "4.0.2",
|
"editorconfig-checker": "4.0.2",
|
||||||
@ -72,7 +72,7 @@
|
|||||||
"prisma": "3.10.0",
|
"prisma": "3.10.0",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"semantic-release": "19.0.2",
|
"semantic-release": "19.0.2",
|
||||||
"typescript": "4.5.5"
|
"typescript": "4.6.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0",
|
"node": ">=16.0.0",
|
||||||
@ -1588,9 +1588,9 @@
|
|||||||
"integrity": "sha512-cVYs5gyQH/qyut24hUvDznCfPrWiNMKNfPb9WmEoiU6ihlkscIbCfkmuKTtspVLWRdl0LqjYEC7vfnPv17HWhw=="
|
"integrity": "sha512-cVYs5gyQH/qyut24hUvDznCfPrWiNMKNfPb9WmEoiU6ihlkscIbCfkmuKTtspVLWRdl0LqjYEC7vfnPv17HWhw=="
|
||||||
},
|
},
|
||||||
"node_modules/@saithodev/semantic-release-backmerge": {
|
"node_modules/@saithodev/semantic-release-backmerge": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@saithodev/semantic-release-backmerge/-/semantic-release-backmerge-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@saithodev/semantic-release-backmerge/-/semantic-release-backmerge-2.1.2.tgz",
|
||||||
"integrity": "sha512-GUMOHJ8/q1V3bAXlvT3+ImveEyJt+NvRSrlJIbQda8o8c/QN9JiK9yP+aCMTjm1tQK/gp1c+/TeyniYC2nPRlg==",
|
"integrity": "sha512-fNd8cmijjFIMp4GcdTAcug/7tr4k+8bAyvSsbLOnfyKCWyq42lg14vFZOryLiyLUAe8gpPlI7XzDPWyFTR5zug==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@semantic-release/error": "^2.2.0 || ^3.0.0",
|
"@semantic-release/error": "^2.2.0 || ^3.0.0",
|
||||||
@ -1691,9 +1691,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@semantic-release/npm": {
|
"node_modules/@semantic-release/npm": {
|
||||||
"version": "9.0.0",
|
"version": "9.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-9.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-9.0.1.tgz",
|
||||||
"integrity": "sha512-hj2jqayS2SPUmFtCMCOQMX975uMDfRoymj1HvMSwYdaoI6hVZvhrTFPBgJeM85O0C+G3IFviAUar5gel/1VGDQ==",
|
"integrity": "sha512-I5nVZklxBzfMFwemhRNbSrkiN/dsH3c7K9+KSk6jUnq0rdLFUuJt7EBsysq4Ir3moajQgFkfEryEHPqiKJj20g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@semantic-release/error": "^3.0.0",
|
"@semantic-release/error": "^3.0.0",
|
||||||
@ -2420,14 +2420,14 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz",
|
||||||
"integrity": "sha512-M499lqa8rnNK7mUv74lSFFttuUsubIRdAbHcVaP93oFcKkEmHmLqy2n7jM9C8DVmFMYK61ExrZU6dLYhQZmUpw==",
|
"integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "5.12.1",
|
"@typescript-eslint/scope-manager": "5.13.0",
|
||||||
"@typescript-eslint/type-utils": "5.12.1",
|
"@typescript-eslint/type-utils": "5.13.0",
|
||||||
"@typescript-eslint/utils": "5.12.1",
|
"@typescript-eslint/utils": "5.13.0",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
"functional-red-black-tree": "^1.0.1",
|
"functional-red-black-tree": "^1.0.1",
|
||||||
"ignore": "^5.1.8",
|
"ignore": "^5.1.8",
|
||||||
@ -2453,15 +2453,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz",
|
||||||
"integrity": "sha512-6LuVUbe7oSdHxUWoX/m40Ni8gsZMKCi31rlawBHt7VtW15iHzjbpj2WLiToG2758KjtCCiLRKZqfrOdl3cNKuw==",
|
"integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "5.12.1",
|
"@typescript-eslint/scope-manager": "5.13.0",
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"@typescript-eslint/typescript-estree": "5.12.1",
|
"@typescript-eslint/typescript-estree": "5.13.0",
|
||||||
"debug": "^4.3.2"
|
"debug": "^4.3.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -2481,13 +2481,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz",
|
||||||
"integrity": "sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ==",
|
"integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"@typescript-eslint/visitor-keys": "5.12.1"
|
"@typescript-eslint/visitor-keys": "5.13.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@ -2498,12 +2498,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/type-utils": {
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz",
|
||||||
"integrity": "sha512-Gh8feEhsNLeCz6aYqynh61Vsdy+tiNNkQtc+bN3IvQvRqHkXGUhYkUi+ePKzP0Mb42se7FDb+y2SypTbpbR/Sg==",
|
"integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/utils": "5.12.1",
|
"@typescript-eslint/utils": "5.13.0",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
"tsutils": "^3.21.0"
|
"tsutils": "^3.21.0"
|
||||||
},
|
},
|
||||||
@ -2524,9 +2524,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/types": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz",
|
||||||
"integrity": "sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA==",
|
"integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@ -2537,13 +2537,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz",
|
||||||
"integrity": "sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw==",
|
"integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"@typescript-eslint/visitor-keys": "5.12.1",
|
"@typescript-eslint/visitor-keys": "5.13.0",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
"globby": "^11.0.4",
|
"globby": "^11.0.4",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@ -2564,15 +2564,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/utils": {
|
"node_modules/@typescript-eslint/utils": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz",
|
||||||
"integrity": "sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ==",
|
"integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/json-schema": "^7.0.9",
|
"@types/json-schema": "^7.0.9",
|
||||||
"@typescript-eslint/scope-manager": "5.12.1",
|
"@typescript-eslint/scope-manager": "5.13.0",
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"@typescript-eslint/typescript-estree": "5.12.1",
|
"@typescript-eslint/typescript-estree": "5.13.0",
|
||||||
"eslint-scope": "^5.1.1",
|
"eslint-scope": "^5.1.1",
|
||||||
"eslint-utils": "^3.0.0"
|
"eslint-utils": "^3.0.0"
|
||||||
},
|
},
|
||||||
@ -2588,12 +2588,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz",
|
||||||
"integrity": "sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A==",
|
"integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"eslint-visitor-keys": "^3.0.0"
|
"eslint-visitor-keys": "^3.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -4122,13 +4122,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cosmiconfig-typescript-loader": {
|
"node_modules/cosmiconfig-typescript-loader": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-1.0.6.tgz",
|
||||||
"integrity": "sha512-FL/YR1nb8hyN0bAcP3MBaIoZravfZtVsN/RuPnoo6UVjqIrDxSNIpXHCGgJe0ZWy5yImpyD6jq5wCJ5f1nUv8g==",
|
"integrity": "sha512-2nEotziYJWtNtoTjKbchj9QrdTT6DBxCvqjNKoDKARw+e2yZmTQCa07uRrykLIZuvSgp69YXLH89UHc0WhdMfQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cosmiconfig": "^7",
|
"cosmiconfig": "^7",
|
||||||
"ts-node": "^10.5.0"
|
"ts-node": "^10.6.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12",
|
"node": ">=12",
|
||||||
@ -4637,9 +4637,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.4.73",
|
"version": "1.4.75",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.73.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.75.tgz",
|
||||||
"integrity": "sha512-RlCffXkE/LliqfA5m29+dVDPB2r72y2D2egMMfIy3Le8ODrxjuZNVo4NIC2yPL01N4xb4nZQLwzi6Z5tGIGLnA==",
|
"integrity": "sha512-LxgUNeu3BVU7sXaKjUDD9xivocQLxFtq6wgERrutdY/yIOps3ODOZExK1jg8DTEg4U8TUCb5MLGeWFOYuxjF3Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/emittery": {
|
"node_modules/emittery": {
|
||||||
@ -6502,9 +6502,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/has-symbols": {
|
"node_modules/has-symbols": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||||
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==",
|
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@ -15141,9 +15141,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ts-node": {
|
"node_modules/ts-node": {
|
||||||
"version": "10.5.0",
|
"version": "10.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.6.0.tgz",
|
||||||
"integrity": "sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw==",
|
"integrity": "sha512-CJen6+dfOXolxudBQXnVjRVvYTmTWbyz7cn+xq2XTsvnaXbHqr4gXSCNbS2Jj8yTZMuGwUoBESLaOkLascVVvg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cspotcode/source-map-support": "0.7.0",
|
"@cspotcode/source-map-support": "0.7.0",
|
||||||
@ -15306,9 +15306,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.5.5",
|
"version": "4.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
|
||||||
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
|
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
@ -17099,9 +17099,9 @@
|
|||||||
"integrity": "sha512-cVYs5gyQH/qyut24hUvDznCfPrWiNMKNfPb9WmEoiU6ihlkscIbCfkmuKTtspVLWRdl0LqjYEC7vfnPv17HWhw=="
|
"integrity": "sha512-cVYs5gyQH/qyut24hUvDznCfPrWiNMKNfPb9WmEoiU6ihlkscIbCfkmuKTtspVLWRdl0LqjYEC7vfnPv17HWhw=="
|
||||||
},
|
},
|
||||||
"@saithodev/semantic-release-backmerge": {
|
"@saithodev/semantic-release-backmerge": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@saithodev/semantic-release-backmerge/-/semantic-release-backmerge-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@saithodev/semantic-release-backmerge/-/semantic-release-backmerge-2.1.2.tgz",
|
||||||
"integrity": "sha512-GUMOHJ8/q1V3bAXlvT3+ImveEyJt+NvRSrlJIbQda8o8c/QN9JiK9yP+aCMTjm1tQK/gp1c+/TeyniYC2nPRlg==",
|
"integrity": "sha512-fNd8cmijjFIMp4GcdTAcug/7tr4k+8bAyvSsbLOnfyKCWyq42lg14vFZOryLiyLUAe8gpPlI7XzDPWyFTR5zug==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@semantic-release/error": "^2.2.0 || ^3.0.0",
|
"@semantic-release/error": "^2.2.0 || ^3.0.0",
|
||||||
@ -17183,9 +17183,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@semantic-release/npm": {
|
"@semantic-release/npm": {
|
||||||
"version": "9.0.0",
|
"version": "9.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-9.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-9.0.1.tgz",
|
||||||
"integrity": "sha512-hj2jqayS2SPUmFtCMCOQMX975uMDfRoymj1HvMSwYdaoI6hVZvhrTFPBgJeM85O0C+G3IFviAUar5gel/1VGDQ==",
|
"integrity": "sha512-I5nVZklxBzfMFwemhRNbSrkiN/dsH3c7K9+KSk6jUnq0rdLFUuJt7EBsysq4Ir3moajQgFkfEryEHPqiKJj20g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@semantic-release/error": "^3.0.0",
|
"@semantic-release/error": "^3.0.0",
|
||||||
@ -17699,14 +17699,14 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/eslint-plugin": {
|
"@typescript-eslint/eslint-plugin": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz",
|
||||||
"integrity": "sha512-M499lqa8rnNK7mUv74lSFFttuUsubIRdAbHcVaP93oFcKkEmHmLqy2n7jM9C8DVmFMYK61ExrZU6dLYhQZmUpw==",
|
"integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/scope-manager": "5.12.1",
|
"@typescript-eslint/scope-manager": "5.13.0",
|
||||||
"@typescript-eslint/type-utils": "5.12.1",
|
"@typescript-eslint/type-utils": "5.13.0",
|
||||||
"@typescript-eslint/utils": "5.12.1",
|
"@typescript-eslint/utils": "5.13.0",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
"functional-red-black-tree": "^1.0.1",
|
"functional-red-black-tree": "^1.0.1",
|
||||||
"ignore": "^5.1.8",
|
"ignore": "^5.1.8",
|
||||||
@ -17716,53 +17716,53 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/parser": {
|
"@typescript-eslint/parser": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz",
|
||||||
"integrity": "sha512-6LuVUbe7oSdHxUWoX/m40Ni8gsZMKCi31rlawBHt7VtW15iHzjbpj2WLiToG2758KjtCCiLRKZqfrOdl3cNKuw==",
|
"integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/scope-manager": "5.12.1",
|
"@typescript-eslint/scope-manager": "5.13.0",
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"@typescript-eslint/typescript-estree": "5.12.1",
|
"@typescript-eslint/typescript-estree": "5.13.0",
|
||||||
"debug": "^4.3.2"
|
"debug": "^4.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/scope-manager": {
|
"@typescript-eslint/scope-manager": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz",
|
||||||
"integrity": "sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ==",
|
"integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"@typescript-eslint/visitor-keys": "5.12.1"
|
"@typescript-eslint/visitor-keys": "5.13.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/type-utils": {
|
"@typescript-eslint/type-utils": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz",
|
||||||
"integrity": "sha512-Gh8feEhsNLeCz6aYqynh61Vsdy+tiNNkQtc+bN3IvQvRqHkXGUhYkUi+ePKzP0Mb42se7FDb+y2SypTbpbR/Sg==",
|
"integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/utils": "5.12.1",
|
"@typescript-eslint/utils": "5.13.0",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
"tsutils": "^3.21.0"
|
"tsutils": "^3.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/types": {
|
"@typescript-eslint/types": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz",
|
||||||
"integrity": "sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA==",
|
"integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz",
|
||||||
"integrity": "sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw==",
|
"integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"@typescript-eslint/visitor-keys": "5.12.1",
|
"@typescript-eslint/visitor-keys": "5.13.0",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
"globby": "^11.0.4",
|
"globby": "^11.0.4",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@ -17771,26 +17771,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/utils": {
|
"@typescript-eslint/utils": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz",
|
||||||
"integrity": "sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ==",
|
"integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/json-schema": "^7.0.9",
|
"@types/json-schema": "^7.0.9",
|
||||||
"@typescript-eslint/scope-manager": "5.12.1",
|
"@typescript-eslint/scope-manager": "5.13.0",
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"@typescript-eslint/typescript-estree": "5.12.1",
|
"@typescript-eslint/typescript-estree": "5.13.0",
|
||||||
"eslint-scope": "^5.1.1",
|
"eslint-scope": "^5.1.1",
|
||||||
"eslint-utils": "^3.0.0"
|
"eslint-utils": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/visitor-keys": {
|
"@typescript-eslint/visitor-keys": {
|
||||||
"version": "5.12.1",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz",
|
||||||
"integrity": "sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A==",
|
"integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.12.1",
|
"@typescript-eslint/types": "5.13.0",
|
||||||
"eslint-visitor-keys": "^3.0.0"
|
"eslint-visitor-keys": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -18962,13 +18962,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cosmiconfig-typescript-loader": {
|
"cosmiconfig-typescript-loader": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-1.0.6.tgz",
|
||||||
"integrity": "sha512-FL/YR1nb8hyN0bAcP3MBaIoZravfZtVsN/RuPnoo6UVjqIrDxSNIpXHCGgJe0ZWy5yImpyD6jq5wCJ5f1nUv8g==",
|
"integrity": "sha512-2nEotziYJWtNtoTjKbchj9QrdTT6DBxCvqjNKoDKARw+e2yZmTQCa07uRrykLIZuvSgp69YXLH89UHc0WhdMfQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"cosmiconfig": "^7",
|
"cosmiconfig": "^7",
|
||||||
"ts-node": "^10.5.0"
|
"ts-node": "^10.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"create-require": {
|
"create-require": {
|
||||||
@ -19363,9 +19363,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"electron-to-chromium": {
|
"electron-to-chromium": {
|
||||||
"version": "1.4.73",
|
"version": "1.4.75",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.73.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.75.tgz",
|
||||||
"integrity": "sha512-RlCffXkE/LliqfA5m29+dVDPB2r72y2D2egMMfIy3Le8ODrxjuZNVo4NIC2yPL01N4xb4nZQLwzi6Z5tGIGLnA==",
|
"integrity": "sha512-LxgUNeu3BVU7sXaKjUDD9xivocQLxFtq6wgERrutdY/yIOps3ODOZExK1jg8DTEg4U8TUCb5MLGeWFOYuxjF3Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"emittery": {
|
"emittery": {
|
||||||
@ -20803,9 +20803,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"has-symbols": {
|
"has-symbols": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||||
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==",
|
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"has-tostringtag": {
|
"has-tostringtag": {
|
||||||
@ -27173,9 +27173,9 @@
|
|||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"ts-node": {
|
"ts-node": {
|
||||||
"version": "10.5.0",
|
"version": "10.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.6.0.tgz",
|
||||||
"integrity": "sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw==",
|
"integrity": "sha512-CJen6+dfOXolxudBQXnVjRVvYTmTWbyz7cn+xq2XTsvnaXbHqr4gXSCNbS2Jj8yTZMuGwUoBESLaOkLascVVvg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@cspotcode/source-map-support": "0.7.0",
|
"@cspotcode/source-map-support": "0.7.0",
|
||||||
@ -27293,9 +27293,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.5.5",
|
"version": "4.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
|
||||||
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
|
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uc.micro": {
|
"uc.micro": {
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "16.2.1",
|
"@commitlint/cli": "16.2.1",
|
||||||
"@commitlint/config-conventional": "16.2.1",
|
"@commitlint/config-conventional": "16.2.1",
|
||||||
"@saithodev/semantic-release-backmerge": "2.1.1",
|
"@saithodev/semantic-release-backmerge": "2.1.2",
|
||||||
"@swc/cli": "0.1.55",
|
"@swc/cli": "0.1.55",
|
||||||
"@swc/core": "1.2.146",
|
"@swc/core": "1.2.146",
|
||||||
"@swc/jest": "0.2.20",
|
"@swc/jest": "0.2.20",
|
||||||
@ -71,7 +71,7 @@
|
|||||||
"@types/ms": "0.7.31",
|
"@types/ms": "0.7.31",
|
||||||
"@types/node": "17.0.21",
|
"@types/node": "17.0.21",
|
||||||
"@types/nodemailer": "6.4.4",
|
"@types/nodemailer": "6.4.4",
|
||||||
"@typescript-eslint/eslint-plugin": "5.12.1",
|
"@typescript-eslint/eslint-plugin": "5.13.0",
|
||||||
"concurrently": "7.0.0",
|
"concurrently": "7.0.0",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"editorconfig-checker": "4.0.2",
|
"editorconfig-checker": "4.0.2",
|
||||||
@ -94,6 +94,6 @@
|
|||||||
"prisma": "3.10.0",
|
"prisma": "3.10.0",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"semantic-release": "19.0.2",
|
"semantic-release": "19.0.2",
|
||||||
"typescript": "4.5.5"
|
"typescript": "4.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,15 @@ import { memberExample } from '../../../../models/Member.js'
|
|||||||
|
|
||||||
describe('DELETE /channels/[channelId]', () => {
|
describe('DELETE /channels/[channelId]', () => {
|
||||||
it('succeeds', async () => {
|
it('succeeds', async () => {
|
||||||
|
const defaultChannelId = 5
|
||||||
prismaMock.channel.findUnique.mockResolvedValue(channelExample)
|
prismaMock.channel.findUnique.mockResolvedValue(channelExample)
|
||||||
prismaMock.member.findFirst.mockResolvedValue(memberExample)
|
prismaMock.member.findFirst.mockResolvedValue(memberExample)
|
||||||
prismaMock.channel.count.mockResolvedValue(2)
|
prismaMock.channel.count.mockResolvedValue(2)
|
||||||
prismaMock.channel.delete.mockResolvedValue(channelExample)
|
prismaMock.channel.delete.mockResolvedValue(channelExample)
|
||||||
|
prismaMock.channel.findFirst.mockResolvedValue({
|
||||||
|
...channelExample,
|
||||||
|
id: defaultChannelId
|
||||||
|
})
|
||||||
const { accessToken } = await authenticateUserTest()
|
const { accessToken } = await authenticateUserTest()
|
||||||
const response = await application.inject({
|
const response = await application.inject({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@ -23,6 +28,7 @@ describe('DELETE /channels/[channelId]', () => {
|
|||||||
expect(responseJson.id).toEqual(channelExample.id)
|
expect(responseJson.id).toEqual(channelExample.id)
|
||||||
expect(responseJson.name).toEqual(channelExample.name)
|
expect(responseJson.name).toEqual(channelExample.name)
|
||||||
expect(responseJson.guildId).toEqual(channelExample.guildId)
|
expect(responseJson.guildId).toEqual(channelExample.guildId)
|
||||||
|
expect(responseJson.defaultChannelId).toEqual(defaultChannelId)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fails if there is only one channel', async () => {
|
it('fails if there is only one channel', async () => {
|
||||||
|
@ -6,9 +6,14 @@ import { memberExample } from '../../../../models/Member.js'
|
|||||||
|
|
||||||
describe('PUT /channels/[channelId]', () => {
|
describe('PUT /channels/[channelId]', () => {
|
||||||
it('succeeds', async () => {
|
it('succeeds', async () => {
|
||||||
|
const defaultChannelId = 5
|
||||||
prismaMock.channel.findUnique.mockResolvedValue(channelExample)
|
prismaMock.channel.findUnique.mockResolvedValue(channelExample)
|
||||||
prismaMock.member.findFirst.mockResolvedValue(memberExample)
|
prismaMock.member.findFirst.mockResolvedValue(memberExample)
|
||||||
prismaMock.channel.update.mockResolvedValue(channelExample)
|
prismaMock.channel.update.mockResolvedValue(channelExample)
|
||||||
|
prismaMock.channel.findFirst.mockResolvedValue({
|
||||||
|
...channelExample,
|
||||||
|
id: defaultChannelId
|
||||||
|
})
|
||||||
const { accessToken } = await authenticateUserTest()
|
const { accessToken } = await authenticateUserTest()
|
||||||
const response = await application.inject({
|
const response = await application.inject({
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
@ -23,6 +28,7 @@ describe('PUT /channels/[channelId]', () => {
|
|||||||
expect(responseJson.id).toEqual(channelExample.id)
|
expect(responseJson.id).toEqual(channelExample.id)
|
||||||
expect(responseJson.name).toEqual(channelExample.name)
|
expect(responseJson.name).toEqual(channelExample.name)
|
||||||
expect(responseJson.guildId).toEqual(channelExample.guildId)
|
expect(responseJson.guildId).toEqual(channelExample.guildId)
|
||||||
|
expect(responseJson.defaultChannelId).toEqual(defaultChannelId)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fails if the channel is not found', async () => {
|
it('fails if the channel is not found', async () => {
|
||||||
|
@ -22,7 +22,10 @@ const deleteServiceSchema: FastifySchema = {
|
|||||||
] as Array<{ [key: string]: [] }>,
|
] as Array<{ [key: string]: [] }>,
|
||||||
params: parametersSchema,
|
params: parametersSchema,
|
||||||
response: {
|
response: {
|
||||||
200: Type.Object(channelSchema),
|
200: Type.Object({
|
||||||
|
...channelSchema,
|
||||||
|
defaultChannelId: channelSchema.id
|
||||||
|
}),
|
||||||
400: fastifyErrors[400],
|
400: fastifyErrors[400],
|
||||||
401: fastifyErrors[401],
|
401: fastifyErrors[401],
|
||||||
403: fastifyErrors[403],
|
403: fastifyErrors[403],
|
||||||
@ -72,16 +75,26 @@ export const deleteChannelService: FastifyPluginAsync = async (fastify) => {
|
|||||||
const channel = await prisma.channel.delete({
|
const channel = await prisma.channel.delete({
|
||||||
where: { id: channelId }
|
where: { id: channelId }
|
||||||
})
|
})
|
||||||
|
const defaultChannel = await prisma.channel.findFirst({
|
||||||
|
where: { guildId: member.guildId }
|
||||||
|
})
|
||||||
|
if (defaultChannel == null) {
|
||||||
|
throw fastify.httpErrors.internalServerError()
|
||||||
|
}
|
||||||
|
const item = {
|
||||||
|
...channel,
|
||||||
|
defaultChannelId: defaultChannel.id
|
||||||
|
}
|
||||||
await fastify.io.emitToMembers({
|
await fastify.io.emitToMembers({
|
||||||
event: 'channels',
|
event: 'channels',
|
||||||
guildId: member.guildId,
|
guildId: member.guildId,
|
||||||
payload: {
|
payload: {
|
||||||
action: 'delete',
|
action: 'delete',
|
||||||
item: channel
|
item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
reply.statusCode = 200
|
reply.statusCode = 200
|
||||||
return channel
|
return item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,10 @@ const putServiceSchema: FastifySchema = {
|
|||||||
params: parametersSchema,
|
params: parametersSchema,
|
||||||
body: bodyPutServiceSchema,
|
body: bodyPutServiceSchema,
|
||||||
response: {
|
response: {
|
||||||
200: Type.Object(channelSchema),
|
200: Type.Object({
|
||||||
|
...channelSchema,
|
||||||
|
defaultChannelId: channelSchema.id
|
||||||
|
}),
|
||||||
400: fastifyErrors[400],
|
400: fastifyErrors[400],
|
||||||
401: fastifyErrors[401],
|
401: fastifyErrors[401],
|
||||||
403: fastifyErrors[403],
|
403: fastifyErrors[403],
|
||||||
@ -74,16 +77,26 @@ export const putChannelService: FastifyPluginAsync = async (fastify) => {
|
|||||||
where: { id: channelId },
|
where: { id: channelId },
|
||||||
data: { name }
|
data: { name }
|
||||||
})
|
})
|
||||||
|
const defaultChannel = await prisma.channel.findFirst({
|
||||||
|
where: { guildId: member.guildId }
|
||||||
|
})
|
||||||
|
if (defaultChannel == null) {
|
||||||
|
throw fastify.httpErrors.internalServerError()
|
||||||
|
}
|
||||||
|
const item = {
|
||||||
|
...channel,
|
||||||
|
defaultChannelId: defaultChannel.id
|
||||||
|
}
|
||||||
await fastify.io.emitToMembers({
|
await fastify.io.emitToMembers({
|
||||||
event: 'channels',
|
event: 'channels',
|
||||||
guildId: member.guildId,
|
guildId: member.guildId,
|
||||||
payload: {
|
payload: {
|
||||||
action: 'update',
|
action: 'update',
|
||||||
item: channel
|
item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
reply.statusCode = 200
|
reply.statusCode = 200
|
||||||
return channel
|
return item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,9 @@ describe('DELETE /guilds/[guildId]', () => {
|
|||||||
it('succeeds and delete the guild', async () => {
|
it('succeeds and delete the guild', async () => {
|
||||||
prismaMock.member.findFirst.mockResolvedValue({
|
prismaMock.member.findFirst.mockResolvedValue({
|
||||||
...memberExample,
|
...memberExample,
|
||||||
isOwner: true
|
isOwner: true,
|
||||||
})
|
guild: guildExample
|
||||||
|
} as any)
|
||||||
prismaMock.guild.delete.mockResolvedValue(guildExample)
|
prismaMock.guild.delete.mockResolvedValue(guildExample)
|
||||||
const { accessToken } = await authenticateUserTest()
|
const { accessToken } = await authenticateUserTest()
|
||||||
const response = await application.inject({
|
const response = await application.inject({
|
||||||
@ -41,8 +42,9 @@ describe('DELETE /guilds/[guildId]', () => {
|
|||||||
it('fails if the user is not the owner', async () => {
|
it('fails if the user is not the owner', async () => {
|
||||||
prismaMock.member.findFirst.mockResolvedValue({
|
prismaMock.member.findFirst.mockResolvedValue({
|
||||||
...memberExample,
|
...memberExample,
|
||||||
isOwner: false
|
isOwner: false,
|
||||||
})
|
guild: guildExample
|
||||||
|
} as any)
|
||||||
const { accessToken } = await authenticateUserTest()
|
const { accessToken } = await authenticateUserTest()
|
||||||
const response = await application.inject({
|
const response = await application.inject({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@ -52,7 +54,7 @@ describe('DELETE /guilds/[guildId]', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const responseJson = response.json()
|
const responseJson = response.json()
|
||||||
expect(response.statusCode).toEqual(403)
|
expect(response.statusCode).toEqual(400)
|
||||||
expect(responseJson.message).toEqual('You should be an owner of the guild')
|
expect(responseJson.message).toEqual('You should be an owner of the guild')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -4,14 +4,20 @@ import { prismaMock } from '../../../../__test__/setup.js'
|
|||||||
import { memberExample } from '../../../../models/Member.js'
|
import { memberExample } from '../../../../models/Member.js'
|
||||||
import { guildExample } from '../../../../models/Guild.js'
|
import { guildExample } from '../../../../models/Guild.js'
|
||||||
import { userExample } from '../../../../models/User.js'
|
import { userExample } from '../../../../models/User.js'
|
||||||
|
import { channelExample } from '../../../../models/Channel.js'
|
||||||
|
|
||||||
describe('GET /guilds/[guildId]', () => {
|
describe('GET /guilds/[guildId]', () => {
|
||||||
it('succeeds', async () => {
|
it('succeeds', async () => {
|
||||||
|
const defaultChannelId = 5
|
||||||
prismaMock.member.findFirst.mockResolvedValue({
|
prismaMock.member.findFirst.mockResolvedValue({
|
||||||
...memberExample,
|
...memberExample,
|
||||||
guild: guildExample,
|
guild: guildExample,
|
||||||
user: userExample
|
user: userExample
|
||||||
} as any)
|
} as any)
|
||||||
|
prismaMock.channel.findFirst.mockResolvedValue({
|
||||||
|
...channelExample,
|
||||||
|
id: defaultChannelId
|
||||||
|
})
|
||||||
const { accessToken, user } = await authenticateUserTest()
|
const { accessToken, user } = await authenticateUserTest()
|
||||||
const response = await application.inject({
|
const response = await application.inject({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -25,7 +31,9 @@ describe('GET /guilds/[guildId]', () => {
|
|||||||
expect(responseJson.member.isOwner).toEqual(memberExample.isOwner)
|
expect(responseJson.member.isOwner).toEqual(memberExample.isOwner)
|
||||||
expect(responseJson.member.user.name).toEqual(user.name)
|
expect(responseJson.member.user.name).toEqual(user.name)
|
||||||
expect(responseJson.member.user.email).toBeNull()
|
expect(responseJson.member.user.email).toBeNull()
|
||||||
|
expect(responseJson.guild.id).toEqual(guildExample.id)
|
||||||
expect(responseJson.guild.name).toEqual(guildExample.name)
|
expect(responseJson.guild.name).toEqual(guildExample.name)
|
||||||
|
expect(responseJson.guild.defaultChannelId).toEqual(defaultChannelId)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fails with not found guild', async () => {
|
it('fails with not found guild', async () => {
|
||||||
|
@ -3,9 +3,11 @@ import { authenticateUserTest } from '../../../../__test__/utils/authenticateUse
|
|||||||
import { prismaMock } from '../../../../__test__/setup.js'
|
import { prismaMock } from '../../../../__test__/setup.js'
|
||||||
import { guildExample } from '../../../../models/Guild.js'
|
import { guildExample } from '../../../../models/Guild.js'
|
||||||
import { memberExample } from '../../../../models/Member.js'
|
import { memberExample } from '../../../../models/Member.js'
|
||||||
|
import { channelExample } from '../../../../models/Channel.js'
|
||||||
|
|
||||||
describe('PUT /guilds/[guildId]', () => {
|
describe('PUT /guilds/[guildId]', () => {
|
||||||
it('succeeds and edit the guild', async () => {
|
it('succeeds and edit the guild', async () => {
|
||||||
|
const defaultChannelId = 5
|
||||||
const newName = 'New guild name'
|
const newName = 'New guild name'
|
||||||
const newDescription = 'New guild description'
|
const newDescription = 'New guild description'
|
||||||
prismaMock.member.findFirst.mockResolvedValue({
|
prismaMock.member.findFirst.mockResolvedValue({
|
||||||
@ -18,6 +20,10 @@ describe('PUT /guilds/[guildId]', () => {
|
|||||||
name: newName,
|
name: newName,
|
||||||
description: newDescription
|
description: newDescription
|
||||||
})
|
})
|
||||||
|
prismaMock.channel.findFirst.mockResolvedValue({
|
||||||
|
...channelExample,
|
||||||
|
id: defaultChannelId
|
||||||
|
})
|
||||||
const { accessToken } = await authenticateUserTest()
|
const { accessToken } = await authenticateUserTest()
|
||||||
const response = await application.inject({
|
const response = await application.inject({
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
@ -34,6 +40,7 @@ describe('PUT /guilds/[guildId]', () => {
|
|||||||
expect(response.statusCode).toEqual(200)
|
expect(response.statusCode).toEqual(200)
|
||||||
expect(responseJson.name).toEqual(newName)
|
expect(responseJson.name).toEqual(newName)
|
||||||
expect(responseJson.description).toEqual(newDescription)
|
expect(responseJson.description).toEqual(newDescription)
|
||||||
|
expect(responseJson.defaultChannelId).toEqual(defaultChannelId)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("fails if the guild doesn't exist", async () => {
|
it("fails if the guild doesn't exist", async () => {
|
||||||
@ -76,7 +83,7 @@ describe('PUT /guilds/[guildId]', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const responseJson = response.json()
|
const responseJson = response.json()
|
||||||
expect(response.statusCode).toEqual(403)
|
expect(response.statusCode).toEqual(400)
|
||||||
expect(responseJson.message).toEqual('You should be an owner of the guild')
|
expect(responseJson.message).toEqual('You should be an owner of the guild')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -7,8 +7,13 @@ import { guildExample } from '../../../../../models/Guild.js'
|
|||||||
|
|
||||||
describe('POST /guilds/[guildId]/channels', () => {
|
describe('POST /guilds/[guildId]/channels', () => {
|
||||||
it('succeeds', async () => {
|
it('succeeds', async () => {
|
||||||
|
const defaultChannelId = 5
|
||||||
prismaMock.member.findFirst.mockResolvedValue(memberExample)
|
prismaMock.member.findFirst.mockResolvedValue(memberExample)
|
||||||
prismaMock.channel.create.mockResolvedValue(channelExample)
|
prismaMock.channel.create.mockResolvedValue(channelExample)
|
||||||
|
prismaMock.channel.findFirst.mockResolvedValue({
|
||||||
|
...channelExample,
|
||||||
|
id: defaultChannelId
|
||||||
|
})
|
||||||
const { accessToken } = await authenticateUserTest()
|
const { accessToken } = await authenticateUserTest()
|
||||||
const response = await application.inject({
|
const response = await application.inject({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -23,6 +28,7 @@ describe('POST /guilds/[guildId]/channels', () => {
|
|||||||
expect(responseJson.id).toEqual(channelExample.id)
|
expect(responseJson.id).toEqual(channelExample.id)
|
||||||
expect(responseJson.name).toEqual(channelExample.name)
|
expect(responseJson.name).toEqual(channelExample.name)
|
||||||
expect(responseJson.guildId).toEqual(channelExample.guildId)
|
expect(responseJson.guildId).toEqual(channelExample.guildId)
|
||||||
|
expect(responseJson.defaultChannelId).toEqual(defaultChannelId)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fails if the member is not found', async () => {
|
it('fails if the member is not found', async () => {
|
||||||
|
@ -30,7 +30,10 @@ const postChannelServiceSchema: FastifySchema = {
|
|||||||
body: bodyPostServiceSchema,
|
body: bodyPostServiceSchema,
|
||||||
params: parametersSchema,
|
params: parametersSchema,
|
||||||
response: {
|
response: {
|
||||||
201: Type.Object(channelSchema),
|
201: Type.Object({
|
||||||
|
...channelSchema,
|
||||||
|
defaultChannelId: channelSchema.id
|
||||||
|
}),
|
||||||
400: fastifyErrors[400],
|
400: fastifyErrors[400],
|
||||||
401: fastifyErrors[401],
|
401: fastifyErrors[401],
|
||||||
403: fastifyErrors[403],
|
403: fastifyErrors[403],
|
||||||
@ -71,16 +74,26 @@ export const postChannelService: FastifyPluginAsync = async (fastify) => {
|
|||||||
guildId
|
guildId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const defaultChannel = await prisma.channel.findFirst({
|
||||||
|
where: { guildId: member.guildId }
|
||||||
|
})
|
||||||
|
if (defaultChannel == null) {
|
||||||
|
throw fastify.httpErrors.internalServerError()
|
||||||
|
}
|
||||||
|
const item = {
|
||||||
|
...channel,
|
||||||
|
defaultChannelId: defaultChannel.id
|
||||||
|
}
|
||||||
await fastify.io.emitToMembers({
|
await fastify.io.emitToMembers({
|
||||||
event: 'channels',
|
event: 'channels',
|
||||||
guildId,
|
guildId,
|
||||||
payload: {
|
payload: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
item: channel
|
item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
reply.statusCode = 201
|
reply.statusCode = 201
|
||||||
return channel
|
return item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -46,23 +46,29 @@ export const deleteGuildByIdService: FastifyPluginAsync = async (fastify) => {
|
|||||||
}
|
}
|
||||||
const { guildId } = request.params
|
const { guildId } = request.params
|
||||||
const member = await prisma.member.findFirst({
|
const member = await prisma.member.findFirst({
|
||||||
where: { guildId, userId: request.user.current.id }
|
where: { guildId, userId: request.user.current.id },
|
||||||
|
include: {
|
||||||
|
guild: true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if (member == null) {
|
if (member == null || member.guild == null) {
|
||||||
throw fastify.httpErrors.notFound('Member not found')
|
throw fastify.httpErrors.notFound('Member not found')
|
||||||
}
|
}
|
||||||
if (!member.isOwner) {
|
if (!member.isOwner) {
|
||||||
throw fastify.httpErrors.forbidden(
|
throw fastify.httpErrors.badRequest(
|
||||||
'You should be an owner of the guild'
|
'You should be an owner of the guild'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const guild = await prisma.guild.delete({
|
|
||||||
where: { id: member.guildId }
|
|
||||||
})
|
|
||||||
await fastify.io.emitToMembers({
|
await fastify.io.emitToMembers({
|
||||||
event: 'guilds',
|
event: 'guilds',
|
||||||
guildId: guild.id,
|
guildId: member.guildId,
|
||||||
payload: { action: 'delete', item: guild }
|
payload: {
|
||||||
|
action: 'delete',
|
||||||
|
item: member.guild
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const guild = await prisma.guild.delete({
|
||||||
|
where: { id: member.guildId }
|
||||||
})
|
})
|
||||||
reply.statusCode = 200
|
reply.statusCode = 200
|
||||||
return guild
|
return guild
|
||||||
|
@ -7,6 +7,7 @@ import authenticateUser from '../../../tools/plugins/authenticateUser.js'
|
|||||||
import { guildSchema } from '../../../models/Guild.js'
|
import { guildSchema } from '../../../models/Guild.js'
|
||||||
import { memberSchema } from '../../../models/Member.js'
|
import { memberSchema } from '../../../models/Member.js'
|
||||||
import { userPublicWithoutSettingsSchema } from '../../../models/User.js'
|
import { userPublicWithoutSettingsSchema } from '../../../models/User.js'
|
||||||
|
import { channelSchema } from '../../../models/Channel.js'
|
||||||
|
|
||||||
const parametersSchema = Type.Object({
|
const parametersSchema = Type.Object({
|
||||||
guildId: guildSchema.id
|
guildId: guildSchema.id
|
||||||
@ -25,7 +26,10 @@ const getServiceSchema: FastifySchema = {
|
|||||||
params: parametersSchema,
|
params: parametersSchema,
|
||||||
response: {
|
response: {
|
||||||
200: Type.Object({
|
200: Type.Object({
|
||||||
guild: Type.Object(guildSchema),
|
guild: Type.Object({
|
||||||
|
...guildSchema,
|
||||||
|
defaultChannelId: channelSchema.id
|
||||||
|
}),
|
||||||
member: Type.Object({
|
member: Type.Object({
|
||||||
...memberSchema,
|
...memberSchema,
|
||||||
user: Type.Object(userPublicWithoutSettingsSchema)
|
user: Type.Object(userPublicWithoutSettingsSchema)
|
||||||
@ -76,9 +80,17 @@ export const getGuildMemberByIdService: FastifyPluginAsync = async (
|
|||||||
if (member == null) {
|
if (member == null) {
|
||||||
throw fastify.httpErrors.notFound('Member not found')
|
throw fastify.httpErrors.notFound('Member not found')
|
||||||
}
|
}
|
||||||
reply.statusCode = 200
|
const defaultChannel = await prisma.channel.findFirst({
|
||||||
return {
|
where: { guildId: member.guildId }
|
||||||
guild: member.guild,
|
})
|
||||||
|
if (defaultChannel == null) {
|
||||||
|
throw fastify.httpErrors.internalServerError()
|
||||||
|
}
|
||||||
|
const item = {
|
||||||
|
guild: {
|
||||||
|
...member.guild,
|
||||||
|
defaultChannelId: defaultChannel.id
|
||||||
|
},
|
||||||
member: {
|
member: {
|
||||||
...member,
|
...member,
|
||||||
user: {
|
user: {
|
||||||
@ -87,6 +99,8 @@ export const getGuildMemberByIdService: FastifyPluginAsync = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reply.statusCode = 200
|
||||||
|
return item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
maximumImageSize,
|
maximumImageSize,
|
||||||
supportedImageMimetype
|
supportedImageMimetype
|
||||||
} from '../../../../tools/configurations/index.js'
|
} from '../../../../tools/configurations/index.js'
|
||||||
|
import { channelSchema } from '../../../../models/Channel.js'
|
||||||
|
|
||||||
const parametersSchema = Type.Object({
|
const parametersSchema = Type.Object({
|
||||||
guildId: guildSchema.id
|
guildId: guildSchema.id
|
||||||
@ -31,9 +32,8 @@ const putServiceSchema: FastifySchema = {
|
|||||||
params: parametersSchema,
|
params: parametersSchema,
|
||||||
response: {
|
response: {
|
||||||
200: Type.Object({
|
200: Type.Object({
|
||||||
guild: Type.Object({
|
...guildSchema,
|
||||||
icon: Type.String()
|
defaultChannelId: channelSchema.id
|
||||||
})
|
|
||||||
}),
|
}),
|
||||||
400: fastifyErrors[400],
|
400: fastifyErrors[400],
|
||||||
401: fastifyErrors[401],
|
401: fastifyErrors[401],
|
||||||
@ -75,12 +75,24 @@ export const putGuildIconById: FastifyPluginAsync = async (fastify) => {
|
|||||||
where: { id: guildId },
|
where: { id: guildId },
|
||||||
data: { icon: file.pathToStoreInDatabase }
|
data: { icon: file.pathToStoreInDatabase }
|
||||||
})
|
})
|
||||||
reply.statusCode = 200
|
const defaultChannel = await prisma.channel.findFirst({
|
||||||
return {
|
where: { guildId: guild.id }
|
||||||
guild: {
|
})
|
||||||
icon: file.pathToStoreInDatabase
|
if (defaultChannel == null) {
|
||||||
}
|
throw fastify.httpErrors.internalServerError()
|
||||||
}
|
}
|
||||||
|
const item = {
|
||||||
|
...guild,
|
||||||
|
icon: file.pathToStoreInDatabase,
|
||||||
|
defaultChannelId: defaultChannel.id
|
||||||
|
}
|
||||||
|
await fastify.io.emitToMembers({
|
||||||
|
event: 'guilds',
|
||||||
|
guildId: guild.id,
|
||||||
|
payload: { action: 'update', item }
|
||||||
|
})
|
||||||
|
reply.statusCode = 200
|
||||||
|
return item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import { fastifyErrors } from '../../../models/utils.js'
|
|||||||
import authenticateUser from '../../../tools/plugins/authenticateUser.js'
|
import authenticateUser from '../../../tools/plugins/authenticateUser.js'
|
||||||
import { guildSchema } from '../../../models/Guild.js'
|
import { guildSchema } from '../../../models/Guild.js'
|
||||||
import { parseStringNullish } from '../../../tools/utils/parseStringNullish.js'
|
import { parseStringNullish } from '../../../tools/utils/parseStringNullish.js'
|
||||||
|
import { channelSchema } from '../../../models/Channel.js'
|
||||||
|
|
||||||
const parametersSchema = Type.Object({
|
const parametersSchema = Type.Object({
|
||||||
guildId: guildSchema.id
|
guildId: guildSchema.id
|
||||||
@ -31,7 +32,10 @@ const putServiceSchema: FastifySchema = {
|
|||||||
body: bodyPutServiceSchema,
|
body: bodyPutServiceSchema,
|
||||||
params: parametersSchema,
|
params: parametersSchema,
|
||||||
response: {
|
response: {
|
||||||
200: Type.Object(guildSchema),
|
200: Type.Object({
|
||||||
|
...guildSchema,
|
||||||
|
defaultChannelId: channelSchema.id
|
||||||
|
}),
|
||||||
400: fastifyErrors[400],
|
400: fastifyErrors[400],
|
||||||
401: fastifyErrors[401],
|
401: fastifyErrors[401],
|
||||||
403: fastifyErrors[403],
|
403: fastifyErrors[403],
|
||||||
@ -66,7 +70,7 @@ export const putGuildByIdService: FastifyPluginAsync = async (fastify) => {
|
|||||||
throw fastify.httpErrors.notFound('Member not found')
|
throw fastify.httpErrors.notFound('Member not found')
|
||||||
}
|
}
|
||||||
if (!member.isOwner) {
|
if (!member.isOwner) {
|
||||||
throw fastify.httpErrors.forbidden(
|
throw fastify.httpErrors.badRequest(
|
||||||
'You should be an owner of the guild'
|
'You should be an owner of the guild'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -77,13 +81,23 @@ export const putGuildByIdService: FastifyPluginAsync = async (fastify) => {
|
|||||||
description: parseStringNullish(member.guild.description, description)
|
description: parseStringNullish(member.guild.description, description)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const defaultChannel = await prisma.channel.findFirst({
|
||||||
|
where: { guildId: guild.id }
|
||||||
|
})
|
||||||
|
if (defaultChannel == null) {
|
||||||
|
throw fastify.httpErrors.internalServerError()
|
||||||
|
}
|
||||||
|
const item = {
|
||||||
|
...guild,
|
||||||
|
defaultChannelId: defaultChannel.id
|
||||||
|
}
|
||||||
await fastify.io.emitToMembers({
|
await fastify.io.emitToMembers({
|
||||||
event: 'guilds',
|
event: 'guilds',
|
||||||
guildId: guild.id,
|
guildId: guild.id,
|
||||||
payload: { action: 'update', item: guild }
|
payload: { action: 'update', item }
|
||||||
})
|
})
|
||||||
reply.statusCode = 200
|
reply.statusCode = 200
|
||||||
return guild
|
return item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user