chore: update lint scripts and improve formatting consistency

- Added `lint:fix` scripts for backend, frontend, and documentation.
- Enabled `biome check --write` for unsafe fixes in backend scripts.
- Fixed imports, formatting, and logging for improved code clarity.
- Adjusted service unit tests for better readability and maintainability.
This commit is contained in:
Mathis HERRIOT
2026-01-21 11:38:25 +01:00
parent a90aba2748
commit 951b38db67
10 changed files with 62 additions and 22 deletions

View File

@@ -1,3 +1,4 @@
import * as crypto from "node:crypto";
import {
Injectable,
Logger,
@@ -5,7 +6,6 @@ import {
UnauthorizedException,
} from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import * as crypto from "node:crypto";
import { UsersService } from "../users/users.service";
import { RbacService } from "./rbac.service";
@@ -34,9 +34,15 @@ export class BootstrapService implements OnApplicationBootstrap {
const url = `${protocol}://${domain}/auth/bootstrap-admin`;
this.logger.warn("SECURITY ALERT: No administrator found in database.");
this.logger.warn("To create the first administrator, use the following endpoint:");
this.logger.warn(`Endpoint: GET ${url}?token=${this.bootstrapToken}&username=votre_nom_utilisateur`);
this.logger.warn("Exemple: curl -X GET \"http://localhost/auth/bootstrap-admin?token=...&username=...\"");
this.logger.warn(
"To create the first administrator, use the following endpoint:",
);
this.logger.warn(
`Endpoint: GET ${url}?token=${this.bootstrapToken}&username=votre_nom_utilisateur`,
);
this.logger.warn(
'Exemple: curl -X GET "http://localhost/auth/bootstrap-admin?token=...&username=..."',
);
this.logger.warn("This token is one-time use only.");
}
@@ -53,7 +59,9 @@ export class BootstrapService implements OnApplicationBootstrap {
await this.rbacService.assignRoleToUser(user.uuid, "admin");
this.bootstrapToken = null; // One-time use
this.logger.log(`User ${username} has been promoted to administrator via bootstrap token.`);
this.logger.log(
`User ${username} has been promoted to administrator via bootstrap token.`,
);
return { message: `User ${username} is now an administrator` };
}
}