Files
corrosion-admin-panel/backend-nest/src/modules/changelog/changelog.controller.ts
Vantz Stockwell 3cb714a792
All checks were successful
Test Asgard Runner / test (push) Successful in 3s
fix: Resolve 500/404 cascade — JWT tenant context, wipe routes, changelog stub
Root cause: super_admin JWT returned early with no license_id, causing
@CurrentTenant() to pass undefined to every tenant-scoped service query.

- jwt.strategy: Move license lookup before super_admin early return so
  admins who own licenses get their license_id in the JWT payload
- CurrentTenant decorator: Throw 401 with clear message when license_id
  is undefined instead of letting undefined cascade into TypeORM queries
- Wipe store: Fix 6 wrong routes (/profiles → /wipes/profiles, etc.)
  and remove redundant manual license_id guards
- Changelog module: Add stub controller/service returning empty array
  to eliminate 404 on /api/changelog
- ChangelogView: Handle both array and {entries} response shapes
- AGENTS.md: Streamlined 3-tier roster (Opus/Sonnet/Haiku)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 22:11:41 -05:00

25 lines
836 B
TypeScript

import { Controller, Get, Query } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger';
import { ChangelogService } from './changelog.service';
import { Public } from '../../common/decorators/public.decorator';
@ApiTags('changelog')
@Controller('changelog')
export class ChangelogController {
constructor(private readonly changelogService: ChangelogService) {}
@Get()
@Public()
@ApiOperation({ summary: 'Get changelog entries' })
@ApiQuery({ name: 'page', required: false, type: Number })
@ApiQuery({ name: 'limit', required: false, type: Number })
async getEntries(
@Query('page') page?: string,
@Query('limit') limit?: string,
) {
const p = parseInt(page || '1', 10);
const l = parseInt(limit || '20', 10);
return this.changelogService.getEntries(p, l);
}
}