From 67731d416081d2b6fc507f4e9554540b55b55fc9 Mon Sep 17 00:00:00 2001 From: charleswrayjr Date: Thu, 11 Sep 2025 23:35:26 -0500 Subject: [PATCH] Adding get_user_roles to user.model.js. --- src/models/user.model.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/models/user.model.js b/src/models/user.model.js index 5e3af78..94edaea 100644 --- a/src/models/user.model.js +++ b/src/models/user.model.js @@ -110,6 +110,16 @@ class User extends Model { return new User( result ); }; + async get_user_roles() { + const query_str = ` + SELECT r.* + FROM phase.user_roles ur + inner join phase.roles r on r.id = ur.role_id + WHERE ur.user_id = $1 and r.is_deleted = false + `; + return await phsdb.query( query_str, [this.id], { plain:true } ); + }; + /** * Find user by email * @param {string} email - Email to search for -- 2.43.0