mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-22 20:10:40 +03:00
Fixing in user.js
This commit is contained in:
parent
8178709f67
commit
0144741a97
1 changed files with 4 additions and 2 deletions
|
@ -29,11 +29,13 @@ module.exports = class User {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getByName(Name = this.name) {
|
async getByName(Name = this.name) {
|
||||||
|
|
||||||
const user = await UserModel.findOne({ name: Name });
|
const user = await UserModel.findOne({ name: Name });
|
||||||
if (!user) return null;
|
if (!user) return null;
|
||||||
|
|
||||||
const { name = "guest", avatar = "/images/guest.png", time = Date.now(), admin = false, deleted = false } = user;
|
const { id, name = "guest", avatar = "/images/guest.png", time = Date.now(), admin = false, deleted = false } = user;
|
||||||
|
|
||||||
|
this.id = Number(id);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.avatar = avatar;
|
this.avatar = avatar;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
|
|
Loading…
Reference in a new issue