@amplication/plugin-db-mongo
Advanced tools
Comparing version 1.4.9-beta.0 to 1.4.9-beta.1
{ | ||
"name": "@amplication/plugin-db-mongo", | ||
"version": "1.4.9-beta.0", | ||
"version": "1.4.9-beta.1", | ||
"description": "Use a Mongo database in a service generated by Amplication", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -60,3 +60,3 @@ import { | ||
beforeCreateServer(context: DsgContext, eventParams: CreateServerParams) { | ||
private static autoIncrementDataTypeValidation(context: DsgContext): void { | ||
const generateErrorMessage = | ||
@@ -81,3 +81,25 @@ () => `The ID type: "Auto increment" is not supported by MongoDB Prisma provider. | ||
} | ||
} | ||
private static decimalDataTypeValidation(context: DsgContext): void { | ||
const generateErrorMessage = | ||
() => `The 'Decimal' field type is currently not supported with MongoDB. | ||
Please use an alternative field type.`; | ||
const allDecimalFields = context.entities?.filter((entity) => | ||
entity.fields.find( | ||
(field) => field.dataType === EnumDataType.DecimalNumber | ||
) | ||
); | ||
if (allDecimalFields !== undefined && allDecimalFields.length > 0) { | ||
context.logger.error(generateErrorMessage()); | ||
throw new Error(generateErrorMessage()); | ||
} | ||
} | ||
beforeCreateServer(context: DsgContext, eventParams: CreateServerParams) { | ||
MongoPlugin.autoIncrementDataTypeValidation(context); | ||
MongoPlugin.decimalDataTypeValidation(context); | ||
return eventParams; | ||
@@ -84,0 +106,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
203816
2391