mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
Change other state when the other is updated
This commit is contained in:
@@ -19,6 +19,7 @@ export default class StatesController {
|
||||
public async setSleeping ({ request, response }: HttpContextContract) {
|
||||
const { value } = await request.validate(StateSleepingValidator)
|
||||
await Redis.set('states:sleeping', String(value))
|
||||
await Redis.set('states:developing', String(!value))
|
||||
return response.status(200).send({
|
||||
message: 'State was successfully set!',
|
||||
value: this.formatValue(String(value))
|
||||
|
||||
@@ -30,6 +30,7 @@ async function getCurrentTime(): Promise<void> {
|
||||
|
||||
if (redis_state !== active) {
|
||||
await Redis.set('states:developing', String(active))
|
||||
await Redis.set('states:sleeping', String(!active))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user