diff --git a/package-lock.json b/package-lock.json index 2b894f0..929dd1a 100755 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "config": "^3.3.12", "dotenv": "^16.4.5", "express": "^4.19.2", + "http-status-codes": "^2.3.0", "pg": "^8.16.3", "reflect-metadata": "^0.2.2", "swagger-jsdoc": "^6.2.8", @@ -834,7 +835,6 @@ "version": "3.3.12", "resolved": "https://registry.npmjs.org/config/-/config-3.3.12.tgz", "integrity": "sha512-Vmx389R/QVM3foxqBzXO8t2tUikYZP64Q6vQxGrsMpREeJc/aWRnPRERXWsYzOHAumx/AOoILWe6nU3ZJL+6Sw==", - "license": "MIT", "dependencies": { "json5": "^2.2.3" }, @@ -1467,8 +1467,7 @@ "node_modules/http-status-codes": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-2.3.0.tgz", - "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==", - "license": "MIT" + "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==" }, "node_modules/iconv-lite": { "version": "0.4.24", diff --git a/package.json b/package.json index 5a13795..2e79112 100755 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "config": "^3.3.12", "dotenv": "^16.4.5", "express": "^4.19.2", + "http-status-codes": "^2.3.0", "pg": "^8.16.3", "reflect-metadata": "^0.2.2", "swagger-jsdoc": "^6.2.8", @@ -34,4 +35,4 @@ "ts-node-dev": "^2.0.0", "typescript": "^5.4.5" } -} \ No newline at end of file +} diff --git a/src/constants/httpStatus.ts b/src/constants/httpStatus.ts index 7100634..048dc2f 100755 --- a/src/constants/httpStatus.ts +++ b/src/constants/httpStatus.ts @@ -1,16 +1,14 @@ -export const HTTP_STATUS = { - OK: 200, - CREATED: 201, - NO_CONTENT: 204, - - BAD_REQUEST: 400, - UNAUTHORIZED: 401, - FORBIDDEN: 403, - NOT_FOUND: 404, - CONFLICT: 409, - - INTERNAL_SERVER_ERROR: 500, - SERVICE_UNAVAILABLE: 503, -} as const; +export { + OK, + CREATED, + NO_CONTENT, + BAD_REQUEST, + UNAUTHORIZED, + FORBIDDEN, + NOT_FOUND, + CONFLICT, + INTERNAL_SERVER_ERROR, + SERVICE_UNAVAILABLE, + type StatusCodes as HttpStatusCode +} from 'http-status-codes'; -export type HttpStatusCode = typeof HTTP_STATUS[keyof typeof HTTP_STATUS]; \ No newline at end of file