Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
HranikBs23 committed Feb 27, 2022
1 parent 2047d6a commit 5d4e437
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/modules/platform/role/role.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ async function updateRole(req, res) {

if (title) {
const slug = makeCustomSlug(title);
await role.update({ title, slug, updated_by: req.params.id });
await role.update({ title, slug, updated_by: req.user.id });
}

if (type) await role.update({ type, updated_by: req.params.id });
if (type) await role.update({ type, updated_by: req.user.id });

if (description) await role.update({ description, updated_by: req.params.id });
if (description) await role.update({ description, updated_by: req.user.id });

if (permissions) {
await RolePermission.destroy({ where: { role_id: role.id }});
Expand Down
2 changes: 1 addition & 1 deletion src/modules/platform/user/user.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ User.prototype.validPassword = function (password) {
};

User.belongsTo(User, { as: 'createdByUser', foreignKey: 'created_by' });
User.belongsTo(User, { as: 'updatedByUser', foreignKey: 'created_by' });
User.belongsTo(User, { as: 'updatedByUser', foreignKey: 'updated_by' });

Profile.hasMany(User, { as: 'users', foreignKey: 'profile_id', constraints: false });
User.belongsTo(Profile, { as: 'profile', foreignKey: 'profile_id', constraints: false });
Expand Down

0 comments on commit 5d4e437

Please sign in to comment.