Private
Public Access
1
0

refacto: Deleting email mentions as there's no emailing system

This commit is contained in:
gauvainboiche
2026-03-31 16:54:11 +02:00
parent 42e68db00b
commit 7fa41ef7ac
6 changed files with 22 additions and 21 deletions

View File

@@ -7,7 +7,6 @@ export async function initUsersSchema() {
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
username TEXT NOT NULL UNIQUE,
email TEXT NOT NULL UNIQUE,
password_hash TEXT NOT NULL,
team TEXT NOT NULL CHECK (team IN ('blue', 'red')),
role TEXT NOT NULL DEFAULT 'user' CHECK (role IN ('user', 'admin')),
@@ -18,19 +17,19 @@ export async function initUsersSchema() {
// ── Queries ───────────────────────────────────────────────────────────────────
export async function createUser(username, email, passwordHash, team) {
export async function createUser(username, passwordHash, team) {
const { rows } = await usersPool.query(
`INSERT INTO users (username, email, password_hash, team)
VALUES ($1, $2, $3, $4)
RETURNING id, username, email, team, role`,
[username, email, passwordHash, team]
`INSERT INTO users (username, password_hash, team)
VALUES ($1, $2, $3)
RETURNING id, username, team, role`,
[username, passwordHash, team]
);
return rows[0];
}
export async function getUserByUsername(username) {
const { rows } = await usersPool.query(
`SELECT id, username, email, team, role, password_hash FROM users WHERE username = $1`,
`SELECT id, username, team, role, password_hash FROM users WHERE username = $1`,
[username]
);
return rows[0] ?? null;
@@ -38,7 +37,7 @@ export async function getUserByUsername(username) {
export async function getUserById(id) {
const { rows } = await usersPool.query(
`SELECT id, username, email, team, role FROM users WHERE id = $1`,
`SELECT id, username, team, role FROM users WHERE id = $1`,
[id]
);
return rows[0] ?? null;