File tree Expand file tree Collapse file tree 4 files changed +11
-5
lines changed
Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ const debug = Debug('otomi:api:v1:apps')
1111export const getApps = ( req : OpenApiRequestExt , res : Response ) : void => {
1212 const { teamId } = req . params
1313 const { picks } = req . query
14- res . json ( req . otomi . getApps ( teamId , picks as string [ ] ) )
14+ // Handle comma-separated string or array
15+ const picksArray = typeof picks === 'string' ? picks . split ( ',' ) : ( picks as string [ ] )
16+ res . json ( req . otomi . getApps ( teamId , picksArray ) )
1517}
1618
1719/**
Original file line number Diff line number Diff line change @@ -10,8 +10,10 @@ const debug = Debug('otomi:api:v1:settings')
1010 */
1111export const getSettings = ( req : OpenApiRequestExt , res : Response ) : void => {
1212 const { ids } = req . query
13- debug ( `getSettings(${ ids } )` )
14- const v = req . otomi . getSettings ( ids as string [ ] | undefined )
13+ // Handle comma-separated string or array
14+ const idsArray = ids ? ( typeof ids === 'string' ? ids . split ( ',' ) : ( ids as string [ ] ) ) : undefined
15+ debug ( `getSettings(${ idsArray } )` )
16+ const v = req . otomi . getSettings ( idsArray )
1517 if ( v ?. otomi ) {
1618 const { otomi : otomiSettings , ...restSettings } = v
1719 // Remove the otomi.adminPassword from otomi settings response
Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ export async function initApp(inOtomiStack?: OtomiStack) {
212212 apiSpec : path . join ( __dirname , 'generated-schema.json' ) ,
213213 validateRequests : {
214214 allowUnknownQueryParameters : false ,
215- coerceTypes : true , // Equivalent to enableObjectCoercion
215+ coerceTypes : 'array' ,
216216 } ,
217217 validateResponses : false , // Start with false, can enable later for debugging
218218 validateSecurity : {
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ import { getSessionStack } from './session'
2121export async function groupAuthzSecurityHandler ( req : Request , scopes : string [ ] , schema : any ) : Promise < boolean > {
2222 const extReq = req as OpenApiRequestExt
2323
24- // JWT middleware already ran and set req.user if token was valid
24+ // In dev mode, JWT middleware sets a mock user without requiring Authorization header
25+ // In production, JWT middleware sets req.user only if valid token exists
26+ // Allow requests to proceed if user was set by JWT middleware
2527 if ( ! extReq . user ) {
2628 throw { status : 401 , message : 'Unauthorized - No valid JWT token provided' }
2729 }
You can’t perform that action at this time.
0 commit comments