@ruiapp/rapid-core 0.2.10 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3559,13 +3559,16 @@ async function willEntityDuplicate(server, dataAccessor, options) {
3559
3559
  routeContext,
3560
3560
  });
3561
3561
  if (entityId) {
3562
- return entityInDb && entityInDb.Id !== entityId;
3562
+ return entityInDb && entityInDb.id !== entityId;
3563
3563
  }
3564
3564
  else {
3565
3565
  return !!entityInDb;
3566
3566
  }
3567
3567
  }
3568
3568
  function getEntityDuplicatedErrorMessage(server, model, indexConfig) {
3569
+ if (indexConfig.duplicateErrorMessage) {
3570
+ return indexConfig.duplicateErrorMessage;
3571
+ }
3569
3572
  const propertyNames = indexConfig.properties.map((propConfig) => {
3570
3573
  let propCode;
3571
3574
  if (lodash.isString(propConfig)) {
package/dist/types.d.ts CHANGED
@@ -349,6 +349,10 @@ export interface RpdDataModelIndex {
349
349
  unique?: boolean;
350
350
  properties: RpdDataModelIndexPropertyConfig[];
351
351
  conditions?: RpdDataModelIndexOptions[];
352
+ /**
353
+ * 重复时的错误信息。
354
+ */
355
+ duplicateErrorMessage?: string;
352
356
  }
353
357
  export type RpdDataModelIndexPropertyConfig = string | {
354
358
  code: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruiapp/rapid-core",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1466,13 +1466,17 @@ async function willEntityDuplicate(server: IRpdServer, dataAccessor: IRpdDataAcc
1466
1466
  });
1467
1467
 
1468
1468
  if (entityId) {
1469
- return entityInDb && entityInDb.Id !== entityId;
1469
+ return entityInDb && entityInDb.id !== entityId;
1470
1470
  } else {
1471
1471
  return !!entityInDb;
1472
1472
  }
1473
1473
  }
1474
1474
 
1475
1475
  function getEntityDuplicatedErrorMessage(server: IRpdServer, model: RpdDataModel, indexConfig: RpdDataModelIndex) {
1476
+ if (indexConfig.duplicateErrorMessage) {
1477
+ return indexConfig.duplicateErrorMessage;
1478
+ }
1479
+
1476
1480
  const propertyNames = indexConfig.properties.map((propConfig) => {
1477
1481
  let propCode: string;
1478
1482
  if (isString(propConfig)) {
package/src/types.ts CHANGED
@@ -415,6 +415,11 @@ export interface RpdDataModelIndex {
415
415
  unique?: boolean;
416
416
  properties: RpdDataModelIndexPropertyConfig[];
417
417
  conditions?: RpdDataModelIndexOptions[];
418
+
419
+ /**
420
+ * 重复时的错误信息。
421
+ */
422
+ duplicateErrorMessage?: string;
418
423
  }
419
424
 
420
425
  export type RpdDataModelIndexPropertyConfig =