aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/db
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-10-21 05:53:23 +0300
committerGravatar Vitaly Takmazov2024-10-21 05:53:23 +0300
commit6f7c755dca704ccf880538b7884473c9c829c2b7 (patch)
treeb3691287d72d6d0d7117b771e46944d778c93a21 /vnext/server/db
parent1eac455507b75c0795c169d92e1ce9bb36733209 (diff)
vnext: `webfinger` middleware
Diffstat (limited to 'vnext/server/db')
-rw-r--r--vnext/server/db/Users.js14
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
+ }
+ }
+ })
+}