@@ -5,6 +5,7 @@ import { ValueOf } from 'type-fest';
5
5
import { ID , NotFoundException , ServerException , Session } from '~/common' ;
6
6
import { ResourceMap , ResourceResolver , ResourcesHost } from '~/core/resources' ;
7
7
import { Privileges } from '../authorization' ;
8
+ import { LanguageService } from '../language' ;
8
9
import { PartnerService } from '../partner' ;
9
10
import {
10
11
SearchableMap ,
@@ -38,6 +39,10 @@ export class SearchService {
38
39
...( await this . partners . readOnePartnerByOrgId ( ...args ) ) ,
39
40
__typename : 'Partner' ,
40
41
} ) ,
42
+ LanguageByEth : async ( ...args ) => ( {
43
+ ...( await this . languages . readOneByEthId ( ...args ) ) ,
44
+ __typename : 'Language' ,
45
+ } ) ,
41
46
} ;
42
47
/* eslint-enable @typescript-eslint/naming-convention */
43
48
@@ -46,6 +51,7 @@ export class SearchService {
46
51
private readonly resourceResolver : ResourceResolver ,
47
52
private readonly privileges : Privileges ,
48
53
private readonly partners : PartnerService ,
54
+ private readonly languages : LanguageService ,
49
55
private readonly repo : SearchRepository ,
50
56
) { }
51
57
@@ -70,6 +76,7 @@ export class SearchService {
70
76
const resourceTypes = new Set < keyof ResourceMap > ( types ) ;
71
77
// Include dependency types for types that have identifiers in sub-resources.
72
78
types . has ( 'Partner' ) && resourceTypes . add ( 'Organization' ) ;
79
+ types . has ( 'Language' ) && resourceTypes . add ( 'EthnologueLanguage' ) ;
73
80
74
81
// Search for nodes based on input, only returning their id and "type"
75
82
// which is based on their first valid search label.
@@ -106,6 +113,13 @@ export class SearchService {
106
113
: [ ] ) ,
107
114
] ;
108
115
}
116
+ if ( result . type === 'EthnologueLanguage' ) {
117
+ return {
118
+ type : 'LanguageByEth' ,
119
+ id : result . id ,
120
+ matchedProps : [ 'ethnologue' ] ,
121
+ } as const ;
122
+ }
109
123
110
124
// This is a sanity/type check.
111
125
// Functionally, we shouldn't have any results at this point that
0 commit comments