Replaces MongoDB support with PostgreSQL (#151)

- All schemas have been rewritten to a relational model
- All services have been rewritten to accommodate the new data model
- Adds idempotency keys to core endpoints allowing you to retry requests with no additional side effects
- Adds staged jobs to avoid putting jobs in the queue when transactions abort
- Adds atomic transactions to all methods with access to the data layer

Co-authored-by: Oliver Windall Juhl <oliver@mrbltech.com>
This commit is contained in:
Sebastian RindomandOliver Windall Juhl committed 2021-01-26 10:26:14 +01:00
1 parent 5f819486fc
commit f1baca3cbd
499 files changed
+25909 -16128

No files matched your search

+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-add-ons",
"version": "1.0.8",
"version": "1.0.7-alpha.176+0646bd3",
"description": "Add-on plugin for Medusa Commerce",
"main": "index.js",
"repository": {
@@ -25,7 +25,7 @@
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"jest": "^25.5.2",
"medusa-test-utils": "^1.0.13"
"medusa-test-utils": "^1.0.12-alpha.176+0646bd3"
},
"scripts": {
"build": "babel src -d . --ignore **/__tests__",
@@ -37,8 +37,8 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"medusa-core-utils": "^1.0.11",
"medusa-core-utils": "^1.0.12-alpha.787+0646bd3",
"redis": "^3.0.2"
},
"gitHead": "3bd91f65304ed1d31c41b85d5c87123450e0542e"
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
}
@@ -39,16 +39,7 @@ class AddOnService extends BaseService {
* @return {string} the validated id
*/
validateId_(rawId) {
const schema = Validator.objectId()
const { value, error } = schema.validate(rawId.toString())
if (error) {
throw new MedusaError(
MedusaError.Types.INVALID_ARGUMENT,
"The addOnId could not be casted to an ObjectId"
)
}
return value
return rawId
}
/**
@@ -187,7 +178,7 @@ class AddOnService extends BaseService {
})
// Return the price if we found a suitable match
if (price) {
if (price !== undefined) {
return price
}