Lint and update

This commit is contained in:
2021-11-10 12:06:58 +01:00
parent dabdb26e9a
commit e1b4d2e1a5
118 changed files with 2477 additions and 778 deletions

View File

@@ -1,17 +1,16 @@
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
import CommandsRun from "App/Models/CommandsRun";
import BuildsRun from "App/Models/BuildsRun";
import CommandsRun from 'App/Models/CommandsRun'
import BuildsRun from 'App/Models/BuildsRun'
import {
fetchDailyStatistics,
fetchMonthlyStatistics,
fetchStatistics,
fetchWeeklyStatistics,
NOW
} from "App/Utils/StatsUtils";
NOW,
} from 'App/Utils/StatsUtils'
export default class StatsController {
public async index ({ response }: HttpContextContract) {
public async index({ response }: HttpContextContract) {
const daily = await fetchDailyStatistics()
const weekly = await fetchWeeklyStatistics()
const monthly = await fetchMonthlyStatistics()
@@ -25,46 +24,45 @@ export default class StatsController {
development_time: total.development_time,
commands_run: total.commands_ran,
builds_run: total.builds_ran,
}
},
})
}
public async incrementCommandCount({ response }: HttpContextContract) {
const current_commands = await CommandsRun.firstOrCreate(
{
date: NOW
date: NOW,
},
{
date: NOW,
commands: 0
}
commands: 0,
},
)
current_commands.commands++
await current_commands.save()
return response.status(200).send({
message: 'Commands Count successfully incremented!'
message: 'Commands Count successfully incremented!',
})
}
public async incrementBuildCount({ response }: HttpContextContract) {
const current_builds = await BuildsRun.firstOrCreate(
{
date: NOW
date: NOW,
},
{
date: NOW,
builds: 0
}
builds: 0,
},
)
current_builds.builds++
await current_builds.save()
return response.status(200).send({
message: 'Builds Count successfully incremented!'
message: 'Builds Count successfully incremented!',
})
}
}