Skip to content

Commit d2ea176

Browse files
authored
Handle deprecated registryOfDialects sorting key (#3278)
1 parent d5d9d93 commit d2ea176

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/components/language/language.repository.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
merge,
3636
oncePerProject,
3737
paginate,
38+
propSorter,
3839
rankSens,
3940
requestingUser,
4041
sortWith,
@@ -371,6 +372,9 @@ export const languageSorters = defineSorters(Language, {
371372
node('node', 'EthnologueLanguage'),
372373
])
373374
.apply(sortWith(ethnologueSorters, input)),
375+
['registryOfDialectsCode' as any]: propSorter(
376+
'registryOfLanguageVarietiesCode',
377+
),
374378
});
375379

376380
const ethnologueSorters = defineSorters(EthnologueLanguage, {});

src/core/database/query/sorting.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ export const defineSorters = <TResourceStatic extends ResourceShape<any>>(
140140

141141
const baseNodeProps = resource.BaseNodeProps ?? Resource.Props;
142142
const isBaseNodeProp = baseNodeProps.includes(sort);
143-
const matcher = (isBaseNodeProp ? matchBasePropSort : matchPropSort)(sort);
143+
const matcher = (isBaseNodeProp ? basePropSorter : propSorter)(sort);
144144
return { ...common, matcher };
145145
};
146146
fn.matchers = matchers;
147147
return fn;
148148
};
149149

150-
const matchPropSort = (prop: string) => (query: Query) =>
150+
export const propSorter = (prop: string) => (query: Query) =>
151151
query
152152
.match([
153153
node('node'),
@@ -156,7 +156,7 @@ const matchPropSort = (prop: string) => (query: Query) =>
156156
])
157157
.return<SortCol>('sortProp.value as sortValue');
158158

159-
const matchBasePropSort = (prop: string) => (query: Query) =>
159+
export const basePropSorter = (prop: string) => (query: Query) =>
160160
query.return<SortCol>(`node.${prop} as sortValue`);
161161

162162
export interface SortCol {

0 commit comments

Comments
 (0)