feat: add GET/PUT clients endpoints to SettingsController

GET  /api/settings/clients       — list all Betriebe ordered by name
PUT  /api/settings/clients/:id   — update AgrarmonitorBetriebId

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 14:59:26 +02:00
parent f3e3df3724
commit 31d51dc19d
@@ -385,4 +385,17 @@ export class SettingsController {
return this.corrSettingRepo.save(setting);
}
// === Betriebe ===
@Get('clients')
async getClients() {
return this.clientRepo.find({ order: { Name: 'ASC' } });
}
@Put('clients/:id')
async updateClient(@Param('id') id: string, @Body() body: { AgrarmonitorBetriebId: number | null }) {
const clientId = parseInt(id, 10);
await this.clientRepo.update(clientId, { AgrarmonitorBetriebId: body.AgrarmonitorBetriebId ?? null });
return this.clientRepo.findOneByOrFail({ Id: clientId });
}
}