ucd-library / fin

FIN (Fedora IN docker) Base Services
MIT License
0 stars 0 forks source link

this.writeIndexAlias should be read-only? #66

Open qjhart opened 1 year ago

qjhart commented 1 year ago

Previous versions of dams, had indexAlias in their constructor,

this.writeIndexAlias = 'foo'

This messes up code, and shouldn't be allowed. Specifically, the cupdate function eg. uses this.writeIndexAlias while the setAlias function fixes up names that that don't match.

Easiest fix is to disallow renaming? This is one potential fix in FinEsDataModel

    Object.defineProperty(this, "readIndexAlias", {
      value: modelName+'-read',
      writable: false, // This makes the property read-only
      enumerable: true,
      configurable: false // This prevents reconfiguration of the property
    });

    Object.defineProperty(this, "writeIndexAlias", {
      value: modelName+'-write',
      writable: false, // This makes the property read-only
      enumerable: true,
      configurable: false // This prevents reconfiguration of the property
    });