@@ -85,12 +85,12 @@ export class CopilotOpportunityService {
8585 * Admin/manager responses also include minimal project metadata for v5 compatibility.
8686 *
8787 * @param query Pagination, sort, and noGrouping parameters.
88- * @param user Authenticated JWT user.
88+ * @param user Authenticated JWT user, or undefined for anonymous `@Public()` callers .
8989 * @returns Paginated opportunity response payload.
9090 */
9191 async listOpportunities (
9292 query : ListOpportunitiesQueryDto ,
93- user : JwtUser ,
93+ user : JwtUser | undefined ,
9494 ) : Promise < PaginatedOpportunityResponse > {
9595 // TODO [SECURITY]: No permission check is applied here; this is intentional for authenticated browsing and should remain explicitly documented.
9696 const [ sortField , sortDirection ] = parseSortExpression (
@@ -160,14 +160,14 @@ export class CopilotOpportunityService {
160160 * Admin/manager responses also include minimal project metadata for v5 compatibility.
161161 *
162162 * @param opportunityId Opportunity id path value.
163- * @param user Authenticated JWT user.
163+ * @param user Authenticated JWT user, or undefined for anonymous `@Public()` callers .
164164 * @returns One formatted opportunity response.
165165 * @throws BadRequestException If id is non-numeric.
166166 * @throws NotFoundException If opportunity does not exist.
167167 */
168168 async getOpportunity (
169169 opportunityId : string ,
170- user : JwtUser ,
170+ user : JwtUser | undefined ,
171171 ) : Promise < CopilotOpportunityResponseDto > {
172172 // TODO [SECURITY]: No permission check is applied; any authenticated user can access any opportunity by id.
173173 const parsedOpportunityId = parseNumericId ( opportunityId , 'Opportunity' ) ;
@@ -208,7 +208,7 @@ export class CopilotOpportunityService {
208208 ) ;
209209
210210 const canApplyAsCopilot =
211- user . userId && user . userId . trim ( ) . length > 0
211+ user ? .userId && user . userId . trim ( ) . length > 0
212212 ? ! members . includes ( user . userId )
213213 : true ;
214214
@@ -622,9 +622,9 @@ export class CopilotOpportunityService {
622622 */
623623 private async getMembershipProjectIds (
624624 opportunities : CopilotOpportunity [ ] ,
625- user : JwtUser ,
625+ user : JwtUser | undefined ,
626626 ) : Promise < Set < string > > {
627- if ( ! user . userId || ! / ^ \d + $ / . test ( user . userId ) ) {
627+ if ( ! user ? .userId || ! / ^ \d + $ / . test ( user . userId ) ) {
628628 return new Set < string > ( ) ;
629629 }
630630
0 commit comments