-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Hapi from '@hapi/hapi'; | ||
import { Prisma } from '@prisma/client'; | ||
|
||
import { prisma } from '#common/db'; | ||
import Joi from 'joi'; | ||
|
||
export const updateProductRoute: Hapi.ServerRoute = { | ||
method: 'POST', | ||
path: '/productions/{id}', | ||
options: { | ||
description: 'Update product by its ID', | ||
notes: 'Just an example demonstrating how to set up an API.', | ||
tags: ['api', 'Product'], | ||
plugins: { | ||
'hapi-swagger': {}, | ||
}, | ||
validate: { | ||
params: Joi.object({ | ||
id: Joi.number().integer().min(1).description('ID of production'), | ||
}), | ||
payload: Joi.object({ | ||
name: Joi.string().allow(''), | ||
category: Joi.string().allow(''), | ||
description: Joi.string().allow(''), | ||
avatar_img: Joi.string().allow(''), | ||
banner_img: Joi.string().allow(''), | ||
metadata: Joi.object().allow(null), | ||
}), | ||
}, | ||
}, | ||
/** | ||
* Handles the update product request. | ||
* | ||
* @param {Hapi.Request} request - The incoming request object. | ||
* @return {Promise} The updated product data. | ||
*/ | ||
handler: async (request: Hapi.Request): Promise<any> => { | ||
const { id } = request.params; | ||
const { payload } = request as { payload: Prisma.ProductUpdateInput }; | ||
const where = { id: parseInt(id) }; | ||
const updated = await prisma.product.update({ data: payload, where }); | ||
return updated; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,5 +34,3 @@ const worker = new Worker( | |
worker.on('error', (err) => { | ||
console.error(err); | ||
}); | ||
|
||
addToQueue(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,6 +250,27 @@ | |
dependencies: | ||
"@jridgewell/trace-mapping" "0.3.9" | ||
|
||
"@elastic/elasticsearch@^8.14.0": | ||
version "8.14.0" | ||
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-8.14.0.tgz#93b1f2a7cb6cc5cd1ceebf5060576bc690432e0a" | ||
integrity sha512-MGrgCI4y+Ozssf5Q2IkVJlqt5bUMnKIICG2qxeOfrJNrVugMCBCAQypyesmSSocAtNm8IX3LxfJ3jQlFHmKe2w== | ||
dependencies: | ||
"@elastic/transport" "^8.6.0" | ||
tslib "^2.4.0" | ||
|
||
"@elastic/transport@^8.6.0": | ||
version "8.7.0" | ||
resolved "https://registry.yarnpkg.com/@elastic/transport/-/transport-8.7.0.tgz#006987fc5583f61c266e0b1003371e82efc7a6b5" | ||
integrity sha512-IqXT7a8DZPJtqP2qmX1I2QKmxYyN27kvSW4g6pInESE1SuGwZDp2FxHJ6W2kwmYOJwQdAt+2aWwzXO5jHo9l4A== | ||
dependencies: | ||
"@opentelemetry/api" "1.x" | ||
debug "^4.3.4" | ||
hpagent "^1.0.0" | ||
ms "^2.1.3" | ||
secure-json-parse "^2.4.0" | ||
tslib "^2.4.0" | ||
undici "^6.12.0" | ||
|
||
"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": | ||
version "4.4.0" | ||
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" | ||
|
@@ -834,6 +855,11 @@ | |
"@nodelib/fs.scandir" "2.1.5" | ||
fastq "^1.6.0" | ||
|
||
"@opentelemetry/[email protected]": | ||
version "1.9.0" | ||
resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.9.0.tgz#d03eba68273dc0f7509e2a3d5cba21eae10379fe" | ||
integrity sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg== | ||
|
||
"@prisma/client@^5.17.0": | ||
version "5.17.0" | ||
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.17.0.tgz#9079947bd749689c2dabfb9ecc70a24ebefb1f43" | ||
|
@@ -1997,6 +2023,11 @@ help-me@^5.0.0: | |
resolved "https://registry.yarnpkg.com/help-me/-/help-me-5.0.0.tgz#b1ebe63b967b74060027c2ac61f9be12d354a6f6" | ||
integrity sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg== | ||
|
||
hpagent@^1.0.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/hpagent/-/hpagent-1.2.0.tgz#0ae417895430eb3770c03443456b8d90ca464903" | ||
integrity sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA== | ||
|
||
http-status@^1.7.3: | ||
version "1.7.4" | ||
resolved "https://registry.yarnpkg.com/http-status/-/http-status-1.7.4.tgz#7bb7f6b511e0bf5e9e20fb5aa00666f09d1f2615" | ||
|
@@ -2428,6 +2459,11 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" | ||
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== | ||
|
||
ms@^2.1.3: | ||
version "2.1.3" | ||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" | ||
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== | ||
|
||
msgpackr-extract@^3.0.2: | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/msgpackr-extract/-/msgpackr-extract-3.0.3.tgz#e9d87023de39ce714872f9e9504e3c1996d61012" | ||
|
@@ -3151,7 +3187,7 @@ tsconfig-paths@^4.2.0: | |
minimist "^1.2.6" | ||
strip-bom "^3.0.0" | ||
|
||
tslib@^2.0.0: | ||
tslib@^2.0.0, tslib@^2.4.0: | ||
version "2.6.3" | ||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" | ||
integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== | ||
|
@@ -3207,6 +3243,11 @@ undici-types@~5.26.4: | |
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" | ||
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== | ||
|
||
undici@^6.12.0: | ||
version "6.19.5" | ||
resolved "https://registry.yarnpkg.com/undici/-/undici-6.19.5.tgz#5829101361b583b53206e81579f4df71c56d6be8" | ||
integrity sha512-LryC15SWzqQsREHIOUybavaIHF5IoL0dJ9aWWxL/PgT1KfqAW5225FZpDUFlt9xiDMS2/S7DOKhFWA7RLksWdg== | ||
|
||
update-browserslist-db@^1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" | ||
|