@candlerip/shared3 0.0.120 → 0.0.122
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/error-log/util.d.ts +1 -1
- package/src/backend/database/model/error-log/util.js +3 -1
- package/src/backend/database/model/translation/util.d.ts +1 -1
- package/src/backend/database/model/translation/util.js +3 -1
- package/src/backend/database/mutation/error-log/create-error-log/util.js +2 -2
- package/src/backend/database/mutation/translation/get-translations/util.js +2 -2
- package/src/backend/database/mutation/translation/get-translations-as-dictionary/util.js +2 -2
- package/src/error/custom-error/worker.js +1 -1
package/package.json
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
import * as mongoose from 'mongoose';
|
2
|
-
export declare const
|
2
|
+
export declare const getErrorLogModel: () => mongoose.Model<any, {}, {}, {}, any, any>;
|
@@ -2,4 +2,6 @@ import * as mongoose from 'mongoose';
|
|
2
2
|
const ErrorLogSchema = new mongoose.Schema({
|
3
3
|
customError: { type: mongoose.Schema.Types.Mixed },
|
4
4
|
}, { timestamps: true, versionKey: false });
|
5
|
-
export const
|
5
|
+
export const getErrorLogModel = () => {
|
6
|
+
return mongoose.models?.errorLogs || mongoose.model('errorLogs', ErrorLogSchema);
|
7
|
+
};
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import * as mongoose from 'mongoose';
|
2
|
-
export declare const
|
2
|
+
export declare const getTranslationLogModel: () => mongoose.Model<any, {}, {}, {}, any, any>;
|
@@ -4,4 +4,6 @@ const TranslationSchema = new mongoose.Schema({
|
|
4
4
|
en: { type: String },
|
5
5
|
hu: { type: String },
|
6
6
|
}, { timestamps: true, versionKey: false });
|
7
|
-
export const
|
7
|
+
export const getTranslationLogModel = () => {
|
8
|
+
return mongoose.models?.translations || mongoose.model('translations', TranslationSchema);
|
9
|
+
};
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { customErrorWorker } from '../../../../../error/index.js';
|
2
|
-
import {
|
2
|
+
import { getErrorLogModel } from '../../../model/error-log/index.js';
|
3
3
|
export const createErrorLog = async (customError) => {
|
4
4
|
let data;
|
5
5
|
const { composeCustomError } = customErrorWorker({ customError });
|
6
6
|
try {
|
7
|
-
data = await
|
7
|
+
data = await getErrorLogModel().create({ customError });
|
8
8
|
}
|
9
9
|
catch (err) {
|
10
10
|
return composeCustomError('Create error log failed', { err });
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { customErrorWorker } from '../../../../../error/index.js';
|
2
|
-
import {
|
2
|
+
import { getTranslationLogModel } from '../../../model/translation/index.js';
|
3
3
|
export const getTranslations = async (ids) => {
|
4
4
|
let query = {};
|
5
5
|
const _customErrorWorker = customErrorWorker({ ids });
|
@@ -10,7 +10,7 @@ export const getTranslations = async (ids) => {
|
|
10
10
|
}
|
11
11
|
let resp;
|
12
12
|
try {
|
13
|
-
resp = await
|
13
|
+
resp = await getTranslationLogModel().find(query);
|
14
14
|
}
|
15
15
|
catch (err) {
|
16
16
|
return _customErrorWorker.composeCustomError('Get translations failed', { err, query });
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { customErrorWorker } from '../../../../../error/index.js';
|
2
|
-
import {
|
2
|
+
import { getTranslationLogModel } from '../../../model/translation/index.js';
|
3
3
|
export const getTranslationsAsDictionary = async (language, ids) => {
|
4
4
|
const aggregates = [];
|
5
5
|
const _customErrorWorker = customErrorWorker({ ids, language });
|
@@ -40,7 +40,7 @@ export const getTranslationsAsDictionary = async (language, ids) => {
|
|
40
40
|
]);
|
41
41
|
let data;
|
42
42
|
try {
|
43
|
-
data = await
|
43
|
+
data = await getTranslationLogModel().aggregate(aggregates);
|
44
44
|
}
|
45
45
|
catch (err) {
|
46
46
|
return _customErrorWorker.composeCustomError('Get translations failed', { err });
|