@candlerip/shared 0.0.140 → 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 & {
@@ -5,10 +5,13 @@ export declare const PersonDbSchema: mongoose.Schema<any, mongoose.Model<any, an
5
5
  name?: string | null | undefined;
6
6
  createdAt?: NativeDate | null | undefined;
7
7
  images?: mongoose.Types.DocumentArray<{
8
+ _id?: unknown;
8
9
  fileName?: string | null | undefined;
9
10
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, unknown, {
11
+ _id?: unknown;
10
12
  fileName?: string | null | undefined;
11
13
  }> & {
14
+ _id?: unknown;
12
15
  fileName?: string | null | undefined;
13
16
  }> | null | undefined;
14
17
  description?: string | null | undefined;
@@ -27,10 +30,13 @@ export declare const PersonDbSchema: mongoose.Schema<any, mongoose.Model<any, an
27
30
  name?: string | null | undefined;
28
31
  createdAt?: NativeDate | null | undefined;
29
32
  images?: mongoose.Types.DocumentArray<{
33
+ _id?: unknown;
30
34
  fileName?: string | null | undefined;
31
35
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, unknown, {
36
+ _id?: unknown;
32
37
  fileName?: string | null | undefined;
33
38
  }> & {
39
+ _id?: unknown;
34
40
  fileName?: string | null | undefined;
35
41
  }> | null | undefined;
36
42
  description?: string | null | undefined;
@@ -53,10 +59,13 @@ export declare const PersonDbSchema: mongoose.Schema<any, mongoose.Model<any, an
53
59
  name?: string | null | undefined;
54
60
  createdAt?: NativeDate | null | undefined;
55
61
  images?: mongoose.Types.DocumentArray<{
62
+ _id?: unknown;
56
63
  fileName?: string | null | undefined;
57
64
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, unknown, {
65
+ _id?: unknown;
58
66
  fileName?: string | null | undefined;
59
67
  }> & {
68
+ _id?: unknown;
60
69
  fileName?: string | null | undefined;
61
70
  }> | null | undefined;
62
71
  description?: string | null | undefined;
@@ -82,10 +91,13 @@ export declare const PersonDbSchema: mongoose.Schema<any, mongoose.Model<any, an
82
91
  name?: string | null | undefined;
83
92
  createdAt?: NativeDate | null | undefined;
84
93
  images?: mongoose.Types.DocumentArray<{
94
+ _id?: unknown;
85
95
  fileName?: string | null | undefined;
86
96
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, unknown, {
97
+ _id?: unknown;
87
98
  fileName?: string | null | undefined;
88
99
  }> & {
100
+ _id?: unknown;
89
101
  fileName?: string | null | undefined;
90
102
  }> | null | undefined;
91
103
  description?: string | null | undefined;
@@ -108,10 +120,13 @@ export declare const PersonDbSchema: mongoose.Schema<any, mongoose.Model<any, an
108
120
  name?: string | null | undefined;
109
121
  createdAt?: NativeDate | null | undefined;
110
122
  images?: mongoose.Types.DocumentArray<{
123
+ _id?: unknown;
111
124
  fileName?: string | null | undefined;
112
125
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, unknown, {
126
+ _id?: unknown;
113
127
  fileName?: string | null | undefined;
114
128
  }> & {
129
+ _id?: unknown;
115
130
  fileName?: string | null | undefined;
116
131
  }> | null | undefined;
117
132
  description?: string | null | undefined;
@@ -135,10 +150,13 @@ export declare const PersonDbSchema: mongoose.Schema<any, mongoose.Model<any, an
135
150
  name?: string | null | undefined;
136
151
  createdAt?: NativeDate | null | undefined;
137
152
  images?: mongoose.Types.DocumentArray<{
153
+ _id?: {} | undefined;
138
154
  fileName?: string | null | undefined;
139
- }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, unknown, {
155
+ }, mongoose.Types.Subdocument<{}, unknown, {
156
+ _id?: {} | undefined;
140
157
  fileName?: string | null | undefined;
141
158
  }> & {
159
+ _id?: {} | undefined;
142
160
  fileName?: string | null | undefined;
143
161
  }> | null | undefined;
144
162
  description?: string | null | undefined;
@@ -22,10 +22,10 @@ export const PersonDbSchema = new mongoose.Schema({
22
22
  type: String,
23
23
  },
24
24
  images: {
25
- _id: false,
26
25
  default: undefined,
27
26
  type: [
28
27
  {
28
+ _id: false,
29
29
  fileName: {
30
30
  type: String,
31
31
  },
@@ -1,6 +1,10 @@
1
- import { CustomErrorWorker } from '../../../../../common/index.js';
1
+ import { CustomErrorWorker, DEFAULT_CANDLE_FILTER_SORT } from '../../../../../common/index.js';
2
2
  import { getCandlesDb, getPersonDb } from '../../../../mutation/index.js';
3
- export const composePersonCandlesPageDataDb = async (personId, { filterSort }) => {
3
+ export const composePersonCandlesPageDataDb = async (personId, initFilterSort) => {
4
+ const filterSort = {
5
+ ...DEFAULT_CANDLE_FILTER_SORT,
6
+ ...initFilterSort,
7
+ };
4
8
  const { composeCustomError } = CustomErrorWorker({ info: { filterSort } });
5
9
  let resp;
6
10
  resp = await getPersonDb(personId);
@@ -9,7 +13,11 @@ export const composePersonCandlesPageDataDb = async (personId, { filterSort }) =
9
13
  }
10
14
  const { data: person } = resp;
11
15
  if (!person) {
12
- return { personNotFoundError: true, customError: composeCustomError('Person not found') };
16
+ return {
17
+ personNotFoundError: composeCustomError('Person not found'),
18
+ // TODO
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ };
13
21
  }
14
22
  const { burningStates, count, skipCount, sortName, sortOrder, userId } = filterSort;
15
23
  resp = await getCandlesDb({
@@ -25,7 +33,6 @@ export const composePersonCandlesPageDataDb = async (personId, { filterSort }) =
25
33
  userId,
26
34
  });
27
35
  if ('customError' in resp) {
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
36
  return resp;
30
37
  }
31
38
  const { candles, candlesCount } = resp.data;
@@ -1,9 +1,8 @@
1
1
  import { CandleFilterSort, CustomError, PersonCandlesPageData } from '../../../../../common/index.js';
2
- export type ComposePersonCandlesPageDataDb = (personId: string, options: {
3
- filterSort: CandleFilterSort;
4
- }) => Promise<{
2
+ export type ComposePersonCandlesPageDataDb = (personId: string, filterSort?: Partial<CandleFilterSort>) => Promise<{
5
3
  data: PersonCandlesPageData;
6
4
  } | {
7
- personNotFoundError?: boolean;
5
+ personNotFoundError: CustomError;
6
+ } | {
8
7
  customError: CustomError;
9
8
  }>;
@@ -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.140",
3
+ "version": "0.0.142",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "=22.19.0"