@live-change/user-service
Advanced tools
Comparing version 0.8.15 to 0.8.16
{ | ||
"name": "@live-change/user-service", | ||
"version": "0.8.15", | ||
"version": "0.8.16", | ||
"description": "", | ||
@@ -25,7 +25,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"@live-change/framework": "^0.8.15", | ||
"@live-change/relations-plugin": "^0.8.15", | ||
"@live-change/framework": "^0.8.16", | ||
"@live-change/relations-plugin": "^0.8.16", | ||
"pluralize": "^8.0.0" | ||
}, | ||
"gitHead": "4897eefbf3ce9ace57630127da89503c71114563" | ||
"gitHead": "b8ac84cbe1a8c435c7b5003dfc64ddc41a4e15a6" | ||
} |
@@ -142,3 +142,3 @@ import definition from './definition.js' | ||
const path = modelRuntime().indexObjectPath('bySessionOrUser', owner, range ) | ||
//console.log("DAO PATH", path, "range", range, 'params', params) | ||
//console.log("DAO PATH", path, "range", range, 'params', params, 'result', await app.dao.get(path)) | ||
return path | ||
@@ -175,3 +175,3 @@ } | ||
const owner = client.user ? ['user_User', client.user] : ['session_Session', client.session] | ||
return modelRuntime().sortedIndexRangePath('bySsessionOrUser' + sortFieldUc, owner, App.extractRange(range)) | ||
return modelRuntime().sortedIndexRangePath('bySessionOrUser' + sortFieldUc, owner, App.extractRange(range)) | ||
} | ||
@@ -237,7 +237,7 @@ }) | ||
if(!entity) throw 'not_found' | ||
if(entity.sessionOrUserType == 'user_User') { | ||
if(entity.sessionOrUser != client.user) throw 'not_authorized' | ||
if(entity.sessionOrUserType === 'user_User') { | ||
if(entity.sessionOrUser !== client.user) throw 'not_authorized' | ||
} | ||
if(entity.sessionOrUserType == 'session_Session') { | ||
if(entity.sessionOrUser != client.session) throw 'not_authorized' | ||
if(entity.sessionOrUserType === 'session_Session') { | ||
if(entity.sessionOrUser !== client.session) throw 'not_authorized' | ||
} | ||
@@ -250,3 +250,5 @@ let updateObject = {} | ||
} | ||
const merged = App.utils.mergeDeep({}, entity, updateObject) | ||
const merged = App.utils.mergeDeep({ [modelPropertyName]: properties[modelPropertyName] }, | ||
entity, updateObject) | ||
await App.validation.validate(merged, validators, { source: action, action, service, app, client }) | ||
@@ -288,7 +290,7 @@ const identifiers = client.user ? { | ||
if(!entity) throw 'not_found' | ||
if(entity.sessionOrUserType == 'user_User') { | ||
if(entity.sessionOrUser != client.user) throw 'not_authorized' | ||
if(entity.sessionOrUserType === 'user_User') { | ||
if(entity.sessionOrUser !== client.user) throw 'not_authorized' | ||
} | ||
if(entity.sessionOrUserType == 'session_Session') { | ||
if(entity.sessionOrUser != client.session) throw 'not_authorized' | ||
if(entity.sessionOrUserType === 'session_Session') { | ||
if(entity.sessionOrUser !== client.session) throw 'not_authorized' | ||
} | ||
@@ -295,0 +297,0 @@ const identifiers = client.user ? { |
75257
1872