@candlerip/shared 0.0.141 → 0.0.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,6 @@
1
- import { CountryDictionary } from '../../dictionary/index.js';
2
1
  import { PersonFilterSort } from '../../filter-sort/index.js';
3
2
  import { Person } from '../../person/index.js';
4
3
  export interface PersonsPageData {
5
- placeOfBirthsCountryDictionary?: CountryDictionary;
6
4
  filterSort: PersonFilterSort;
7
5
  personsList: {
8
6
  persons: Array<Person & {
@@ -1,9 +1,12 @@
1
+ import { DEFAULT_PERSON_FILTER_SORT } from '../../../../common/index.js';
1
2
  import { getPersonsDb } from '../../../mutation/index.js';
2
- import { getCountryTranslationsAsDictionaryDb } from '../../../mutation/country-translation/index.js';
3
- export const composePersonsPageDataDb = async ({ filterSort, language }) => {
3
+ export const composePersonsPageDataDb = async (initFilterSort) => {
4
+ const filterSort = {
5
+ ...DEFAULT_PERSON_FILTER_SORT,
6
+ ...initFilterSort,
7
+ };
4
8
  const { count, name, isNameCaseSensitive, placeOfBirths, skipCount, sortName, sortOrder, userId, withPhoto } = filterSort;
5
- let resp;
6
- resp = await getPersonsDb({
9
+ const resp = await getPersonsDb({
7
10
  count,
8
11
  name,
9
12
  isNameCaseSensitive,
@@ -19,17 +22,8 @@ export const composePersonsPageDataDb = async ({ filterSort, language }) => {
19
22
  return resp;
20
23
  }
21
24
  const { personsCount, persons } = resp.data;
22
- let placeOfBirthsCountryDictionary;
23
- if (filterSort.placeOfBirths) {
24
- resp = await getCountryTranslationsAsDictionaryDb(language, filterSort.placeOfBirths);
25
- if ('customError' in resp) {
26
- return resp;
27
- }
28
- placeOfBirthsCountryDictionary = resp.data;
29
- }
30
25
  return {
31
26
  data: {
32
- placeOfBirthsCountryDictionary,
33
27
  filterSort,
34
28
  personsList: {
35
29
  personsCount,
@@ -1,8 +1,5 @@
1
- import { CustomError, Language, PersonFilterSort, PersonsPageData } from '../../../../common/index.js';
2
- export type ComposePersonsPageDataDb = (props: {
3
- filterSort: PersonFilterSort;
4
- language: Language;
5
- }) => Promise<{
1
+ import { CustomError, PersonFilterSort, PersonsPageData } from '../../../../common/index.js';
2
+ export type ComposePersonsPageDataDb = (filterSort?: PersonFilterSort) => Promise<{
6
3
  data: PersonsPageData;
7
4
  } | {
8
5
  customError: CustomError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candlerip/shared",
3
- "version": "0.0.141",
3
+ "version": "0.0.142",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "=22.19.0"