feat: orchestrate goals with local and cloud models

This commit is contained in:
thanhnv
2026-07-10 23:35:30 +09:00
parent 1345d4c930
commit 48b1186439
11 changed files with 920 additions and 2 deletions
@@ -0,0 +1,24 @@
import { Body, Controller, Get, Headers, Inject, Param, Post, Query } from '@nestjs/common';
import { ok } from '../common/api-response.js';
import { actorFromHeaders } from '../common/auth-context.js';
import { GoalsService, type GoalStartInput } from './goals.service.js';
@Controller('api/v1/goals')
export class GoalsController {
constructor(@Inject(GoalsService) private readonly service: GoalsService) {}
@Post()
async start(@Body() body: GoalStartInput, @Headers() headers: Record<string, string | string[] | undefined>) {
return ok(await this.service.start(body, actorFromHeaders(headers)));
}
@Get()
list(@Headers() headers: Record<string, string | string[] | undefined>, @Query('limit') limit?: string) {
return ok(this.service.list(actorFromHeaders(headers), Number(limit) || 20));
}
@Get(':id')
get(@Param('id') id: string, @Headers() headers: Record<string, string | string[] | undefined>) {
return ok(this.service.get(id, actorFromHeaders(headers)));
}
}