mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
Lint and update
This commit is contained in:
@@ -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!',
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user