@candlerip/shared 0.0.148 → 0.0.149
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.
- package/database/aggregate/index.d.ts +0 -1
- package/database/aggregate/index.js +0 -1
- package/database/mutation/candle-lighting-profile/get-candle-lighting-profile-db/compose-aggregates/index.d.ts +2 -0
- package/database/mutation/candle-lighting-profile/get-candle-lighting-profile-db/compose-aggregates/index.js +19 -0
- package/database/mutation/candle-lighting-profile/get-candle-lighting-profile-db/compose-aggregates/type.d.ts +3 -0
- package/database/mutation/candle-lighting-profile/get-candle-lighting-profile-db/index.js +23 -0
- package/database/mutation/candle-lighting-profile/get-candle-lighting-profile-db/type.d.ts +10 -0
- package/database/mutation/candle-lighting-profile/{utils/get-candle-lighting-profiles-db → get-candle-lighting-profiles-db}/index.js +2 -2
- package/database/mutation/candle-lighting-profile/{utils/get-candle-lighting-profiles-db → get-candle-lighting-profiles-db}/type.d.ts +1 -1
- package/database/mutation/candle-lighting-profile/index.d.ts +2 -1
- package/database/mutation/candle-lighting-profile/index.js +2 -1
- package/database/mutation/country/utils/get-country-db/index.js +1 -1
- package/package.json +1 -1
- package/database/aggregate/candle-lighting-profile/index.d.ts +0 -1
- package/database/aggregate/candle-lighting-profile/index.js +0 -1
- package/database/aggregate/candle-lighting-profile/utils/compose-get-lighting-profile-aggregates/index.d.ts +0 -2
- package/database/aggregate/candle-lighting-profile/utils/compose-get-lighting-profile-aggregates/index.js +0 -10
- package/database/aggregate/candle-lighting-profile/utils/compose-get-lighting-profile-aggregates/type.d.ts +0 -2
- package/database/aggregate/candle-lighting-profile/utils/index.d.ts +0 -1
- package/database/aggregate/candle-lighting-profile/utils/index.js +0 -1
- package/database/mutation/candle-lighting-profile/utils/get-candle-lighting-profile-db/index.js +0 -22
- package/database/mutation/candle-lighting-profile/utils/get-candle-lighting-profile-db/type.d.ts +0 -6
- package/database/mutation/candle-lighting-profile/utils/index.d.ts +0 -2
- package/database/mutation/candle-lighting-profile/utils/index.js +0 -2
- /package/database/{aggregate/candle-lighting-profile/utils/compose-get-lighting-profile-aggregates → mutation/candle-lighting-profile/get-candle-lighting-profile-db/compose-aggregates}/type.js +0 -0
- /package/database/mutation/candle-lighting-profile/{utils/get-candle-lighting-profile-db → get-candle-lighting-profile-db}/index.d.ts +0 -0
- /package/database/mutation/candle-lighting-profile/{utils/get-candle-lighting-profile-db → get-candle-lighting-profile-db}/type.js +0 -0
- /package/database/mutation/candle-lighting-profile/{utils/get-candle-lighting-profiles-db → get-candle-lighting-profiles-db}/index.d.ts +0 -0
- /package/database/mutation/candle-lighting-profile/{utils/get-candle-lighting-profiles-db → get-candle-lighting-profiles-db}/type.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isBoolean } from '../../../../../common/index.js';
|
|
2
|
+
export const composeAggregates = ({ code, isDefault }) => {
|
|
3
|
+
const aggregates = [];
|
|
4
|
+
if (code) {
|
|
5
|
+
aggregates.push({
|
|
6
|
+
$match: {
|
|
7
|
+
code,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (isBoolean(isDefault)) {
|
|
12
|
+
aggregates.push({
|
|
13
|
+
$match: {
|
|
14
|
+
isDefault,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return aggregates;
|
|
19
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getCandleLightingProfileDbModel } from '../../../model/index.js';
|
|
2
|
+
import { composeAggregates } from './compose-aggregates/index.js';
|
|
3
|
+
import { composeCustomError } from '../../../../common/index.js';
|
|
4
|
+
export const getCandleLightingProfileDb = async (props) => {
|
|
5
|
+
let resp;
|
|
6
|
+
const aggregates = composeAggregates(props);
|
|
7
|
+
try {
|
|
8
|
+
resp = await getCandleLightingProfileDbModel().aggregate(aggregates);
|
|
9
|
+
}
|
|
10
|
+
catch (err) {
|
|
11
|
+
return {
|
|
12
|
+
customError: composeCustomError('Get candle lighting profile failed', { err, props }),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (!resp || resp.length === 0) {
|
|
16
|
+
return {
|
|
17
|
+
data: null,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
data: resp[0],
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CandleLightingProfile, CustomError } from '../../../../common/index.js';
|
|
2
|
+
export type GetCandleLightingProfileDb = (props: GetCandleLightingProfileDbProps) => Promise<{
|
|
3
|
+
data: CandleLightingProfile | null;
|
|
4
|
+
} | {
|
|
5
|
+
customError: CustomError;
|
|
6
|
+
}>;
|
|
7
|
+
export type GetCandleLightingProfileDbProps = {
|
|
8
|
+
code?: number;
|
|
9
|
+
isDefault?: boolean;
|
|
10
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CustomErrorWorker } from '
|
|
2
|
-
import { getCandleLightingProfileDbModel } from '
|
|
1
|
+
import { CustomErrorWorker } from '../../../../common/index.js';
|
|
2
|
+
import { getCandleLightingProfileDbModel } from '../../../model/index.js';
|
|
3
3
|
export const getCandleLightingProfilesDb = async () => {
|
|
4
4
|
const { composeCustomError } = CustomErrorWorker();
|
|
5
5
|
let data;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './get-candle-lighting-profile-db/index.js';
|
|
2
|
+
export * from './get-candle-lighting-profiles-db/index.js';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './get-candle-lighting-profile-db/index.js';
|
|
2
|
+
export * from './get-candle-lighting-profiles-db/index.js';
|
|
@@ -10,7 +10,7 @@ export const getCountryDb = async (code, options) => {
|
|
|
10
10
|
resp = await getCountryDbModel().aggregate(aggregates);
|
|
11
11
|
}
|
|
12
12
|
catch (err) {
|
|
13
|
-
return { customError: composeCustomError('Get
|
|
13
|
+
return { customError: composeCustomError('Get country failed', { err }) };
|
|
14
14
|
}
|
|
15
15
|
if (!resp || resp.length === 0) {
|
|
16
16
|
return {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './utils/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './utils/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './compose-get-lighting-profile-aggregates/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './compose-get-lighting-profile-aggregates/index.js';
|
package/database/mutation/candle-lighting-profile/utils/get-candle-lighting-profile-db/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { composeGetCandleLightingProfileAggregates } from '../../../../aggregate/index.js';
|
|
2
|
-
import { getCandleLightingProfileDbModel } from '../../../../model/index.js';
|
|
3
|
-
import { CustomErrorWorker } from '../../../../../common/index.js';
|
|
4
|
-
export const getCandleLightingProfileDb = async (code) => {
|
|
5
|
-
let resp;
|
|
6
|
-
const { composeCustomError } = CustomErrorWorker({ info: { code } });
|
|
7
|
-
const aggregates = composeGetCandleLightingProfileAggregates(code);
|
|
8
|
-
try {
|
|
9
|
-
resp = await getCandleLightingProfileDbModel().aggregate(aggregates);
|
|
10
|
-
}
|
|
11
|
-
catch (err) {
|
|
12
|
-
return { customError: composeCustomError('Get candle lighting profile failed', { err }) };
|
|
13
|
-
}
|
|
14
|
-
if (!resp || resp.length === 0) {
|
|
15
|
-
return {
|
|
16
|
-
data: null,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
data: resp[0],
|
|
21
|
-
};
|
|
22
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|