feat(13-06): getTender include sources[] (SCHEMA-03 read surface)

GET /modules/tender-radar/:id now includes the TenderSource relation
(sourcePortal, sourceUrl, sourceNoticeId) so a cross-source-deduped
tender's detail response carries links to all its source portals, not
just the single primary sourceUrl column. Route order unchanged (:id
stays after all static routes).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-23 08:55:02 +02:00
parent 1c523c039c
commit 166194fa04
2 changed files with 61 additions and 1 deletions
+15 -1
View File
@@ -343,11 +343,25 @@ export class TendersController {
* GET /modules/tender-radar/:id — single tender detail.
* Gated by @UseModule('tender-radar'); NOT scoped by the tenant's id
* (global row).
*
* D-03/SCHEMA-03 (13-06): includes the `sources` relation (TenderSource
* rows) so a cross-source-deduplicated tender surfaces links to ALL of
* its source portals, not just the single primary `sourceUrl` column.
* `select` is scoped to the three display fields the frontend needs —
* no `id`/`createdAt` leak, same minimal-surface convention as
* `getCoverage`'s groupBy projection.
*/
@Get(':id')
@UseModule('tender-radar')
async getTender(@Param('id') id: string) {
const tender = await this.prisma.tender.findUnique({ where: { id } });
const tender = await this.prisma.tender.findUnique({
where: { id },
include: {
sources: {
select: { sourcePortal: true, sourceUrl: true, sourceNoticeId: true },
},
},
});
if (!tender) {
throw new NotFoundException('Tender not found');
}