Ajustado el token de la tarjeta y solucionados problemas de conexion de

docker
This commit is contained in:
2026-04-13 14:59:33 +02:00
parent f7084e8db3
commit b965167d8d
11 changed files with 123 additions and 27 deletions

View File

@@ -17,6 +17,7 @@ export class NfcController {
public generateActivationTag() {
return async (req: Request, res: Response) => {
console.log(("REQ!", req))
const body = req.body
const validate = baseValidator.validate(body)

View File

@@ -1,4 +1,3 @@
import { UUID, uuidv7 } from "uuidv7";
import { BodyValidator, type Validator } from "./BodyValidator.js";
const cardIdExists: Validator<{ card_id?: string }> = {
@@ -7,10 +6,10 @@ const cardIdExists: Validator<{ card_id?: string }> = {
errorMsg: "El campo card_id esta undefined"
}
const cardIdIsUUIDv7: Validator<{ card_id: string }> = {
const cardIdIsToken: Validator<{ card_id: string }> = {
field: "card_id",
validationFunc: (body) => UUID.parse(body.card_id) != undefined,
errorMsg: "El campo card_id no es un uuidv7"
validationFunc: (body) => typeof body.card_id === 'string' && body.card_id.length === 9,
errorMsg: "El campo card_id no tiene una logitdud de 9 digitos"
}
export const baseValidator = new BodyValidator([cardIdExists, cardIdIsUUIDv7])
export const baseValidator = new BodyValidator([cardIdExists, cardIdIsToken])

View File

@@ -4,7 +4,7 @@ import { httpclient } from "config/httpclient.config.js";
import { pgClient } from "config/pgclient.config.js";
import { NfcRepository } from "./Nfc.repository.js";
import type { ServerContext } from "domain/ServerContext.js";
import { uuidv7 } from "uuidv7";
await describe("NfcRepository Integration Tests", async () => {
const serverContext: ServerContext = {
@@ -13,7 +13,7 @@ await describe("NfcRepository Integration Tests", async () => {
};
const repo = new NfcRepository(serverContext);
const testCardId = uuidv7()
const testCardId = "123456789";
const testCode = "12345678";
let lastCodeGenerated: string | undefined = undefined;
@@ -66,7 +66,7 @@ await describe("NfcRepository Integration Tests", async () => {
});
await test("findActivationCodes should return empty array if card has no codes", async () => {
const nonExistentCard = uuidv7()
const nonExistentCard = "987654321";
const result = await repo.findActivationCodes(nonExistentCard);
if (result.error) {