@candlerip/shared3 0.0.168 → 0.0.170
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/backend/database/model/candle/candle-db-schema.d.ts +3 -3
- package/src/backend/page/page-data/candles/compose-candles-page-data/index.js +1 -1
- package/src/backend/page/page-data/candles/type.d.ts +1 -1
- package/src/backend/page/page-data/home/compose-home-page-data/index.js +1 -0
- package/src/backend/page/page-data/home/type.d.ts +1 -0
- package/src/backend/page/page-data/index.d.ts +1 -0
- package/src/backend/page/page-data/index.js +1 -0
- package/src/backend/page/page-data/person-candles/compose-person-candles-page-data/index.d.ts +2 -0
- package/src/backend/page/page-data/person-candles/compose-person-candles-page-data/index.js +35 -0
- package/src/backend/page/page-data/person-candles/compose-person-candles-page-data/type.d.ts +9 -0
- package/src/backend/page/page-data/person-candles/index.d.ts +2 -0
- package/src/backend/page/page-data/person-candles/index.js +2 -0
- package/src/backend/page/page-data/person-candles/type.d.ts +12 -0
- package/src/backend/page/page-data/person-candles/type.js +1 -0
- package/src/backend/server/server-data/candles/compose-candles-page-server-data/index.js +8 -7
- package/src/backend/server/server-data/candles/compose-candles-page-server-data/type.d.ts +3 -2
- package/src/backend/server/server-data/home/{compose-candles-page-server-data → compose-home-page-server-data}/index.js +7 -7
- package/src/backend/server/server-data/home/{compose-candles-page-server-data → compose-home-page-server-data}/type.d.ts +3 -2
- package/src/backend/server/server-data/home/compose-home-page-server-data/type.js +1 -0
- package/src/backend/server/server-data/home/index.d.ts +1 -1
- package/src/backend/server/server-data/home/index.js +1 -1
- package/src/backend/server/server-data/index.d.ts +1 -0
- package/src/backend/server/server-data/index.js +1 -0
- package/src/backend/server/server-data/person-candles/compose-person-candles-page-server-data/index.d.ts +2 -0
- package/src/backend/server/server-data/person-candles/compose-person-candles-page-server-data/index.js +28 -0
- package/src/backend/server/server-data/person-candles/compose-person-candles-page-server-data/type.d.ts +13 -0
- package/src/backend/server/server-data/person-candles/compose-person-candles-page-server-data/type.js +1 -0
- package/src/backend/server/server-data/person-candles/index.d.ts +2 -0
- package/src/backend/server/server-data/person-candles/index.js +2 -0
- package/src/backend/server/server-data/person-candles/type.d.ts +6 -0
- package/src/backend/server/server-data/person-candles/type.js +1 -0
- /package/src/backend/{server/server-data/home/compose-candles-page-server-data → page/page-data/person-candles/compose-person-candles-page-data}/type.js +0 -0
- /package/src/backend/server/server-data/home/{compose-candles-page-server-data → compose-home-page-server-data}/index.d.ts +0 -0
package/package.json
CHANGED
@@ -9,8 +9,8 @@ export declare const CandleDbSchema: mongoose.Schema<any, mongoose.Model<any, an
|
|
9
9
|
litName?: string | null | undefined;
|
10
10
|
burningEndsAt?: NativeDate | null | undefined;
|
11
11
|
personId?: mongoose.Types.ObjectId | null | undefined;
|
12
|
-
burningMinutes?: number | null | undefined;
|
13
12
|
description?: string | null | undefined;
|
13
|
+
burningMinutes?: number | null | undefined;
|
14
14
|
userId?: string | null | undefined;
|
15
15
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
16
16
|
createdAt: NativeDate;
|
@@ -19,8 +19,8 @@ export declare const CandleDbSchema: mongoose.Schema<any, mongoose.Model<any, an
|
|
19
19
|
litName?: string | null | undefined;
|
20
20
|
burningEndsAt?: NativeDate | null | undefined;
|
21
21
|
personId?: mongoose.Types.ObjectId | null | undefined;
|
22
|
-
burningMinutes?: number | null | undefined;
|
23
22
|
description?: string | null | undefined;
|
23
|
+
burningMinutes?: number | null | undefined;
|
24
24
|
userId?: string | null | undefined;
|
25
25
|
}>> & mongoose.FlatRecord<{
|
26
26
|
createdAt: NativeDate;
|
@@ -29,8 +29,8 @@ export declare const CandleDbSchema: mongoose.Schema<any, mongoose.Model<any, an
|
|
29
29
|
litName?: string | null | undefined;
|
30
30
|
burningEndsAt?: NativeDate | null | undefined;
|
31
31
|
personId?: mongoose.Types.ObjectId | null | undefined;
|
32
|
-
burningMinutes?: number | null | undefined;
|
33
32
|
description?: string | null | undefined;
|
33
|
+
burningMinutes?: number | null | undefined;
|
34
34
|
userId?: string | null | undefined;
|
35
35
|
}> & {
|
36
36
|
_id: mongoose.Types.ObjectId;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { composeCustomError } from '../../../../../error/index.js';
|
2
|
+
import { getCandles, getPerson } from '../../../../database/index.js';
|
3
|
+
export const composePersonCandlesPageData = async (personId, filterSort) => {
|
4
|
+
let resp;
|
5
|
+
resp = await getPerson({ _id: personId });
|
6
|
+
if ('customError' in resp) {
|
7
|
+
return resp;
|
8
|
+
}
|
9
|
+
const { data: person } = resp;
|
10
|
+
if (!person) {
|
11
|
+
return {
|
12
|
+
customError: composeCustomError('Person not found'),
|
13
|
+
personNotFoundError: true,
|
14
|
+
};
|
15
|
+
}
|
16
|
+
resp = await getCandles({
|
17
|
+
filterSort,
|
18
|
+
});
|
19
|
+
if ('customError' in resp) {
|
20
|
+
return resp;
|
21
|
+
}
|
22
|
+
const { candles, candlesCount } = resp.data;
|
23
|
+
return {
|
24
|
+
data: {
|
25
|
+
addCandle: {
|
26
|
+
person,
|
27
|
+
},
|
28
|
+
candlesList: {
|
29
|
+
candles,
|
30
|
+
candlesCount,
|
31
|
+
renderDate: new Date(),
|
32
|
+
},
|
33
|
+
},
|
34
|
+
};
|
35
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { CustomError } from '../../../../../error/index.js';
|
2
|
+
import { CandleFilterSort } from '../../../../../filter-sort/index.js';
|
3
|
+
import { PersonCandlesPageData } from '../type.js';
|
4
|
+
export type ComposePersonCandlesPageData = (personId: string, filterSort: CandleFilterSort) => Promise<{
|
5
|
+
data: PersonCandlesPageData;
|
6
|
+
} | {
|
7
|
+
customError: CustomError;
|
8
|
+
personNotFoundError?: boolean;
|
9
|
+
}>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Candle } from '../../../../candle/index.js';
|
2
|
+
import { Person } from '../../../../person/index.js';
|
3
|
+
export interface PersonCandlesPageData {
|
4
|
+
addCandle: {
|
5
|
+
person: Person;
|
6
|
+
};
|
7
|
+
candlesList: {
|
8
|
+
candles: Candle[];
|
9
|
+
candlesCount: number;
|
10
|
+
renderDate: Date;
|
11
|
+
};
|
12
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,23 +1,24 @@
|
|
1
|
-
import { DICTIONARY_CONFIG } from '../../../../../dictionary/index.js';
|
2
1
|
import { DEFAULT_CANDLE_FILTER_SORT } from '../../../../../filter-sort/index.js';
|
3
|
-
import {
|
2
|
+
import { composeDictionary } from '../../../../dictionary/index.js';
|
4
3
|
import { composeCandlesPageData } from '../../../../page/index.js';
|
5
|
-
export const composeCandlesPageServerData = async (
|
4
|
+
export const composeCandlesPageServerData = async (language, options) => {
|
5
|
+
const excludedTranslationIdOptions = options?.excludedTranslationIdOptions;
|
6
|
+
const initFilterSort = options?.filterSort;
|
6
7
|
const filterSort = {
|
7
8
|
...DEFAULT_CANDLE_FILTER_SORT,
|
8
9
|
...initFilterSort,
|
9
10
|
};
|
10
11
|
let resp;
|
11
|
-
resp = await
|
12
|
+
resp = await composeCandlesPageData({ filterSort });
|
12
13
|
if ('customError' in resp) {
|
13
14
|
return resp;
|
14
15
|
}
|
15
|
-
const
|
16
|
-
resp = await
|
16
|
+
const pageData = resp.data;
|
17
|
+
resp = await composeDictionary('candles-page', language, { excludedTranslationIdOptions });
|
17
18
|
if ('customError' in resp) {
|
18
19
|
return resp;
|
19
20
|
}
|
20
|
-
const
|
21
|
+
const dictionary = resp.data;
|
21
22
|
return {
|
22
23
|
data: {
|
23
24
|
dictionary,
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import { Language } from '../../../../../dictionary/index.js';
|
2
2
|
import { CustomError } from '../../../../../error/index.js';
|
3
3
|
import { CandleFilterSort } from '../../../../../filter-sort/index.js';
|
4
|
+
import { ExcludedTranslationIdOptions } from '../../../../dictionary/index.js';
|
4
5
|
import { CandlesPageServerData } from '../type.js';
|
5
|
-
export type ComposeCandlesPageServerData = (
|
6
|
+
export type ComposeCandlesPageServerData = (language: Language, options?: {
|
7
|
+
excludedTranslationIdOptions?: ExcludedTranslationIdOptions;
|
6
8
|
filterSort?: Partial<CandleFilterSort>;
|
7
|
-
language: Language;
|
8
9
|
}) => Promise<{
|
9
10
|
data: CandlesPageServerData;
|
10
11
|
} | {
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
import { getTranslationsAsDictionary } from '../../../../database/index.js';
|
1
|
+
import { composeDictionary } from '../../../../dictionary/index.js';
|
3
2
|
import { composeHomePageData } from '../../../../page/index.js';
|
4
|
-
export const composeHomePageServerData = async (
|
3
|
+
export const composeHomePageServerData = async (language, options) => {
|
4
|
+
const excludedTranslationIdOptions = options?.excludedTranslationIdOptions;
|
5
5
|
let resp;
|
6
|
-
resp = await
|
6
|
+
resp = await composeHomePageData();
|
7
7
|
if ('customError' in resp) {
|
8
8
|
return resp;
|
9
9
|
}
|
10
|
-
const
|
11
|
-
resp = await
|
10
|
+
const pageData = resp.data;
|
11
|
+
resp = await composeDictionary('home-page', language, { excludedTranslationIdOptions });
|
12
12
|
if ('customError' in resp) {
|
13
13
|
return resp;
|
14
14
|
}
|
15
|
-
const
|
15
|
+
const dictionary = resp.data;
|
16
16
|
return {
|
17
17
|
data: {
|
18
18
|
dictionary,
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { Language } from '../../../../../dictionary/index.js';
|
2
2
|
import { CustomError } from '../../../../../error/index.js';
|
3
|
+
import { ExcludedTranslationIdOptions } from '../../../../dictionary/index.js';
|
3
4
|
import { HomePageServerData } from '../type.js';
|
4
|
-
export type ComposeHomePageServerData = (
|
5
|
-
|
5
|
+
export type ComposeHomePageServerData = (language: Language, options?: {
|
6
|
+
excludedTranslationIdOptions?: ExcludedTranslationIdOptions;
|
6
7
|
}) => Promise<{
|
7
8
|
data: HomePageServerData;
|
8
9
|
} | {
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from './compose-
|
1
|
+
export * from './compose-home-page-server-data/index.js';
|
2
2
|
export * from './type.js';
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from './compose-
|
1
|
+
export * from './compose-home-page-server-data/index.js';
|
2
2
|
export * from './type.js';
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { DEFAULT_CANDLE_FILTER_SORT } from '../../../../../filter-sort/index.js';
|
2
|
+
import { composeDictionary } from '../../../../dictionary/index.js';
|
3
|
+
import { composePersonCandlesPageData } from '../../../../page/index.js';
|
4
|
+
export const composePersonCandlesPageServerData = async (language, personId, options) => {
|
5
|
+
const excludedTranslationIdOptions = options?.excludedTranslationIdOptions;
|
6
|
+
const initFilterSort = options?.filterSort;
|
7
|
+
const filterSort = {
|
8
|
+
...DEFAULT_CANDLE_FILTER_SORT,
|
9
|
+
...initFilterSort,
|
10
|
+
};
|
11
|
+
let resp;
|
12
|
+
resp = await composePersonCandlesPageData(personId, filterSort);
|
13
|
+
if ('customError' in resp) {
|
14
|
+
return resp;
|
15
|
+
}
|
16
|
+
const pageData = resp.data;
|
17
|
+
resp = await composeDictionary('person-candles-page', language, { excludedTranslationIdOptions });
|
18
|
+
if ('customError' in resp) {
|
19
|
+
return resp;
|
20
|
+
}
|
21
|
+
const dictionary = resp.data;
|
22
|
+
return {
|
23
|
+
data: {
|
24
|
+
dictionary,
|
25
|
+
pageData,
|
26
|
+
},
|
27
|
+
};
|
28
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Language } from '../../../../../dictionary/index.js';
|
2
|
+
import { CustomError } from '../../../../../error/index.js';
|
3
|
+
import { CandleFilterSort } from '../../../../../filter-sort/index.js';
|
4
|
+
import { ExcludedTranslationIdOptions } from '../../../../dictionary/index.js';
|
5
|
+
import { PersonCandlesPageServerData } from '../type.js';
|
6
|
+
export type ComposePersonCandlesPageServerData = (language: Language, personId: string, options?: {
|
7
|
+
excludedTranslationIdOptions?: ExcludedTranslationIdOptions;
|
8
|
+
filterSort?: Partial<CandleFilterSort>;
|
9
|
+
}) => Promise<{
|
10
|
+
data: PersonCandlesPageServerData;
|
11
|
+
} | {
|
12
|
+
customError: CustomError;
|
13
|
+
}>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
File without changes
|