feat: add chat message

This commit is contained in:
2024-10-01 00:47:14 +08:00
parent e05c042827
commit bd38ad2eaa
20 changed files with 556 additions and 10 deletions

View File

@@ -24,7 +24,9 @@ export class User extends Model {
return { token, expireTime: now + expireTime };
}
static async verifyToken(token: string) {
return await checkToken(token, config.tokenSecret);
const ct = await checkToken(token, config.tokenSecret);
const tokenUser = ct.payload;
return tokenUser;
}
static createUser(username: string, password?: string, description?: string) {
const user = User.findOne({ where: { username } });
@@ -79,6 +81,7 @@ User.init(
{
sequelize,
tableName: 'cf_user',
paranoid: true,
},
);
User.sync({ alter: true, logging: false })