@@ -2,7 +2,11 @@ import type { Request, Response } from 'express'
22import { z } from 'zod'
33
44import { NotFoundError } from '@crowd/common'
5- import { getAdvisoriesByPackageId , getPackageDetailByPurl } from '@crowd/data-access-layer'
5+ import {
6+ getAdvisoriesByPackageId ,
7+ getPackageDetailByPurl ,
8+ getStewardshipSummary ,
9+ } from '@crowd/data-access-layer'
610
711import { getPackagesQx } from '@/db/packagesDb'
812import { ok } from '@/utils/api'
@@ -30,7 +34,10 @@ export async function getPackage(req: Request, res: Response): Promise<void> {
3034 throw new NotFoundError ( )
3135 }
3236
33- const advisories = await getAdvisoriesByPackageId ( qx , pkg . id )
37+ const [ advisories , stewardshipSummary ] = await Promise . all ( [
38+ getAdvisoriesByPackageId ( qx , pkg . id ) ,
39+ pkg . stewardshipId ? getStewardshipSummary ( qx , Number ( pkg . stewardshipId ) ) : null ,
40+ ] )
3441
3542 ok ( res , {
3643 purl : pkg . purl ,
@@ -83,9 +90,12 @@ export async function getPackage(req: Request, res: Response): Promise<void> {
8390 } ,
8491 } ,
8592 stewardship : {
93+ id : pkg . stewardshipId ?? null ,
8694 status : ( pkg . stewardshipStatus ?? 'unassigned' ) as StewardshipStatus ,
87- stewards : null ,
88- lastActivityAt : null ,
95+ stewards : stewardshipSummary ?. stewards ?? null ,
96+ lastActivityAt : stewardshipSummary ?. lastActivityAt ?? null ,
97+ resolutionPath : pkg . stewardshipResolutionPath ?? null ,
98+ statusNote : pkg . stewardshipStatusNote ?? null ,
8999 } ,
90100 history : { } ,
91101 } )
0 commit comments