File tree Expand file tree Collapse file tree
src/search/infra/repositories Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { ApiRepository } from '../../../core/infra/repositories/ApiRepository'
22import { SearchService } from '../../domain/models/SearchService'
33import { ISearchServicesRepository } from '../../domain/repositories/ISearchServicesRepository'
4+ import { transformSearchServicesResponseToSearchServices } from './transformers/searchServiceTransformers'
45
56export class SearchServicesRepository extends ApiRepository implements ISearchServicesRepository {
67 public async getSearchServices ( ) : Promise < SearchService [ ] > {
7- throw new Error ( 'Method not implemented.' )
8+ return this . doGet ( `/searchServices/` )
9+ . then ( ( response ) => transformSearchServicesResponseToSearchServices ( response ) )
10+ . catch ( ( error ) => {
11+ throw error
12+ } )
813 }
914}
Original file line number Diff line number Diff line change 1+ export interface SearchServicePayload {
2+ name : string
3+ displayName : string
4+ }
Original file line number Diff line number Diff line change 1+ import { AxiosResponse } from 'axios'
2+ import { SearchService } from '../../../domain/models/SearchService'
3+ import { SearchServicePayload } from './SearchServicePayload'
4+
5+ export const transformSearchServicesResponseToSearchServices = (
6+ response : AxiosResponse
7+ ) : SearchService [ ] => {
8+ const searchServicesPayload = response . data . data
9+ const searchServices : SearchService [ ] = [ ]
10+ searchServicesPayload . forEach ( function ( searchServicePayload : SearchServicePayload ) {
11+ searchServices . push ( transformSearchServicePayloadToSearchService ( searchServicePayload ) )
12+ } )
13+
14+ return searchServices
15+ }
16+
17+ const transformSearchServicePayloadToSearchService = (
18+ searchServicePayload : SearchServicePayload
19+ ) : SearchService => {
20+ return {
21+ name : searchServicePayload . name ,
22+ displayName : searchServicePayload . displayName
23+ }
24+ }
Original file line number Diff line number Diff line change 11POSTGRES_VERSION = 13
22DATAVERSE_DB_USER = dataverse
33SOLR_VERSION = 9.8.0
4- DATAVERSE_IMAGE_REGISTRY = docker .io
4+ DATAVERSE_IMAGE_REGISTRY = ghcr .io
55DATAVERSE_IMAGE_TAG = unstable
66DATAVERSE_BOOTSTRAP_TIMEOUT = 5m
Original file line number Diff line number Diff line change 1+ import { ApiConfig } from '../../../src'
2+ import { DataverseApiAuthMechanism } from '../../../src/core/infra/repositories/ApiConfig'
3+ import { SearchServicesRepository } from '../../../src/search/infra/repositories/SearchServicesRepository'
4+ import { TestConstants } from '../../testHelpers/TestConstants'
5+
6+ // TODO
7+ describe . skip ( 'SearchServicesRepository' , ( ) => {
8+ const sut : SearchServicesRepository = new SearchServicesRepository ( )
9+
10+ afterAll ( async ( ) => {
11+ ApiConfig . init (
12+ TestConstants . TEST_API_URL ,
13+ DataverseApiAuthMechanism . API_KEY ,
14+ process . env . TEST_API_KEY
15+ )
16+ } )
17+
18+ describe ( 'getSearchServices' , ( ) => {
19+ test ( 'should return search services' , async ( ) => {
20+ const actual = await sut . getSearchServices ( )
21+ expect ( actual . length ) . toEqual ( 2 )
22+ } )
23+ } )
24+ } )
You can’t perform that action at this time.
0 commit comments