- Docker infrastructure (Dockerfile, docker-compose.yml, genieacs-sim) - AdonisJS v7 app with Inertia.js + Vue 3 - MongoDB integration - CWMP/TR-069 state machine engine - Configuration engine with compliance tracking - Branding: ADAM ACS (favicon, navbar, locales) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import type { HttpContext } from '@adonisjs/core/http'
|
|
import CommandService from '#services/command_service'
|
|
import { createCommandValidator } from '#validators/command'
|
|
|
|
export default class CommandsController {
|
|
private commandService = new CommandService()
|
|
|
|
async index({ response }: HttpContext) {
|
|
const commands = await this.commandService.getCommands()
|
|
return response.json(commands)
|
|
}
|
|
|
|
async show({ params, response }: HttpContext) {
|
|
const commands = await this.commandService.getCommandsByDevice(params.id)
|
|
return response.json(commands)
|
|
}
|
|
|
|
async store({ request, response }: HttpContext) {
|
|
const payload = await request.validateUsing(createCommandValidator)
|
|
|
|
const command = await this.commandService.createCommand({
|
|
deviceIdentifier: payload.deviceIdentifier,
|
|
action: payload.action as any,
|
|
parameters: payload.parameters as Record<string, any>,
|
|
mode: payload.mode as any,
|
|
priority: payload.priority,
|
|
})
|
|
|
|
return response.status(201).json(command)
|
|
}
|
|
}
|