Nickname added

This commit is contained in:
Artyom Ashirov
2024-11-14 18:24:04 +03:00
parent a3bde60b87
commit 52779d20ab
5 changed files with 7 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
import db from '../config/database.js';
export default class User {
static async create(telegramId) {
static async create(telegramId, username) {
try {
// First check if user exists
const existingUser = await this.getById(telegramId);
@@ -14,8 +14,8 @@ export default class User {
// Create new user
const result = await db.runAsync(
'INSERT INTO users (telegram_id) VALUES (?)',
[telegramId.toString()]
'INSERT INTO users (telegram_id, username) VALUES (?, ?)',
[telegramId.toString(), username]
);
// Commit transaction