chore(server): size, strict and warning baselines follow the error-envelope work

This commit is contained in:
Maurice
2026-10-10 16:45:54 +02:00
parent e7c1acfb47
commit e5a2af5999
9 changed files with 34 additions and 26 deletions
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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)) {
+3 -2
View File
@@ -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 ?? []));
}
}