diff options
Diffstat (limited to 'vnext/server/db')
-rw-r--r-- | vnext/server/db/Users.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/vnext/server/db/Users.js b/vnext/server/db/Users.js index 3db3eb5b..a6148497 100644 --- a/vnext/server/db/Users.js +++ b/vnext/server/db/Users.js @@ -1,7 +1,7 @@ import { DataTypes, Op } from 'sequelize' import db from './index' -export const User = db.define('user', { +const User = db.define('user', { id: { type: DataTypes.INTEGER, primaryKey: true @@ -9,6 +9,8 @@ export const User = db.define('user', { nick: DataTypes.STRING, banned: DataTypes.INTEGER, last_seen: DataTypes.DATE +}, { + timestamps: false }) export const getMonthlyActiveUsers = async () => { @@ -25,3 +27,13 @@ export const getMonthlyActiveUsers = async () => { } }) } + +export const getUserByName = async (name = '') => { + return User.findOne({ + where: { + nick: { + [Op.eq]: name + } + } + }) +} |