chore: linter issues
This commit is contained in:
parent
d899e56c07
commit
0c17e82f8f
6 changed files with 18 additions and 27 deletions
|
@ -572,7 +572,7 @@ const v2lut = {
|
|||
* This is a special route not available for API users
|
||||
*/
|
||||
PatternModel.prototype.import = async function (v2user, lut, userId) {
|
||||
for (const [handle, pattern] of Object.entries(v2user.patterns)) {
|
||||
for (const pattern of Object.values(v2user.patterns)) {
|
||||
let skip = false
|
||||
const data = { ...migratePattern(pattern, userId), userId }
|
||||
if (lut[pattern.person]) data.setId = lut[pattern.person]
|
||||
|
|
|
@ -74,7 +74,7 @@ UserModel.prototype.find = async function (body) {
|
|||
* Failed to run database query. Log warning and return 404
|
||||
*/
|
||||
log.warn({ err, body }, `Error while trying to find user: ${body.username}`)
|
||||
return setResponse(404)
|
||||
return this.setResponse(404)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -111,8 +111,8 @@ UserModel.prototype.loadAuthenticatedUser = async function (user) {
|
|||
/*
|
||||
* Failed to run database query. Log warning and return 404
|
||||
*/
|
||||
log.warn({ err, body }, `Error while trying to find user: ${user.uid}`)
|
||||
return setResponse(404)
|
||||
log.warn({ err, user }, `Error while trying to find user: ${user.uid}`)
|
||||
return this.setResponse(404)
|
||||
}
|
||||
|
||||
return this
|
||||
|
@ -144,8 +144,8 @@ UserModel.prototype.revealAuthenticatedUser = async function (user) {
|
|||
/*
|
||||
* Failed to run database query. Log warning and return 404
|
||||
*/
|
||||
log.warn({ err, body }, `Error while trying to find and reveal user: ${user.uid}`)
|
||||
return setResponse(404)
|
||||
log.warn({ err, user }, `Error while trying to find and reveal user: ${user.uid}`)
|
||||
return this.setResponse(404)
|
||||
}
|
||||
|
||||
return this.reveal()
|
||||
|
|
|
@ -70,7 +70,6 @@ export async function replaceImage(props, isTest = false) {
|
|||
export async function ensureImage(props, isTest = false) {
|
||||
if (isTest) return props.id || false
|
||||
const form = getFormData(props)
|
||||
let result
|
||||
try {
|
||||
await axios.post(config.api, form, { headers })
|
||||
} catch (err) {
|
||||
|
|
|
@ -341,10 +341,10 @@ export function decorateModel(Model, tools, modelConfig) {
|
|||
*/
|
||||
Model.time = function (key) {
|
||||
if (this.timer)
|
||||
log.info(`Timer split [${key ? key : modalConfig.name}] ${Date.now() - this.timer}ms`)
|
||||
log.info(`Timer split [${key ? key : modelConfig.name}] ${Date.now() - this.timer}ms`)
|
||||
else {
|
||||
this.timer = Date.now()
|
||||
log.info(`Timer start [${key ? key : modalConfig.name}] 0ms`)
|
||||
log.info(`Timer start [${key ? key : modelConfig.name}] 0ms`)
|
||||
}
|
||||
|
||||
return this
|
||||
|
|
|
@ -89,7 +89,7 @@ const importUsers = async () => {
|
|||
let total = 0
|
||||
const batches = splitArray(todo, batchSize)
|
||||
for (const batch of batches) {
|
||||
const result = await fetch(`${BACKEND}/import/users`, {
|
||||
await fetch(`${BACKEND}/import/users`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
import users from '../dump/v2-users.json' assert { type: 'json' }
|
||||
|
||||
const lastLoginInDays = (user) => {
|
||||
if (!user.time?.login) return 1000
|
||||
const now = new Date()
|
||||
const then = new Date(user.time.login)
|
||||
|
||||
return Math.floor((now - then) / (1000 * 60 * 60 * 24))
|
||||
}
|
||||
|
||||
const usersToNotImport = () => users.filter((user) => user.status !== 'active')
|
||||
// Commented out for linter
|
||||
//const usersToImport = () =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue