fixed variable name usage

This commit is contained in:
Pau 2025-04-07 23:26:43 +02:00
parent faa93e1d71
commit fd2e54c845
2 changed files with 4 additions and 8 deletions

View File

@ -31,13 +31,10 @@ const countEndpointsModel = ({conn, ...rest}) => {
const insertEndpointsModel = ({conn, ...params}) => {
const now = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')
const uuid = uuidv4()
const paramsToInsert = {...params, uuid, now}
const paramsToInsert = {...params, uuid, now, createdBy: params.createdBy}
return mysql
.execute(insertEndpointsQuery(paramsToInsert), conn, paramsToInsert)
.then(queryResult => queryResult[1].map(({id, created, deleted, createdBy, deletedBy, ...resultFiltered}) => resultFiltered))
.catch(err => {
reject(err)
})
}
const modifyEndpointsModel = ({conn, ...params}) => {

View File

@ -1,4 +1,3 @@
import { randomUUID as uuidv4 } from 'node:crypto'
import dayjs from 'dayjs'
import mysql from '../../adapters/mysql.js'
@ -16,7 +15,7 @@ const getRolesHasPermissionsModel = ({conn, ...rest}) => {
return mysql
.execute(getRolesHasPermissionsQuery(paramsToSearch), conn, paramsToSearch)
.then(results => results.map(({id, uuid, fk_role, fk_permission, created, deleted, createdBy, deletedBy, ...resultFiltered}) => resultFiltered))
.then(results => results.map(({id, created, deleted, createdBy, deletedBy, ...resultFiltered}) => resultFiltered))
}
const countRolesHasPermissionsModel = ({conn, ...rest}) => {
@ -24,7 +23,7 @@ const countRolesHasPermissionsModel = ({conn, ...rest}) => {
const paramsToSearch = { ...rest, now }
return mysql
.execute(countRolesHasPermissionsQuery(params), conn, paramsToSearch)
.execute(countRolesHasPermissionsQuery(paramsToSearch), conn, paramsToSearch)
.then(results => results[0].count)
}