@@ -40,13 +40,6 @@ export class CmsArchiveCategoriesService {
40
40
) ;
41
41
}
42
42
43
- async getCategoryWithXml ( categoryKey : string ) : Promise < CmsCategoryDocument | null > {
44
- return this . client . getDocument < CmsCategoryDocument > ( {
45
- index : this . index ,
46
- id : categoryKey ,
47
- } ) ;
48
- }
49
-
50
43
getRootCategories ( ) : CmsCategoryListItem [ ] {
51
44
return this . rootCategories ;
52
45
}
@@ -55,6 +48,13 @@ export class CmsArchiveCategoriesService {
55
48
return this . categoriesMap . get ( categoryKey ) ;
56
49
}
57
50
51
+ async getCategoryFull ( categoryKey : string ) : Promise < CmsCategoryDocument | null > {
52
+ return this . client . getDocument < CmsCategoryDocument > ( {
53
+ index : this . index ,
54
+ id : categoryKey ,
55
+ } ) ;
56
+ }
57
+
58
58
getCategories ( categoryKeys : string [ ] ) : CmsCategoryListItem [ ] {
59
59
return categoryKeys . reduce < CmsCategoryListItem [ ] > ( ( acc , key ) => {
60
60
const category = this . categoriesMap . get ( key ) ;
@@ -81,7 +81,10 @@ export class CmsArchiveCategoriesService {
81
81
if ( category . superKey ) {
82
82
category . path = this . resolveCategoryPath ( category . superKey ) ;
83
83
}
84
+ category . categories . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
84
85
} ) ;
86
+
87
+ this . rootCategories . sort ( ( a , b ) => a . title . localeCompare ( b . title ) ) ;
85
88
}
86
89
87
90
resolveCategoryPath ( categoryKey : string , path : CmsCategoryPath = [ ] ) : CmsCategoryPath {
@@ -93,7 +96,7 @@ export class CmsArchiveCategoriesService {
93
96
94
97
const { key, superKey, title } = category ;
95
98
96
- path . push ( {
99
+ path . unshift ( {
97
100
key,
98
101
name : title ,
99
102
} ) ;
0 commit comments