File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
src/services/search-service Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ export const routes = (router: KoaRouter) => {
6060 * 500:
6161 * description: Internal server error.
6262 */
63+
64+ type SearchResultResponseContent = z . infer <
65+ typeof schemas . SearchResultSchema
66+ > [ ]
67+
6368 router . get ( '(.*)/search' , async ( ctx ) => {
6469 const metadata = generateRouteMetadata ( ctx )
6570 const queryParams = schemas . SearchQueryParamsSchema . safeParse ( ctx . query )
@@ -82,6 +87,7 @@ export const routes = (router: KoaRouter) => {
8287 ctx . status = 500
8388 return
8489 }
90+
8591 const mappedProperties = getProperties . data . map (
8692 ( property ) : schemas . PropertySearchResult => ( {
8793 id : property . id ,
@@ -100,9 +106,10 @@ export const routes = (router: KoaRouter) => {
100106
101107 ctx . body = {
102108 ...metadata ,
103- content : [ ...mappedProperties , ...mappedBuildings ] satisfies z . infer <
104- typeof schemas . SearchResultSchema
105- > [ ] ,
109+ content : [
110+ ...mappedProperties ,
111+ ...mappedBuildings ,
112+ ] satisfies SearchResultResponseContent ,
106113 }
107114 } )
108115}
You can’t perform that action at this time.
0 commit comments