Improved asset data for user.
This commit is contained in:
parent
b03bfe7327
commit
cd34b66de1
3 changed files with 22 additions and 12 deletions
|
@ -46,5 +46,8 @@ class App.User extends App.Model
|
|||
# set image url
|
||||
data.image = @apiPath + '/users/image/' + data.image
|
||||
|
||||
if data.organization_id
|
||||
data.organization = App.Organization.find(data.organization_id)
|
||||
|
||||
data
|
||||
|
||||
|
|
|
@ -33,17 +33,17 @@ returns
|
|||
if !data[ User.to_app_model ]
|
||||
data[ User.to_app_model ] = {}
|
||||
end
|
||||
if !data[ User.to_app_model ][ self['owner_id'] ]
|
||||
data[ User.to_app_model ][ self['owner_id'] ] = User.user_data_full( self['owner_id'] )
|
||||
if !data[ User.to_app_model ][ self.owner_id ]
|
||||
data[ User.to_app_model ][ self.owner_id ] = User.user_data_full( self.owner_id )
|
||||
end
|
||||
if !data[ User.to_app_model ][ self['customer_id'] ]
|
||||
data[ User.to_app_model ][ self['customer_id'] ] = User.user_data_full( self['customer_id'] )
|
||||
if !data[ User.to_app_model ][ self.customer_id ]
|
||||
data[ User.to_app_model ][ self.customer_id ] = User.user_data_full( self.customer_id )
|
||||
end
|
||||
if !data[ User.to_app_model ][ self['created_by_id'] ]
|
||||
data[ User.to_app_model ][ self['created_by_id'] ] = User.user_data_full( self['created_by_id'] )
|
||||
if !data[ User.to_app_model ][ self.created_by_id ]
|
||||
data[ User.to_app_model ][ self.created_by_id ] = User.user_data_full( self.created_by_id )
|
||||
end
|
||||
if !data[ User.to_app_model ][ self['updated_by_id'] ]
|
||||
data[ User.to_app_model ][ self['updated_by_id'] ] = User.user_data_full( self['updated_by_id'] )
|
||||
if !data[ User.to_app_model ][ self.updated_by_id ]
|
||||
data[ User.to_app_model ][ self.updated_by_id ] = User.user_data_full( self.updated_by_id )
|
||||
end
|
||||
data
|
||||
end
|
||||
|
|
|
@ -28,11 +28,18 @@ returns
|
|||
if !data[ User.to_app_model ][ self.id ]
|
||||
data[ User.to_app_model ][ self.id ] = User.user_data_full( self.id )
|
||||
end
|
||||
if !data[ User.to_app_model ][ self['created_by_id'] ]
|
||||
data[ User.to_app_model ][ self['created_by_id'] ] = User.user_data_full( self['created_by_id'] )
|
||||
if self.organization_id
|
||||
if !data[ Organization.to_app_model ]
|
||||
data[ Organization.to_app_model ] = {}
|
||||
end
|
||||
if !data[ User.to_app_model ][ self['updated_by_id'] ]
|
||||
data[ User.to_app_model ][ self['updated_by_id'] ] = User.user_data_full( self['updated_by_id'] )
|
||||
if !data[ Organization.to_app_model ][ self.organization_id ]
|
||||
data[ Organization.to_app_model ][ self.organization_id ] = Organization.find( self.organization_id )
|
||||
end
|
||||
if !data[ User.to_app_model ][ self.created_by_id ]
|
||||
data[ User.to_app_model ][ self.created_by_id ] = User.user_data_full( self.created_by_id )
|
||||
end
|
||||
if !data[ User.to_app_model ][ self.updated_by_id ]
|
||||
data[ User.to_app_model ][ self.updated_by_id ] = User.user_data_full( self.updated_by_id )
|
||||
end
|
||||
data
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue