Skip to content

Commit 6e9c3b5

Browse files
committed
close dynamodb-toolbox#66 by adding entity type alias mapping to attributes
1 parent 4cebc95 commit 6e9c3b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

classes/Entity.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ class Entity {
5353
// Set the Entity's table
5454
this._table = table
5555

56-
// If an entity tracking field is enabled, add the attribute and the default
56+
// If an entity tracking field is enabled, add the attributes, alias and the default
5757
if (table.Table.entityField) {
58-
this.schema.attributes[table.Table.entityField] = {
59-
type: 'string', alias: 'entity', default: this.name
60-
}
58+
this.schema.attributes[table.Table.entityField] = { type: 'string', alias: this._etAlias, default: this.name }
6159
this.defaults[table.Table.entityField] = this.name
60+
this.schema.attributes[this._etAlias] = { type: 'string', map: table.Table.entityField, default: this.name }
61+
this.defaults[this._etAlias] = this.name
6262
} // end if entity tracking
6363

6464
// Throw an error if not a valid Table

0 commit comments

Comments
 (0)