@solidstarters/solid-core 1.2.69 → 1.2.71

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.69",
3
+ "version": "1.2.71",
4
4
  "description": "This module is a NestJS module containing all the required core providers required by a Solid application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -520,7 +520,8 @@ export class CRUDService<T> { // Add two generic value i.e Person,CreatePersonDt
520
520
  // Populate the media field entities with the full URL
521
521
  for (const mediaFieldEntity of mediaFieldEntities) {
522
522
  const mediaWithFullUrl = await this.getMediaWithFullUrl(mediaFieldEntity, mediaFieldMetadata);
523
- this.appendMediaKey(mediaFieldEntity, mediaWithFullUrl);
523
+ this.appendMediaKey(mediaWithFullUrl, mediaFieldEntity, mediaFieldMetadata.name);
524
+ // mediaFieldEntity['_media'][mediaFieldPath] = mediaWithFullUrl
524
525
  }
525
526
  }
526
527
  else {
@@ -530,18 +531,21 @@ export class CRUDService<T> { // Add two generic value i.e Person,CreatePersonDt
530
531
  throw new BadRequestException(`Media field ${mediaFieldPath} not found in model ${this.modelName}`);
531
532
  }
532
533
  const mediaWithFullUrl = await this.getMediaWithFullUrl(entity, mediaFieldMetadata);
533
- this.appendMediaKey(entity, mediaWithFullUrl);
534
+ this.appendMediaKey(mediaWithFullUrl, entity, mediaFieldPath);
535
+ // entity['_media'][mediaFieldPath] = mediaWithFullUrl;
534
536
  }
535
537
  }
536
538
 
537
- // Add the media with full URL to the entity
538
- private appendMediaKey(entity: T, mediaWithFullUrl: MediaWithFullUrl[]) {
539
+ // // Add the media with full URL to the entity
540
+ private appendMediaKey(mediaWithFullUrl: MediaWithFullUrl[], entity: T, mediaFieldPath: string) {
539
541
  // if _media key already exists, append the new media to the existing array
540
542
  if (entity['_media']) {
541
- entity['_media'] = [...entity['_media'], ...mediaWithFullUrl];
543
+ entity['_media'][mediaFieldPath] = mediaWithFullUrl;
542
544
  }
543
545
  else {
544
- entity['_media'] = mediaWithFullUrl;
546
+ entity['_media'] = {
547
+ [mediaFieldPath]: mediaWithFullUrl
548
+ };
545
549
  }
546
550
  }
547
551