@nkhang1902/strapi-plugin-export-import-clsx 1.7.2 → 1.7.4

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": "@nkhang1902/strapi-plugin-export-import-clsx",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "description": "A powerful Strapi plugin for exporting and importing data with Excel support and advanced filtering",
5
5
  "main": "./strapi-server.js",
6
6
  "scripts": {
@@ -295,6 +295,7 @@ module.exports = ({ strapi }) => ({
295
295
  },
296
296
 
297
297
  async convertToExcel(data) {
298
+ console.log(data);
298
299
  const workbook = new ExcelJS.Workbook();
299
300
  let hasData = false;
300
301
 
@@ -330,22 +331,6 @@ module.exports = ({ strapi }) => ({
330
331
  ];
331
332
  const ALLOWED_OBJECT_FIELDS = [];
332
333
 
333
- //Get current live-link url
334
- var liveLinkUrl = `${process.env.PREVIEW_URL}/download`;
335
- if (data.length !== 0) {
336
- const event = await strapi.documents("api::event.event").findOne({
337
- filters: {
338
- id: {
339
- $eq: data[0].event.id,
340
- },
341
- },
342
- populate: "liveLink",
343
- });
344
- liveLinkUrl = liveLinkUrl + `/${event.liveLink.slug}`;
345
- } else {
346
- liveLinkUrl = liveLinkUrl + `/live-link`;
347
- }
348
-
349
334
  for (const [contentType, entries] of Object.entries(data)) {
350
335
  // Clean sheet name (Excel has restrictions)
351
336
  const sheetName = contentType
@@ -357,6 +342,24 @@ module.exports = ({ strapi }) => ({
357
342
  if (entries && entries.length > 0) {
358
343
  hasData = true;
359
344
 
345
+ //Get current live-link url
346
+ var liveLinkUrl = `${process.env.PREVIEW_URL}/download`;
347
+ if (["corporate", "investor", "vip-guest"].includes(contentType.split(".")[1])) {
348
+ const event = await strapi.documents("api::event.event").findOne({
349
+ filters: {
350
+ id: {
351
+ $eq: entries[0].event.id,
352
+ },
353
+ },
354
+ populate: "liveLink",
355
+ });
356
+ if (event.liveLink) {
357
+ liveLinkUrl = liveLinkUrl + `/${event.liveLink.slug}`;
358
+ } else {
359
+ liveLinkUrl = liveLinkUrl + `/live-link`;
360
+ }
361
+ }
362
+
360
363
  const attr = strapi.contentTypes[contentType].attributes;
361
364
  const customFields = Object.entries(attr)
362
365
  .filter(([key, definition]) => definition.customField)