style: clean up code formatting and remove trailing whitespace

refactor: reorganize imports and fix type imports
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-11 03:08:36 -03:00
1 parent d3704602fd
commit 47c04de6fe
232 files changed
+7140 -4798

No files matched your search

+15 -12
View File
@@ -45,9 +45,13 @@ export interface UpdateUserData {
* Cria um novo usuário
*/
export async function createUser(
data: CreateUserData
data: CreateUserData,
): Promise<{ userId: number; username: string; email: string }> {
const result = await query<{ user_id: number; username: string; email: string }>(
const result = await query<{
user_id: number;
username: string;
email: string;
}>(
`
INSERT INTO users (username, email, password_hash, first_name, last_name, phone, cpf)
VALUES ($1, $2, $3, $4, $5, $6, $7)
@@ -61,7 +65,7 @@ export async function createUser(
data.last_name,
data.phone || null,
data.cpf || null,
]
],
);
return {
@@ -79,7 +83,7 @@ export async function getUserByEmail(email: string): Promise<User | null> {
`
SELECT * FROM users WHERE email = $1
`,
[email]
[email],
);
return result.rows[0] || null;
@@ -89,13 +93,13 @@ export async function getUserByEmail(email: string): Promise<User | null> {
* Busca usuário por username
*/
export async function getUserByUsername(
username: string
username: string,
): Promise<User | null> {
const result = await query<User>(
`
SELECT * FROM users WHERE username = $1
`,
[username]
[username],
);
return result.rows[0] || null;
@@ -114,7 +118,7 @@ export async function getUserById(userId: number): Promise<User | null> {
FROM users
WHERE user_id = $1
`,
[userId]
[userId],
);
return result.rows[0] || null;
@@ -128,7 +132,7 @@ export async function getUserByCpf(cpf: string): Promise<User | null> {
`
SELECT user_id, username, email FROM users WHERE cpf = $1
`,
[cpf]
[cpf],
);
return result.rows[0] || null;
@@ -139,7 +143,7 @@ export async function getUserByCpf(cpf: string): Promise<User | null> {
*/
export async function updateUser(
userId: number,
data: UpdateUserData
data: UpdateUserData,
): Promise<User> {
const updates: string[] = [];
const values: any[] = [];
@@ -187,7 +191,7 @@ export async function updateUser(
account_level, has_donated, whatsapp_notifications,
created_at, updated_at, last_login, is_active, is_verified
`,
values
values,
);
if (result.rows.length === 0) {
@@ -207,7 +211,6 @@ export async function updateLastLogin(userId: number): Promise<void> {
SET last_login = CURRENT_TIMESTAMP
WHERE user_id = $1
`,
[userId]
[userId],
);
}