sails-dynamodb icon indicating copy to clipboard operation
sails-dynamodb copied to clipboard

BOOL schema type and upgrade vogels

Open trung-huynh opened this issue 8 years ago • 2 comments

Hi there,

There is an error in current vogels version (~0.12.0) with BOOL schema type which is using 'N' dynamoDB attribute value instead of 'BOOL' attribute value, I guess probably because at the point of developing that vogels version, dynamoDB wasn't support BOOL type yet, the code I investigated in vogels 0.12.0:

Schema.prototype.Boolean = function (attrName, options) {
  var attributeType = 'N';
  return internals.baseSetup(this, attrName, Joi.boolean(), attributeType, options);
};

The latest vogels version (2.2.0) as well as dynamoDB has supported BOOL and it leads to data inconsistency if sails-dynamodb still uses the old version of vogel, here is the code snippet from latest vogels:

internals.wireType = function (key) {
  switch (key) {
    case 'string':
      return 'S';
    case 'date':
      return 'DATE';
    case 'number':
      return 'N';
    case 'boolean':
      return 'BOOL';
    case 'binary':
      return 'B';
    case 'array':
      return 'L';
    default:
      return null;
  }
};

Do you have any plan to update to the latest version?

Many thanks, Trung.

trung-huynh avatar Sep 24 '17 07:09 trung-huynh

I have no plans to update this, but I'm happy to look at a PR.

ferrants avatar Sep 25 '17 16:09 ferrants

throw new Error("Wrong filter given :" + filter); filter is out of scope and throws undefined

elipeters avatar Apr 24 '18 23:04 elipeters