/var/www/greso.tech/server/nsm/responseModels/branch
Edit: /var/www/greso.tech/server/nsm/responseModels/branch/branchUsersList.model.js (753B)
const UserShortModel = require('../user/userShort.model')
module.exports = class BranchUsersListModel {
constructor({ rows, time, page, count, limit }) {
this.list = rows
? rows.filter(function(company_user) {
if (company_user.user === null) {
return false; // skip
}
return true;
}).map((company_user) => {
const { id, roleId, branchId, role, user } = company_user
return {
id,
branchId,
roleId,
role: role!=undefined?{
id: role.id,
key: role.key,
name: role.name,
}:null,
user:new UserShortModel(user),
}
})
: []
this.count = count || 0
this.page = page ? page : 1
this.limit = limit ? limit : 1
this.time = time ? time : 0
}
}