From c6b5d7f5a4a291dbfbcdc4d6187fb92bb0052912 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 16 Nov 2023 08:30:01 +0100 Subject: [PATCH] refs #6434 feat: rename id key by token --- back/methods/vn-user/sign-in.js | 2 +- db/changes/234202/00-createSignInLogTable.sql | 2 +- modules/account/back/models/sign_in-log.json | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js index 25f708b8e..9c2d568f4 100644 --- a/back/methods/vn-user/sign-in.js +++ b/back/methods/vn-user/sign-in.js @@ -51,7 +51,7 @@ module.exports = Self => { } const validateLogin = await Self.validateLogin(user, password); await Self.app.models.SignInLog.create({ - id: validateLogin.token, + token: validateLogin.token, userFk: vnUser.id, ip: ctx.req.ip }); diff --git a/db/changes/234202/00-createSignInLogTable.sql b/db/changes/234202/00-createSignInLogTable.sql index 977de4646..6a648bb51 100644 --- a/db/changes/234202/00-createSignInLogTable.sql +++ b/db/changes/234202/00-createSignInLogTable.sql @@ -8,7 +8,7 @@ DROP TABLE IF EXISTS `account`.`signInLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `account`.`signInLog` ( - `id` varchar(10) NOT NULL , + `token` varchar(255) NOT NULL , `userFk` int(10) unsigned DEFAULT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `ip` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, diff --git a/modules/account/back/models/sign_in-log.json b/modules/account/back/models/sign_in-log.json index 3cd971cb8..9e6df2da5 100644 --- a/modules/account/back/models/sign_in-log.json +++ b/modules/account/back/models/sign_in-log.json @@ -7,13 +7,16 @@ } }, "properties": { - "id": { - "type": "string" + "token": { + "required": true, + "type": "string", + "description": "Token's user" }, "creationDate": { - "type": "date" + "type": "date" }, "userFk": { + "required": true, "type": "number" }, "ip": {