You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so I think, the SDK also requires logic to generate queries in the format mentioned above for array values.
URLSearchParams provides a way to generate such queries using the following approach.
newURLSearchParams([['key1','value1'],['key2','value2'],['key1','value3']]);// key1=value1&key2=value2&key1=value3// in express, query.key1 is ['value1', 'value3'], query.key2 is 'value2'
The following code is my proposed solution.
exportfunctionpath(status: Array<string>,methods: Array<string>,pg_providers: Array<string>,query: IPayment.FindManyQuery): string{constquerys: string[][]=[];constvariables={
...query,// this value is object type
status,// this value is string[]
methods,// this value is string[]
pg_providers,// this value is string[]};for(const[key,value]ofObject.entries(variables)){if(Array.isArray(value)){value.forEach(v=>querys.push([key,v]));}elseif(value!==undefined){querys.push([key,valueasstring]);}}constencoded: string=newURLSearchParams(querys).toString();return`/payments?${encoded}`;}}
The text was updated successfully, but these errors were encountered:
express는 쿼리 값에 대해 같은 키로 전달되면 배열형태로 전달합니다.
하지만 현재 nestia sdk는 쿼리키에 대해 복수의 값을 전달할 수 없습니다.
URLSearchParams는 인자로 string[][] 타입을 전달받을 수 있고, 이 경우 내부 배열의 첫 요소는 key, 두번째 요소는 value가 됩니다.ex) [ [key, value], [key, value] ]
그래서 이를 위해 sdk 쿼리 생성 로직을 아래처럼 변경하는 것을 제안합니다.
The express module supports array format for query parameters.
example)
query: https:example.com?item=1&item=2&item=3
=> express.Request.query.item = ['1', '2', '3']
so I think, the SDK also requires logic to generate queries in the format mentioned above for array values.
URLSearchParams provides a way to generate such queries using the following approach.
The following code is my proposed solution.
The text was updated successfully, but these errors were encountered: