Added error log to controller

This commit is contained in:
Vincent Alamelle 2023-05-15 15:45:50 +02:00
parent 01eda1b1d4
commit 2e4ca63d9d
13 changed files with 131 additions and 159 deletions

170
package-lock.json generated
View File

@ -17,7 +17,7 @@
"cors": "^2.8.5",
"express": "^4.18.2",
"jsonwebtoken": "^9.0.0",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.47",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.50",
"module-alias": "^2.2.2",
"multer": "^1.4.5-lts.1",
"next": "^13.1.5",
@ -1043,14 +1043,14 @@
"dev": true
},
"node_modules/@next/env": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.1.tgz",
"integrity": "sha512-eD6WCBMFjLFooLM19SIhSkWBHtaFrZFfg2Cxnyl3vS3DAdFRfnx5TY2RxlkuKXdIRCC0ySbtK9JXXt8qLCqzZg=="
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.2.tgz",
"integrity": "sha512-Wqvo7lDeS0KGwtwg9TT9wKQ8raelmUxt+TQKWvG/xKfcmDXNOtCuaszcfCF8JzlBG1q0VhpI6CKaRMbVPMDWgw=="
},
"node_modules/@next/swc-darwin-arm64": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.1.tgz",
"integrity": "sha512-eF8ARHtYfnoYtDa6xFHriUKA/Mfj/cCbmKb3NofeKhMccs65G6/loZ15a6wYCCx4rPAd6x4t1WmVYtri7EdeBg==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.2.tgz",
"integrity": "sha512-6BBlqGu3ewgJflv9iLCwO1v1hqlecaIH2AotpKfVUEzUxuuDNJQZ2a4KLb4MBl8T9/vca1YuWhSqtbF6ZuUJJw==",
"cpu": [
"arm64"
],
@ -1063,9 +1063,9 @@
}
},
"node_modules/@next/swc-darwin-x64": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.1.tgz",
"integrity": "sha512-7cmDgF9tGWTgn5Gw+vP17miJbH4wcraMHDCOHTYWkO/VeKT73dUWG23TNRLfgtCNSPgH4V5B4uLHoZTanx9bAw==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.2.tgz",
"integrity": "sha512-iZuYr7ZvGLPjPmfhhMl0ISm+z8EiyLBC1bLyFwGBxkWmPXqdJ60mzuTaDSr5WezDwv0fz32HB7JHmRC6JVHSZg==",
"cpu": [
"x64"
],
@ -1078,9 +1078,9 @@
}
},
"node_modules/@next/swc-linux-arm64-gnu": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.1.tgz",
"integrity": "sha512-qwJqmCri2ie8aTtE5gjTSr8S6O8B67KCYgVZhv9gKH44yvc/zXbAY8u23QGULsYOyh1islWE5sWfQNLOj9iryg==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.2.tgz",
"integrity": "sha512-2xVabFtIge6BJTcJrW8YuUnYTuQjh4jEuRuS2mscyNVOj6zUZkom3CQg+egKOoS+zh2rrro66ffSKIS+ztFJTg==",
"cpu": [
"arm64"
],
@ -1093,9 +1093,9 @@
}
},
"node_modules/@next/swc-linux-arm64-musl": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.1.tgz",
"integrity": "sha512-qcC54tWNGDv/VVIFkazxhqH1Bnagjfs4enzELVRlUOoJPD2BGJTPI7z08pQPbbgxLtRiu8gl2mXvpB8WlOkMeA==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.2.tgz",
"integrity": "sha512-wKRCQ27xCUJx5d6IivfjYGq8oVngqIhlhSAJntgXLt7Uo9sRT/3EppMHqUZRfyuNBTbykEre1s5166z+pvRB5A==",
"cpu": [
"arm64"
],
@ -1108,9 +1108,9 @@
}
},
"node_modules/@next/swc-linux-x64-gnu": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.1.tgz",
"integrity": "sha512-9TeWFlpLsBosZ+tsm/rWBaMwt5It9tPH8m3nawZqFUUrZyGRfGcI67js774vtx0k3rL9qbyY6+3pw9BCVpaYUA==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.2.tgz",
"integrity": "sha512-NpCa+UVhhuNeaFVUP1Bftm0uqtvLWq2JTm7+Ta48+2Uqj2mNXrDIvyn1DY/ZEfmW/1yvGBRaUAv9zkMkMRixQA==",
"cpu": [
"x64"
],
@ -1123,9 +1123,9 @@
}
},
"node_modules/@next/swc-linux-x64-musl": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.1.tgz",
"integrity": "sha512-sNDGaWmSqTS4QRUzw61wl4mVPeSqNIr1OOjLlQTRuyInxMxtqImRqdvzDvFTlDfdeUMU/DZhWGYoHrXLlZXe6A==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.2.tgz",
"integrity": "sha512-ZWVC72x0lW4aj44e3khvBrj2oSYj1bD0jESmyah3zG/3DplEy/FOtYkMzbMjHTdDSheso7zH8GIlW6CDQnKhmQ==",
"cpu": [
"x64"
],
@ -1138,9 +1138,9 @@
}
},
"node_modules/@next/swc-win32-arm64-msvc": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.1.tgz",
"integrity": "sha512-+CXZC7u1iXdLRudecoUYbhbsXpglYv8KFYsFxKBPn7kg+bk7eJo738wAA4jXIl8grTF2mPdmO93JOQym+BlYGA==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.2.tgz",
"integrity": "sha512-pLT+OWYpzJig5K4VKhLttlIfBcVZfr2+Xbjra0Tjs83NQSkFS+y7xx+YhCwvpEmXYLIvaggj2ONPyjbiigOvHQ==",
"cpu": [
"arm64"
],
@ -1153,9 +1153,9 @@
}
},
"node_modules/@next/swc-win32-ia32-msvc": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.1.tgz",
"integrity": "sha512-vIoXVVc7UYO68VwVMDKwJC2+HqAZQtCYiVlApyKEeIPIQpz2gpufzGxk1z3/gwrJt/kJ5CDZjlhYDCzd3hdz+g==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.2.tgz",
"integrity": "sha512-dhpiksQCyGca4WY0fJyzK3FxMDFoqMb0Cn+uDB+9GYjpU2K5//UGPQlCwiK4JHxuhg8oLMag5Nf3/IPSJNG8jw==",
"cpu": [
"ia32"
],
@ -1168,9 +1168,9 @@
}
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.1.tgz",
"integrity": "sha512-n8V5ImLQZibKTu10UUdI3nIeTLkliEXe628qxqW9v8My3BAH2a7H0SaCqkV2OgqFnn8sG1wxKYw9/SNJ632kSA==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.2.tgz",
"integrity": "sha512-O7bort1Vld00cu8g0jHZq3cbSTUNMohOEvYqsqE10+yfohhdPHzvzO+ziJRz4Dyyr/fYKREwS7gR4JC0soSOMw==",
"cpu": [
"x64"
],
@ -1232,21 +1232,21 @@
"dev": true
},
"node_modules/@sinonjs/commons": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz",
"integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz",
"integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==",
"dev": true,
"dependencies": {
"type-detect": "4.0.8"
}
},
"node_modules/@sinonjs/fake-timers": {
"version": "10.0.2",
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz",
"integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==",
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.1.0.tgz",
"integrity": "sha512-w1qd368vtrwttm1PRJWPW1QHlbmHrVDGs1eBH/jZvRPUFS4MNXV9Q33EQdjOdeAxZ7O8+3wM7zxztm2nfUSyKw==",
"dev": true,
"dependencies": {
"@sinonjs/commons": "^2.0.0"
"@sinonjs/commons": "^3.0.0"
}
},
"node_modules/@swc/helpers": {
@ -1273,9 +1273,9 @@
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="
},
"node_modules/@tsconfig/node16": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ=="
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA=="
},
"node_modules/@types/babel__core": {
"version": "7.20.0",
@ -1359,9 +1359,9 @@
}
},
"node_modules/@types/express-serve-static-core": {
"version": "4.17.34",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.34.tgz",
"integrity": "sha512-fvr49XlCGoUj2Pp730AItckfjat4WNb0lb3kfrLWffd+RLeoGAMsq7UOy04PAPtoL01uKwcp6u8nhzpgpDYr3w==",
"version": "4.17.35",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.35.tgz",
"integrity": "sha512-wALWQwrgiB2AWTT91CB62b6Yt0sNHpznUXeZEcnPU3DRdlDIz74x8Qg1UUYKSVFi+va5vKOLYRBI1bRKiLLKIg==",
"dev": true,
"dependencies": {
"@types/node": "*",
@ -1438,9 +1438,9 @@
}
},
"node_modules/@types/node": {
"version": "18.16.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.7.tgz",
"integrity": "sha512-MFg7ua/bRtnA1hYE3pVyWxGd/r7aMqjNOdHvlSsXV3n8iaeGKkOaPzpJh6/ovf4bEXWcojkeMJpTsq3mzXW4IQ=="
"version": "18.16.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.9.tgz",
"integrity": "sha512-IeB32oIV4oGArLrd7znD2rkHQ6EDCM+2Sr76dJnrHwv9OHBTTM6nuDLK9bmikXzPa0ZlWMWtRGo/Uw4mrzQedA=="
},
"node_modules/@types/node-schedule": {
"version": "2.1.0",
@ -1965,9 +1965,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001486",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001486.tgz",
"integrity": "sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg==",
"version": "1.0.30001487",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001487.tgz",
"integrity": "sha512-83564Z3yWGqXsh2vaH/mhXfEM0wX+NlBCm1jYHOb97TrTWJEmPTccZgeLTPBUUb0PNVo+oomb7wkimZBIERClA==",
"funding": [
{
"type": "opencollective",
@ -2372,9 +2372,9 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/electron-to-chromium": {
"version": "1.4.391",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.391.tgz",
"integrity": "sha512-GqydVV1+kUWY5qlEzaw34/hyWTApuQrHiGrcGA2Kk/56nEK44i+YUW45VH43JuZT0Oo7uY8aVtpPhBBZXEWtSA==",
"version": "1.4.394",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.394.tgz",
"integrity": "sha512-0IbC2cfr8w5LxTz+nmn2cJTGafsK9iauV2r5A5scfzyovqLrxuLoxOHE5OBobP3oVIggJT+0JfKnw9sm87c8Hw==",
"dev": true
},
"node_modules/emittery": {
@ -2694,12 +2694,13 @@
}
},
"node_modules/get-intrinsic": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
"dependencies": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3"
},
"funding": {
@ -2794,6 +2795,17 @@
"node": ">=8"
}
},
"node_modules/has-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
@ -3620,9 +3632,9 @@
}
},
"node_modules/jest-snapshot/node_modules/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@ -3815,9 +3827,9 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/jsonwebtoken/node_modules/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
"dependencies": {
"lru-cache": "^6.0.0"
},
@ -3862,7 +3874,7 @@
}
},
"node_modules/le-coffre-resources": {
"resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#467b34a484adbd6dfa3fd6082bb7677f6178da51",
"resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#f90ab464e3b0f9dd70601b9c8f8bbf5090b685a7",
"license": "MIT",
"dependencies": {
"class-transformer": "^0.5.1",
@ -4276,11 +4288,11 @@
}
},
"node_modules/next": {
"version": "13.4.1",
"resolved": "https://registry.npmjs.org/next/-/next-13.4.1.tgz",
"integrity": "sha512-JBw2kAIyhKDpjhEWvNVoFeIzNp9xNxg8wrthDOtMctfn3EpqGCmW0FSviNyGgOSOSn6zDaX48pmvbdf6X2W9xA==",
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/next/-/next-13.4.2.tgz",
"integrity": "sha512-aNFqLs3a3nTGvLWlO9SUhCuMUHVPSFQC0+tDNGAsDXqx+WJDFSbvc233gOJ5H19SBc7nw36A9LwQepOJ2u/8Kg==",
"dependencies": {
"@next/env": "13.4.1",
"@next/env": "13.4.2",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
@ -4295,15 +4307,15 @@
"node": ">=16.8.0"
},
"optionalDependencies": {
"@next/swc-darwin-arm64": "13.4.1",
"@next/swc-darwin-x64": "13.4.1",
"@next/swc-linux-arm64-gnu": "13.4.1",
"@next/swc-linux-arm64-musl": "13.4.1",
"@next/swc-linux-x64-gnu": "13.4.1",
"@next/swc-linux-x64-musl": "13.4.1",
"@next/swc-win32-arm64-msvc": "13.4.1",
"@next/swc-win32-ia32-msvc": "13.4.1",
"@next/swc-win32-x64-msvc": "13.4.1"
"@next/swc-darwin-arm64": "13.4.2",
"@next/swc-darwin-x64": "13.4.2",
"@next/swc-linux-arm64-gnu": "13.4.2",
"@next/swc-linux-arm64-musl": "13.4.2",
"@next/swc-linux-x64-gnu": "13.4.2",
"@next/swc-linux-x64-musl": "13.4.2",
"@next/swc-win32-arm64-msvc": "13.4.2",
"@next/swc-win32-ia32-msvc": "13.4.2",
"@next/swc-win32-x64-msvc": "13.4.2"
},
"peerDependencies": {
"@opentelemetry/api": "^1.1.0",
@ -5467,9 +5479,9 @@
}
},
"node_modules/ts-jest/node_modules/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"

View File

@ -32,7 +32,7 @@ export default class CustomersController extends ApiController {
//success
this.httpSuccess(response, customers);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -58,7 +58,7 @@ export default class CustomersController extends ApiController {
//success
this.httpCreated(response, customer);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -99,7 +99,7 @@ export default class CustomersController extends ApiController {
//success
this.httpSuccess(response, customer);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -137,7 +137,7 @@ export default class CustomersController extends ApiController {
//success
this.httpSuccess(response, customer);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -32,7 +32,7 @@ export default class DeedTypesController extends ApiController {
//success
this.httpSuccess(response, DeedTypes);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -61,7 +61,7 @@ export default class DeedTypesController extends ApiController {
//success
this.httpCreated(response, deedType);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -103,7 +103,7 @@ export default class DeedTypesController extends ApiController {
//success
this.httpSuccess(response, deedType);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -142,7 +142,7 @@ export default class DeedTypesController extends ApiController {
//success
this.httpSuccess(response, deedType);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -32,7 +32,7 @@ export default class DeedsController extends ApiController {
//success
this.httpSuccess(response, deeds);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -71,7 +71,7 @@ export default class DeedsController extends ApiController {
//success
this.httpSuccess(response, deed);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -112,7 +112,7 @@ export default class DeedsController extends ApiController {
//success
this.httpSuccess(response, deed);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -35,7 +35,7 @@ export default class DocumentTypesController extends ApiController {
//success
this.httpSuccess(response, documentTypes);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -59,7 +59,7 @@ export default class DocumentTypesController extends ApiController {
//success
this.httpCreated(response, userEntityCreated);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -99,7 +99,7 @@ export default class DocumentTypesController extends ApiController {
//success
this.httpSuccess(response, documentType);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -137,7 +137,7 @@ export default class DocumentTypesController extends ApiController {
//success
this.httpSuccess(response, user);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -33,7 +33,7 @@ export default class DocumentsController extends ApiController {
//success
this.httpSuccess(response, documents);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -62,7 +62,7 @@ export default class DocumentsController extends ApiController {
//success
this.httpCreated(response, document);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -101,7 +101,7 @@ export default class DocumentsController extends ApiController {
//success
this.httpSuccess(response, document);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -134,7 +134,7 @@ export default class DocumentsController extends ApiController {
//success
this.httpSuccess(response, document);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -172,7 +172,7 @@ export default class DocumentsController extends ApiController {
//success
this.httpSuccess(response, document);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -62,7 +62,7 @@ export default class FilesController extends ApiController {
this.httpSuccess(response, fileInfo.buffer);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -180,7 +180,7 @@ export default class FilesController extends ApiController {
//success
this.httpSuccess(response, file);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -210,7 +210,7 @@ export default class FilesController extends ApiController {
//success
this.httpSuccess(response, file);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -22,8 +22,10 @@ export default class OfficeFoldersController extends ApiController {
try {
//get query
const query = JSON.parse(req.query["q"] as string);
//call service to get prisma entity
const officeFolderEntities: OfficeFolders[] = await this.officeFoldersService.get(query);
//Hydrate ressource with prisma entity
const officeFolders = OfficeFolder.hydrateArray<OfficeFolder>(OfficeFolder, officeFolderEntities, {
strategy: "excludeAll",
@ -31,7 +33,7 @@ export default class OfficeFoldersController extends ApiController {
//success
this.httpSuccess(response, officeFolders);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -56,7 +58,7 @@ export default class OfficeFoldersController extends ApiController {
//success
this.httpCreated(response, officeFolders);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -97,7 +99,7 @@ export default class OfficeFoldersController extends ApiController {
//success
this.httpSuccess(response, officeFolders);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -136,7 +138,7 @@ export default class OfficeFoldersController extends ApiController {
//success
this.httpSuccess(response, officeFolder);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
this.httpSuccess(response, await this.officeFoldersService.getByUid("uid"));
@ -170,7 +172,7 @@ export default class OfficeFoldersController extends ApiController {
//success
this.httpSuccess(response, officeFolder);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -28,7 +28,7 @@ export default class OfficesController extends ApiController {
//success
this.httpSuccess(response, offices);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -51,7 +51,7 @@ export default class OfficesController extends ApiController {
//success
this.httpCreated(response, office);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -86,7 +86,7 @@ export default class OfficesController extends ApiController {
//success
this.httpSuccess(response, office);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -121,7 +121,7 @@ export default class OfficesController extends ApiController {
//success
this.httpSuccess(response, office);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -32,7 +32,7 @@ export default class UsersController extends ApiController {
//success
this.httpSuccess(response, users);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -60,7 +60,7 @@ export default class UsersController extends ApiController {
//success
this.httpCreated(response, user);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -101,7 +101,7 @@ export default class UsersController extends ApiController {
//success
this.httpSuccess(response, user);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}
@ -138,7 +138,7 @@ export default class UsersController extends ApiController {
//success
this.httpSuccess(response, user);
} catch (error) {
this.httpInternalError(response);
this.httpInternalError(response, error);
return;
}
}

View File

@ -12,7 +12,6 @@ import {
EDocumentStatus,
EFolderStatus,
EOfficeStatus,
Files,
OfficeFolderHasCustomers,
OfficeFolders,
Offices,
@ -78,9 +77,6 @@ import {
const uidOfficeFolderHasCustomer1: string = randomString();
const uidOfficeFolderHasCustomer2: string = randomString();
const uidFiles1: string = randomString();
const uidFiles2: string = randomString();
const uidDeedHasDocumentType1: string = randomString();
const uidDeedHasDocumentType2: string = randomString();
@ -466,29 +462,6 @@ import {
},
];
const files: Files[] = [
{
uid: uidFiles1,
document_uid: uidDocument1,
file_name: "fileName1",
file_path: "https://www.google1.com",
key: '',
archived_at: null,
created_at: new Date(),
updated_at: new Date(),
},
{
uid: uidFiles2,
document_uid: uidDocument1,
file_name: "fileName2",
file_path: "https://www.google2.com",
key: '',
archived_at: null,
created_at: new Date(),
updated_at: new Date(),
},
];
const deedHasDocumentTypes: DeedHasDocumentTypes[] = [
{
uid: uidDeedHasDocumentType1,
@ -581,10 +554,6 @@ import {
await prisma.documents.create({ data: document });
}
for (const file of files) {
await prisma.files.create({ data: file });
}
for (const documentHistory of documentHistories) {
await prisma.documentHistory.create({ data: documentHistory });
}

View File

@ -6,12 +6,8 @@ import CryptoService from "../CryptoService/CryptoService";
import IpfsService from "../IpfsService/IpfsService";
import { BackendVariables } from "@Common/config/variables/Variables";
import { Readable } from "stream";
<<<<<<< HEAD
import { v4 } from "uuid";
import { Files } from "@prisma/client";
=======
import uuid from "uuid";
>>>>>>> 14db92d (add mimetype and size of files)
import { Files } from "@prisma/client";
@Service()
export default class FilesService extends BaseService {
@ -57,15 +53,8 @@ export default class FilesService extends BaseService {
* @description : Create a new file
* @throws {Error} If file cannot be created
*/
<<<<<<< HEAD
public async create(file: File, fileData: Express.Multer.File): Promise<Files> {
const key = v4();
fileData.mimetype;
fileData.size;
=======
public async create(file: File, fileData: Express.Multer.File) {
const key = uuid.v4();
>>>>>>> 14db92d (add mimetype and size of files)
const encryptedFile = await this.cryptoService.encrypt(fileData.buffer, key);
const upload = await this.ipfsService.pinFile(Readable.from(encryptedFile), fileData.originalname);
const fileToCreate: File = file;

View File

@ -21,7 +21,7 @@ export default class OfficeFoldersService extends BaseService {
* @description : Get all folders
* @throws {Error} If folders cannot be get
*/
public async get(query: any): Promise<OfficeFolders[]> {
public async get(query: any): Promise<OfficeFolders[]> {
return this.officeFoldersRepository.findMany(query);
}