@nkhang1902/strapi-plugin-export-import-clsx 1.7.1 → 1.7.3

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.1",
3
+ "version": "1.7.3",
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,6 +331,22 @@ module.exports = ({ strapi }) => ({
330
331
  ];
331
332
  const ALLOWED_OBJECT_FIELDS = [];
332
333
 
334
+ //Get current live-link url
335
+ var liveLinkUrl = `${process.env.PREVIEW_URL}/download`;
336
+ if (data.length !== 0) {
337
+ const event = await strapi.documents("api::event.event").findOne({
338
+ filters: {
339
+ id: {
340
+ $eq: data[0].event.id,
341
+ },
342
+ },
343
+ populate: "liveLink",
344
+ });
345
+ liveLinkUrl = liveLinkUrl + `/${event.liveLink.slug}`;
346
+ } else {
347
+ liveLinkUrl = liveLinkUrl + `/live-link`;
348
+ }
349
+
333
350
  for (const [contentType, entries] of Object.entries(data)) {
334
351
  // Clean sheet name (Excel has restrictions)
335
352
  const sheetName = contentType
@@ -384,7 +401,7 @@ module.exports = ({ strapi }) => ({
384
401
  const value = obj[key];
385
402
 
386
403
  if (key === "documentId" && ["corporate", "investor", "vip-guest"].includes(contentType.split(".")[1])) {
387
- result["liveLink"] = `${process.env.PREVIEW_URL}/download/live-link?participantId=${value}`;
404
+ result["liveLink"] = `${liveLinkUrl}?participantId=${value}`;
388
405
  continue
389
406
  }
390
407
  if (SYSTEM_KEYS.includes(key)) continue;