chore: initial commit — AdonisJS v7 TR-069 ACS
- 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>
This commit is contained in:
commit
d1c65dbf1e
164 files changed
+29127
No files matched your search
@@ -0,0 +1,31 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user