refactor: centralize domain values and enforce numeric lint

This commit is contained in:
2026-09-13 14:37:39 +03:00
parent 8ba005346d
commit 8637ad2f34
44 changed files with 543 additions and 174 deletions
+5 -2
View File
@@ -10,6 +10,9 @@ import { Session, User } from '../../../../generated/prisma/client';
import { PrismaService } from '../../../prisma/prisma.service';
import { AuthUser, RefreshPayload } from './auth.types';
const PASSWORD_HASH_ROUNDS = 12;
const REFRESH_TTL_MS = 604_800_000;
const ACCESS_TTL = '15m';
const REFRESH_TTL = '7d';
const DUMMY_PASSWORD_HASH =
@@ -39,7 +42,7 @@ export class AuthService {
data: {
id: randomUUID(),
email: normalizedEmail,
passwordHash: await bcrypt.hash(password, 12),
passwordHash: await bcrypt.hash(password, PASSWORD_HASH_ROUNDS),
},
});
} catch (error) {
@@ -162,7 +165,7 @@ export class AuthService {
);
const data = {
refreshTokenHash: this.hash(refreshToken),
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
expiresAt: new Date(Date.now() + REFRESH_TTL_MS),
};
if (expectedRefreshTokenHash) {
const updated = await this.prisma.session.updateMany({