feat(CC-058): add GET /ai-requests/:id with full contextManifest for transparency viewer
This commit is contained in:
parent
9d58aa90be
commit
8f69f9d95c
1 changed files with 16 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { Controller, Get, Query } from '@nestjs/common';
|
import { Controller, Get, NotFoundException, Param, ParseUUIDPipe, Query } from '@nestjs/common';
|
||||||
import { desc, eq, sum, count } from 'drizzle-orm';
|
import { and, desc, eq, sum, count } from 'drizzle-orm';
|
||||||
import { CurrentSession } from '../auth/session.decorator';
|
import { CurrentSession } from '../auth/session.decorator';
|
||||||
import type { AuthenticatedSession } from '../auth/tenant.guard';
|
import type { AuthenticatedSession } from '../auth/tenant.guard';
|
||||||
import { db } from '../db/client';
|
import { db } from '../db/client';
|
||||||
|
|
@ -72,4 +72,18 @@ export class AiRequestsController {
|
||||||
byStatus,
|
byStatus,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get(':id')
|
||||||
|
async getOne(
|
||||||
|
@CurrentSession() session: AuthenticatedSession,
|
||||||
|
@Param('id', ParseUUIDPipe) id: string,
|
||||||
|
) {
|
||||||
|
const record = await db.query.aiRequests.findFirst({
|
||||||
|
where: and(eq(aiRequests.id, id), eq(aiRequests.tenantId, session.tenantId)),
|
||||||
|
});
|
||||||
|
if (!record) {
|
||||||
|
throw new NotFoundException('AI request not found');
|
||||||
|
}
|
||||||
|
return record;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue