mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-02-03 13:27:49 +01:00
@@ -2,18 +2,22 @@ import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
|
|||||||
import Redis from "@ioc:Adonis/Addons/Redis";
|
import Redis from "@ioc:Adonis/Addons/Redis";
|
||||||
import {UpdateGitHubReadme} from "App/Tasks/UpdateGithubReadme";
|
import {UpdateGitHubReadme} from "App/Tasks/UpdateGithubReadme";
|
||||||
|
|
||||||
const STATES = [
|
interface STATE {
|
||||||
{sleeping: 'is_sleeping'},
|
state: string
|
||||||
{listening: 'is_listening_music'},
|
}
|
||||||
{developing: 'is_developing'},
|
|
||||||
{learning: 'is_learning'}
|
const STATES: Array<STATE> = [
|
||||||
|
{state: 'developing'},
|
||||||
|
{state: 'learning'},
|
||||||
|
{state: 'listening_music'},
|
||||||
|
{state: 'learning'}
|
||||||
]
|
]
|
||||||
|
|
||||||
export default class StatesController {
|
export default class StatesController {
|
||||||
|
|
||||||
public async get({response}: HttpContextContract) {
|
public async get({response}: HttpContextContract) {
|
||||||
const states = STATES.map(async state => {
|
const states = STATES.map(async state => {
|
||||||
return this.getStatus(await Redis.get(`states:${state}`))
|
return this.getStatus(await Redis.get(`is_${state}`))
|
||||||
})
|
})
|
||||||
|
|
||||||
return response.status(200).send({
|
return response.status(200).send({
|
||||||
|
|||||||
Reference in New Issue
Block a user