@candlerip/shared3 0.0.120 → 0.0.121

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candlerip/shared3",
3
- "version": "0.0.120",
3
+ "version": "0.0.121",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.js",
@@ -1,2 +1,2 @@
1
1
  import * as mongoose from 'mongoose';
2
- export declare const ErrorLogModel: mongoose.Model<any, {}, {}, {}, any, any>;
2
+ export declare const getErrorLogModel: () => mongoose.Model<any, {}, {}, {}, any, any>;
@@ -1,5 +1,7 @@
1
1
  import * as mongoose from 'mongoose';
2
- const ErrorLogSchema = new mongoose.Schema({
3
- customError: { type: mongoose.Schema.Types.Mixed },
4
- }, { timestamps: true, versionKey: false });
5
- export const ErrorLogModel = mongoose.models?.errorLogs || mongoose.model('errorLogs', ErrorLogSchema);
2
+ export const getErrorLogModel = () => {
3
+ const ErrorLogSchema = new mongoose.Schema({
4
+ customError: { type: mongoose.Schema.Types.Mixed },
5
+ }, { timestamps: true, versionKey: false });
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 TranslationDbModel: mongoose.Model<any, {}, {}, {}, any, any>;
2
+ export declare const getTranslationLogModel: () => mongoose.Model<any, {}, {}, {}, any, any>;
@@ -1,7 +1,9 @@
1
1
  import * as mongoose from 'mongoose';
2
- const TranslationSchema = new mongoose.Schema({
3
- id: { type: String },
4
- en: { type: String },
5
- hu: { type: String },
6
- }, { timestamps: true, versionKey: false });
7
- export const TranslationDbModel = mongoose.models?.translations || mongoose.model('translations', TranslationSchema);
2
+ export const getTranslationLogModel = () => {
3
+ const TranslationSchema = new mongoose.Schema({
4
+ id: { type: String },
5
+ en: { type: String },
6
+ hu: { type: String },
7
+ }, { timestamps: true, versionKey: false });
8
+ return mongoose.models?.translations || mongoose.model('translations', TranslationSchema);
9
+ };
@@ -1,10 +1,10 @@
1
1
  import { customErrorWorker } from '../../../../../error/index.js';
2
- import { ErrorLogModel } from '../../../model/error-log/index.js';
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 ErrorLogModel.create({ customError });
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 { TranslationDbModel } from '../../../model/translation/index.js';
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 TranslationDbModel.find(query);
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 { TranslationDbModel } from '../../../model/translation/index.js';
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 TranslationDbModel.aggregate(aggregates);
43
+ data = await getTranslationLogModel().aggregate(aggregates);
44
44
  }
45
45
  catch (err) {
46
46
  return _customErrorWorker.composeCustomError('Get translations failed', { err });