Merge remote-tracking branch 'origin/main'

# Conflicts:
#	backend/test/user.test.js
This commit is contained in:
Sascha Kühl 2025-03-21 18:15:42 +01:00
commit 751953ae70
2 changed files with 11 additions and 2 deletions

View File

@ -15,7 +15,7 @@ app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// database
const db = require("./models/index");
const db = require("./models");
const Role = db.Role;
const User = db.User;
const PitchType = db.PitchType;

View File

@ -52,6 +52,15 @@ module.exports = (sequelize, DataTypes) => {
user.password = await bcrypt.hash(user.password, salt);
}
}
}, {
defaultScope: {
attributes: { exclude: ['password'] },
},
scopes: {
withSecretColumns: {
attributes: { include: ['password'] },
},
},
});
User.prototype.validPassword = function (password) {