From 9c66a5097316adf1991f9fef5ed12f4c7e0e99d3 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 3 Mar 2022 01:58:47 +0000 Subject: [PATCH] Add User.shortName --- lib/User.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/User.js b/lib/User.js index b8d02dd..22d9eae 100644 --- a/lib/User.js +++ b/lib/User.js @@ -14,6 +14,8 @@ class User { firstName; otherNames; lastName; + shortName; + fullName; email; #password; type = null; @@ -61,6 +63,7 @@ class User { this[k] = v; this.type = type; + this.shortName = this.getShortName(); this.fullName = this.getFullName(); if (knownType) @@ -86,6 +89,10 @@ class User { return name; } + getShortName() { + return `${this.firstName} ${this.lastName}`; + } + async verifyPassword(password) { return await bcrypt.compare(password, this.password); }