Skip to content

Commit

Permalink
Merge pull request #286 from staq001/feat-get-specific-product
Browse files Browse the repository at this point in the history
feat: allow user get a specific product
  • Loading branch information
incredible-phoenix246 authored Jul 24, 2024
2 parents 971be25 + fbcc5d0 commit 5106890
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 20 deletions.
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.12",
"@types/multer": "^1",
"@types/node": "^16.18.103",
"@types/node": "^20.14.12",
"@types/passport": "^1.0.16",
"@types/supertest": "^6.0.2",
"@types/swagger-jsdoc": "^6.0.4",
"@types/swagger-ui-express": "^4.1.6",
"jest": "^29.7.0",
"supertest": "^7.0.0",
"ts-jest": "^29.2.3",
"husky": "^9.1.1",
"jest": "^29.7.0",
"lint-staged": "^15.2.7",
"prettier": "^3.3.3",
"supertest": "^7.0.0",
"ts-jest": "^29.2.3",
"ts-node": "^10.9.2",
"typescript": "^5.5.3"
},
Expand All @@ -57,6 +57,7 @@
"@types/cors": "^2.8.17",
"@types/jsonwebtoken": "^9.0.6",
"@types/nodemailer": "^6.4.15",
"@types/uuid-validate": "^0.0.3",
"bcryptjs": "^2.4.3",
"bull": "^4.15.1",
"class-validator": "^0.14.1",
Expand All @@ -70,16 +71,16 @@
"express-validator": "^7.1.0",
"fs-extra": "^11.2.0",
"handlebars": "^4.7.8",
"jest-mock-extended": "^3.0.7",
"jest": "^29.7.0",
"jest-mock-extended": "^3.0.7",
"json2csv": "^6.0.0-alpha.2",
"jsonwebtoken": "^9.0.2",
"multer": "^1.4.5-lts.1",
"multer-storage-cloudinary": "^4.0.0",
"node-mailer": "^0.1.1",
"pdfkit": "^0.15.0",
"passport": "^0.7.0",
"passport-google-oauth2": "^0.2.0",
"pdfkit": "^0.15.0",
"pg": "^8.12.0",
"pino": "^9.3.1",
"pino-pretty": "^11.2.1",
Expand All @@ -90,6 +91,7 @@
"twilio": "^5.2.2",
"typeorm": "^0.3.20",
"uuid": "^10.0.0",
"uuid-validate": "^0.0.3",
"zod": "^3.23.8"
},
"lint-staged": {
Expand Down
6 changes: 6 additions & 0 deletions src/routes/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ productRouter.get(
"/",
authMiddleware,
productController.getProductPagination.bind(productController),

productRouter.get(
"/:product_id",
authMiddleware,
productController.fetchProductById,
),
);

export { productRouter };
6 changes: 1 addition & 5 deletions src/services/product.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ export class ProductService {
}
}
async getOneProduct(id: string): Promise<Product> {

const product = await this.productRepository.findOneBy({id});
const product = await this.productRepository.findOneBy({ id });

return product;


}

}
48 changes: 39 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1068,18 +1068,13 @@
dependencies:
"@types/express" "*"

"@types/node@*":
"@types/node@*", "@types/node@^20.14.12":
version "20.14.12"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.12.tgz#129d7c3a822cb49fc7ff661235f19cfefd422b49"
integrity sha512-r7wNXakLeSsGT0H1AU863vS2wa5wBOK4bWMjZz2wj+8nBx+m5PeIn0k8AloSLpRuiwdRQZwarZqHE4FNArPuJQ==
dependencies:
undici-types "~5.26.4"

"@types/node@^16.18.103":
version "16.18.104"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.104.tgz#33d5f4886c54133af0ff02445e57c5254025ee53"
integrity sha512-OF3keVCbfPlkzxnnDBUZJn1RiCJzKeadjiW0xTEb0G1SUJ5gDVb3qnzZr2T4uIFvsbKJbXy1v2DN7e2zaEY7jQ==

"@types/nodemailer@^6.4.15":
version "6.4.15"
resolved "https://registry.yarnpkg.com/@types/nodemailer/-/nodemailer-6.4.15.tgz#494be695e11c438f7f5df738fb4ab740312a6ed2"
Expand Down Expand Up @@ -1166,6 +1161,11 @@
"@types/express" "*"
"@types/serve-static" "*"

"@types/uuid-validate@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@types/uuid-validate/-/uuid-validate-0.0.3.tgz#33f95a33ea776606862cc6eea3a8d49ccb90cba6"
integrity sha512-htkuv1+RZjjHkSrXets3a6kqDeqgYutBtdER3U6I1mWV58AIsDFWoUuN0cB6DMOWiqTHK0XqH3pXeqIVfJIrog==

"@types/validator@^13.11.8":
version "13.12.0"
resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.12.0.tgz#1fe4c3ae9de5cf5193ce64717c99ef2fa7d8756f"
Expand Down Expand Up @@ -4980,7 +4980,16 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -5021,7 +5030,14 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -5413,6 +5429,11 @@ [email protected], [email protected], utils-merge@^1.0.1:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==

uuid-validate@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/uuid-validate/-/uuid-validate-0.0.3.tgz#e30617f75dc742a0e4f95012a11540faf9d39ab4"
integrity sha512-Fykw5U4eZESbq739BeLvEBFRuJODfrlmjx5eJux7W817LjRaq4b7/i4t2zxQmhcX+fAj4nMfRdTzO4tmwLKn0w==

uuid@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-10.0.0.tgz#5a95aa454e6e002725c79055fd42aaba30ca6294"
Expand Down Expand Up @@ -5503,7 +5524,16 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down

0 comments on commit 5106890

Please sign in to comment.