@spinajs/orm-http
Advanced tools
Comparing version 1.2.199 to 1.2.201
@@ -221,7 +221,3 @@ "use strict"; | ||
if (incoming.data.attributes) { | ||
const columns = Object.keys(incoming.data.attributes).filter((x) => model.Descriptor.Columns.find((c) => c.Name === x)); | ||
// create query, so we can pass to middleware | ||
const query = model.UpdateQueryBuilder.update(lodash_1.default.pick(incoming.data.attributes, columns)).where(entity.PrimaryKeyName, entity.PrimaryKeyValue); | ||
this.Middlewares.forEach((m) => m.onUpdateMiddlewareQuery(entity.PrimaryKeyValue, query, model.Type, req)); | ||
await query; | ||
await entity.hydrate(incoming.data.attributes); | ||
} | ||
@@ -239,15 +235,3 @@ await this.updateRelations(incoming, model, entity); | ||
entity.hydrate(incoming.data.attributes); | ||
let pKey = null; | ||
const iMidleware = { | ||
afterQuery: (data) => { | ||
pKey = data.LastInsertId; | ||
return data; | ||
}, | ||
modelCreation: () => null, | ||
afterHydration: () => null, | ||
}; | ||
const query = model.InserQuery.middleware(iMidleware).values(entity.dehydrate()); | ||
this.Middlewares.forEach((m) => m.onInsertMiddlewareQuery(query, model.Type, req)); | ||
await query; | ||
entity.PrimaryKeyValue = pKey; | ||
await entity.insert(); | ||
await this.updateRelations(incoming, model, entity); | ||
@@ -254,0 +238,0 @@ let jResult = modelToJsonApi(entity); |
{ | ||
"name": "@spinajs/orm-http", | ||
"version": "1.2.199", | ||
"version": "1.2.201", | ||
"description": "Orm extensions for HTTP module", | ||
@@ -57,3 +57,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "8866c45ad5b51b5c430fd69bb85ba0956b61b9b1" | ||
"gitHead": "e5e624508d73fb8c63eabb9d150c64e5fba2a17f" | ||
} |
Sorry, the diff of this file is not supported yet
62661
896