@hedhog/admin 0.0.106 → 0.0.107

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"locale.service.d.ts","sourceRoot":"","sources":["../../src/locale/locale.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,aAAa;IAKtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IANpC,OAAO,CAAC,KAAK,CAAW;gBAIL,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE;IA0B1B,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;IAiEvE,WAAW,CAAC,MAAM,EAAE,MAAM;;;;;IAWpB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAwCrD,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;IA0D1D,SAAS,CAAC,IAAI,EAAE,MAAM;IAStB,OAAO,CAAC,QAAQ,EAAE,MAAM;IAMxB,MAAM,CAAC,IAAI,EAAE,SAAS;IAMtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;IAgB/B,OAAO,CAAC,wBAAwB;IAM1B,qBAAqB,CAAC,CAAC,EAC3B,SAAS,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AS;IAMtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;IAgB/B,OAAO,CAAC,wBAAwB;IAM1B,qBAAqB,CAAC,CAAC,EAC3B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAiD1B,qBAAqB,CAAC,CAAC,SAAS,GAAG,EACvC,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAsCjC"}
@@ -221,15 +221,17 @@ let LocaleService = class LocaleService {
221
221
  const model = await this.prismaService[modelName].create({
222
222
  data,
223
223
  });
224
- for (const localeCode of Object.keys(locale)) {
225
- const locale = await this.getByCode(localeCode);
226
- const data = {};
227
- for (const key of Object.keys(locale[localeCode])) {
228
- data[key] = locale[localeCode][key];
224
+ if (locale) {
225
+ for (const localeCode of Object.keys(locale)) {
226
+ const locale = await this.getByCode(localeCode);
227
+ const data = {};
228
+ for (const key of Object.keys(locale[localeCode])) {
229
+ data[key] = locale[localeCode][key];
230
+ }
231
+ await this.prismaService[this.getTableNameTranslations(modelName)].create({
232
+ data: Object.assign({ [foreginKeyName]: model.id, locale_id: locale.id }, data),
233
+ });
229
234
  }
230
- await this.prismaService[this.getTableNameTranslations(modelName)].create({
231
- data: Object.assign({ [foreginKeyName]: model.id, locale_id: locale.id }, data),
232
- });
233
235
  }
234
236
  return this.prismaService[modelName].findUnique({
235
237
  where: { id: model.id },
@@ -252,22 +254,24 @@ let LocaleService = class LocaleService {
252
254
  });
253
255
  }
254
256
  async updateModelWithLocale(modelName, foreginKeyName, id, data, locale) {
255
- for (const localeCode of Object.keys(locale)) {
256
- const locale = await this.getByCode(localeCode);
257
- const data = {};
258
- for (const key of Object.keys(locale[localeCode])) {
259
- data[key] = locale[localeCode][key];
260
- }
261
- await this.prismaService[this.getTableNameTranslations(modelName)].upsert({
262
- where: {
263
- [`${foreginKeyName}_locale_id`]: {
264
- [foreginKeyName]: id,
265
- locale_id: locale.id,
257
+ if (locale) {
258
+ for (const localeCode of Object.keys(locale)) {
259
+ const locale = await this.getByCode(localeCode);
260
+ const data = {};
261
+ for (const key of Object.keys(locale[localeCode])) {
262
+ data[key] = locale[localeCode][key];
263
+ }
264
+ await this.prismaService[this.getTableNameTranslations(modelName)].upsert({
265
+ where: {
266
+ [`${foreginKeyName}_locale_id`]: {
267
+ [foreginKeyName]: id,
268
+ locale_id: locale.id,
269
+ },
266
270
  },
267
- },
268
- create: Object.assign({ [foreginKeyName]: id, locale_id: locale.id }, data),
269
- update: Object.assign({}, data),
270
- });
271
+ create: Object.assign({ [foreginKeyName]: id, locale_id: locale.id }, data),
272
+ update: Object.assign({}, data),
273
+ });
274
+ }
271
275
  }
272
276
  return this.prismaService[modelName].update({
273
277
  where: { id },
@@ -1 +1 @@
1
- {"version":3,"file":"locale.service.js","sourceRoot":"","sources":["../../src/locale/locale.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGxB,YAEE,aAA6C,EAE7C,iBAAqD;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;QAN/C,UAAK,GAAQ,EAAE,CAAC;IAOrB,CAAC;IAEJ,KAAK,CAAC,UAAU,CAAC,KAAe;QAC9B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,4BAAmB,CAAC,yCAAyC,CAAC,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AAY,CAAC,EAAE;4BAC/B,CAAC,cAAc,CAAC,EAAE,EAAE;4BACpB,SAAS,EAAE,MAAM,CAAC,EAAE;yBACrB;qBACF;oBACD,MAAM,kBACJ,CAAC,cAAc,CAAC,EAAE,EAAE,EACpB,SAAS,EAAE,MAAM,CAAC,EAAE,IACjB,IAAI,CACR;oBACD,MAAM,oBACD,IAAI,CACR;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;YAC1C,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AApWY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAP5C,aAAa,CAoWzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/admin",
3
- "version": "0.0.106",
3
+ "version": "0.0.107",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -281,24 +281,26 @@ export class LocaleService {
281
281
  data,
282
282
  });
283
283
 
284
- for (const localeCode of Object.keys(locale)) {
285
- const locale = await this.getByCode(localeCode);
284
+ if (locale) {
285
+ for (const localeCode of Object.keys(locale)) {
286
+ const locale = await this.getByCode(localeCode);
286
287
 
287
- const data: any = {};
288
+ const data: any = {};
288
289
 
289
- for (const key of Object.keys(locale[localeCode])) {
290
- data[key] = locale[localeCode][key];
291
- }
290
+ for (const key of Object.keys(locale[localeCode])) {
291
+ data[key] = locale[localeCode][key];
292
+ }
292
293
 
293
- await this.prismaService[this.getTableNameTranslations(modelName)].create(
294
- {
294
+ await this.prismaService[
295
+ this.getTableNameTranslations(modelName)
296
+ ].create({
295
297
  data: {
296
298
  [foreginKeyName]: model.id,
297
299
  locale_id: locale.id,
298
300
  ...data,
299
301
  },
300
- },
301
- );
302
+ });
303
+ }
302
304
  }
303
305
 
304
306
  return this.prismaService[modelName].findUnique({
@@ -329,17 +331,19 @@ export class LocaleService {
329
331
  data: T,
330
332
  locale: Record<string, string>,
331
333
  ) {
332
- for (const localeCode of Object.keys(locale)) {
333
- const locale = await this.getByCode(localeCode);
334
+ if (locale) {
335
+ for (const localeCode of Object.keys(locale)) {
336
+ const locale = await this.getByCode(localeCode);
334
337
 
335
- const data: any = {};
338
+ const data: any = {};
336
339
 
337
- for (const key of Object.keys(locale[localeCode])) {
338
- data[key] = locale[localeCode][key];
339
- }
340
+ for (const key of Object.keys(locale[localeCode])) {
341
+ data[key] = locale[localeCode][key];
342
+ }
340
343
 
341
- await this.prismaService[this.getTableNameTranslations(modelName)].upsert(
342
- {
344
+ await this.prismaService[
345
+ this.getTableNameTranslations(modelName)
346
+ ].upsert({
343
347
  where: {
344
348
  [`${foreginKeyName}_locale_id`]: {
345
349
  [foreginKeyName]: id,
@@ -354,8 +358,8 @@ export class LocaleService {
354
358
  update: {
355
359
  ...data,
356
360
  },
357
- },
358
- );
361
+ });
362
+ }
359
363
  }
360
364
 
361
365
  return this.prismaService[modelName].update({