mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-27 23:27:31 +00:00
chore(server): size, strict and warning baselines follow the error-envelope work
This commit is contained in:
@@ -172,7 +172,7 @@ export class AdminService {
|
||||
}
|
||||
|
||||
const pwCheck = validatePassword(password);
|
||||
if (!pwCheck.ok) throw new DomainError(400, pwCheck.reason);
|
||||
if (!pwCheck.ok) throw new DomainError(400, pwCheck.reason ?? '');
|
||||
|
||||
if (data.role && !['user', 'admin'].includes(data.role)) {
|
||||
throw new DomainError(400, 'Invalid role');
|
||||
@@ -236,7 +236,7 @@ export class AdminService {
|
||||
|
||||
if (password) {
|
||||
const pwCheck = validatePassword(password);
|
||||
if (!pwCheck.ok) throw new DomainError(400, pwCheck.reason);
|
||||
if (!pwCheck.ok) throw new DomainError(400, pwCheck.reason ?? '');
|
||||
}
|
||||
const passwordHash = password ? bcrypt.hashSync(password, BCRYPT_COST) : null;
|
||||
|
||||
|
||||
@@ -459,7 +459,7 @@ export class AuthService {
|
||||
}
|
||||
|
||||
const pwCheck = validatePassword(password);
|
||||
if (!pwCheck.ok) throw new DomainError(400, pwCheck.reason);
|
||||
if (!pwCheck.ok) throw new DomainError(400, pwCheck.reason ?? '');
|
||||
|
||||
if (!EMAIL_REGEX.test(email)) {
|
||||
throw new DomainError(400, 'Invalid email format');
|
||||
@@ -638,7 +638,7 @@ export class AuthService {
|
||||
if (!new_password) throw new DomainError(400, 'New password is required');
|
||||
|
||||
const pwCheck = validatePassword(new_password);
|
||||
if (!pwCheck.ok) throw new DomainError(400, pwCheck.reason);
|
||||
if (!pwCheck.ok) throw new DomainError(400, pwCheck.reason ?? '');
|
||||
|
||||
const user = await this.usersRepo.getPasswordHashAndVersion(userId);
|
||||
if (!user || !bcrypt.compareSync(current_password, user.password_hash)) {
|
||||
|
||||
@@ -655,10 +655,11 @@ export class VacayMcp {
|
||||
text: JSON.stringify(data, null, 2),
|
||||
}],
|
||||
});
|
||||
if (!plan.holidays_enabled || !plan.holidays_region) return json([]);
|
||||
const region = plan.holidays_region;
|
||||
if (!plan.holidays_enabled || !region) return json([]);
|
||||
const yearStr = Array.isArray(year) ? year[0] : year;
|
||||
// A failed fetch reads as no holidays here, as it always has.
|
||||
const result = await catchDomainError(() => this.vacay.getHolidays(yearStr, plan.holidays_region));
|
||||
const result = await catchDomainError(() => this.vacay.getHolidays(yearStr, region));
|
||||
return json(result instanceof DomainError ? [] : (result.data ?? []));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user