From f7c60d730a30aac3a5dc66b6d5e02e9462e09c96 Mon Sep 17 00:00:00 2001 From: sinatragianpaolo Date: Tue, 18 Jun 2024 15:30:19 +0200 Subject: [PATCH] refactor(get-campaigns-campaign-ux): remove insights and videopart --- src/reference/openapi.yml | 209 ------------------ src/routes/campaigns/campaignId/ux/UxData.ts | 188 +--------------- .../campaigns/campaignId/ux/_get/data.spec.ts | 163 -------------- .../ux/_get/deleted-clusters.spec.ts | 51 ----- .../campaignId/ux/_get/draft-modified.spec.ts | 112 +--------- .../campaigns/campaignId/ux/_get/index.ts | 1 - src/schema.ts | 25 --- 7 files changed, 9 insertions(+), 740 deletions(-) diff --git a/src/reference/openapi.yml b/src/reference/openapi.yml index 8551835d3..3c78f6e4c 100644 --- a/src/reference/openapi.yml +++ b/src/reference/openapi.yml @@ -2820,79 +2820,6 @@ paths: type: string usersNumber: type: integer - insights: - type: array - items: - type: object - properties: - id: - type: integer - title: - type: string - severity: - type: object - required: - - id - - name - properties: - id: - type: integer - name: - type: string - description: - type: string - clusters: - oneOf: - - type: string - enum: - - all - - type: array - items: - type: object - properties: - id: - type: integer - name: - type: string - required: - - id - - name - videoParts: - type: array - items: - type: object - properties: - id: - type: integer - start: - type: number - end: - type: number - mediaId: - type: integer - url: - type: string - streamUrl: - type: string - description: - type: string - poster: - type: string - required: - - id - - start - - end - - mediaId - - url - - streamUrl - - description - required: - - id - - title - - severity - - description - - clusters - - videoParts sentiments: type: array items: @@ -2970,41 +2897,6 @@ paths: name: Usability Test description: Methodology Description type: qualitative - insights: - - id: 1 - title: My insight - description: This is an insight - severity: - id: 1 - name: Minor - clusters: all - videoParts: - - id: 1 - start: 10 - end: 20 - mediaId: 1 - url: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4' - streamUrl: 'http://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8' - description: This is a video part - - id: 2 - title: My second insight - description: This is another insight - severity: - id: 2 - name: Positive - clusters: - - id: 1 - name: 'UC1: Cart' - - id: 2 - name: 'UC2: Login' - videoParts: - - id: 2 - start: 15 - end: 25 - mediaId: 2 - url: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4' - streamUrl: 'http://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8' - description: This is a video part sentiments: - id: 1 value: 5 @@ -3032,41 +2924,6 @@ paths: name: Usability Test description: Methodology Description type: quantitative - insights: - - id: 1 - title: My insight - description: This is an insight - severity: - id: 1 - name: Minor - clusters: all - videoParts: - - id: 1 - start: 10 - end: 20 - mediaId: 1 - url: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4' - streamUrl: 'http://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8' - description: This is a video part - - id: 2 - title: My second insight - description: This is another insight - severity: - id: 2 - name: Positive - clusters: - - id: 1 - name: 'UC1: Cart' - - id: 2 - name: 'UC2: Login' - videoParts: - - id: 2 - start: 15 - end: 25 - mediaId: 2 - url: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4' - streamUrl: 'http://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8' - description: This is a video part sentiments: - id: 1 value: 5 @@ -3100,72 +2957,6 @@ paths: name: UX Challenge description: UX Challenge type: qualitative - insights: - - id: 70 - title: Malfunzionamento form - description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tellus lorem, maximus sit amet fermentum ac, venenatis eu sapien. In hac habitasse platea dictumst.' - clusters: - - id: 1 - name: UC 1 - Carrello - severity: - id: 1 - name: Minor - videoParts: - - id: 250 - start: 0 - mediaId: 73579 - end: 97 - description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tellus lorem, maximus sit amet fermentum ac, venenatis eu sapien' - url: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T58918/713c9be296e4fb76d0b074947bbe9a56b2807000_1666111033.mp4' - streamUrl: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T58918/713c9be296e4fb76d0b074947bbe9a56b2807000_1666111033-stream.m3u8' - - id: 251 - start: 22 - mediaId: 73577 - end: 101 - description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' - url: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T8208/bfc341707a8a3c247926aee8d4efe14f06f5165d_1666101262.mp4' - streamUrl: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T8208/bfc341707a8a3c247926aee8d4efe14f06f5165d_1666101262-stream.m3u8' - - id: 252 - start: 0 - mediaId: 73578 - end: 152 - description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' - url: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T11291/91d3f36562a4d2be809c9b1217f591b317f928b4_1666108920.mp4' - streamUrl: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T11291/91d3f36562a4d2be809c9b1217f591b317f928b4_1666108920-stream.m3u8' - - id: 71 - title: Difficoltà di navigazione - description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' - clusters: - - id: 2 - name: UC 2 - Profilo - severity: - id: 1 - name: Minor - videoParts: - - id: 253 - start: 0 - mediaId: 73580 - end: 102 - description: Lorem ipsum dolor sit amet - url: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T960/19ebc32b3d71e4a3f2858eea298761d44db5d83b_1666112983.mp4' - streamUrl: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T960/19ebc32b3d71e4a3f2858eea298761d44db5d83b_1666112983-stream.m3u8' - - id: 72 - title: Criticità Pagina Prodotto - description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tellus lorem, maximus sit amet fermentum ac, venenatis eu sapien. In hac habitasse platea dictumst. Etiam sodales nibh turpis, at condimentum arcu vehicula eget. Donec sollicitudin dapibus ' - clusters: - - id: 1 - name: UC 1 - Carrello - severity: - id: 2 - name: Major - videoParts: - - id: 254 - start: 0 - mediaId: 73589 - end: 106 - description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tellus lorem, maximus sit amet fermentum ac, venenatis eu sapien. In hac habitasse platea dictumst. Etiam sodales nibh turpis,' - url: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T17968/0af496e75fb6ec367749d1c34a2f9a0dec0f2b4a_1666121805.mp4' - streamUrl: 'https://s3-eu-west-1.amazonaws.com/appq.use-case-media/CP4845/UC19595/T17968/0af496e75fb6ec367749d1c34a2f9a0dec0f2b4a_1666121805-stream.m3u8' sentiments: [] questions: - id: 1 diff --git a/src/routes/campaigns/campaignId/ux/UxData.ts b/src/routes/campaigns/campaignId/ux/UxData.ts index 689319aa0..609858e74 100644 --- a/src/routes/campaigns/campaignId/ux/UxData.ts +++ b/src/routes/campaigns/campaignId/ux/UxData.ts @@ -23,30 +23,6 @@ export default class UxData { } | undefined; - private _findings: { - id: number; - finding_id: number; - campaign_id: number; - version: number; - title: string; - description: string; - severity_id: number; - cluster_ids: string; - order: number; - }[] = []; - - private _videoParts: { - id: number; - media_id: number; - insight_id: number; - start: number; - end: number; - description: string; - location: string; - streamUrl: string; - poster?: string; - }[] = []; - private _questions: { id: number; campaign_id: number; @@ -71,19 +47,13 @@ export default class UxData { if (!data) return { data: undefined }; - const findings = await this.getFindings({ version: data.version }); const clusters = await this.getClusters(); - const findingsIds = findings.map((f) => f.id); - const videoParts = findingsIds.length - ? await this.getVideoParts(findingsIds) - : []; - const questions = await this.getQuestions({ version: data.version }); const sentiments = await this.getSentiments({ version: data.version }); - return { data, findings, clusters, videoParts, questions, sentiments }; + return { data, clusters, questions, sentiments }; } private async getSentiments({ version }: { version: number }) { @@ -107,27 +77,6 @@ export default class UxData { .orderBy("version", "DESC"); } - private async getVideoParts(findingsIds: number[]) { - return await tryber.tables.UxCampaignVideoParts.do() - .select( - tryber.ref("id").withSchema("ux_campaign_video_parts"), - "media_id", - "start", - "end", - "description", - "location", - "insight_id" - ) - .join( - "wp_appq_user_task_media", - "wp_appq_user_task_media.id", - "ux_campaign_video_parts.media_id" - ) - .whereIn("insight_id", findingsIds) - .where("location", "like", "%.mp4") - .orderBy("order", "asc"); - } - private async getUxData({ published }: { published: number }) { return await tryber.tables.UxCampaignData.do() .select() @@ -152,88 +101,30 @@ export default class UxData { .orderBy("version", "DESC"); } - private async getFindings({ version }: { version: number }) { - const result = await tryber.tables.UxCampaignInsights.do() - .select() - .where({ - campaign_id: this.campaignId, - version, - }) - .where({ enabled: 1 }) - .orderBy("order", "asc"); - return await this.filterDeletedClusters(result); - } - public async lastPublished() { - const { data, findings, clusters, videoParts, questions, sentiments } = - await this.getOne({ - published: 1, - }); + const { data, clusters, questions, sentiments } = await this.getOne({ + published: 1, + }); - if (findings) this._findings = findings; if (clusters) this._clusters = clusters; - if (videoParts) this._videoParts = await this.verifyUrls(videoParts); if (questions) this._questions = questions; if (sentiments) this._sentiments = sentiments; this._data = data; } public async lastDraft() { - const { data, findings, clusters, videoParts, questions, sentiments } = - await this.getOne({ - published: 0, - }); + const { data, clusters, questions, sentiments } = await this.getOne({ + published: 0, + }); if (!data) return; this._data = data; - if (findings) this._findings = findings; if (clusters) this._clusters = clusters; - if (videoParts) this._videoParts = await this.verifyUrls(videoParts); if (questions) this._questions = questions; if (sentiments) this._sentiments = sentiments; } - private async filterDeletedClusters( - findings: { - id: number; - finding_id: number; - campaign_id: number; - version: number; - title: string; - description: string; - severity_id: number; - cluster_ids: string; - order: number; - }[] - ) { - let res = []; - - // Get all cluster ids - const clusterIds = await this.getClusterIds(); - //remove deleted clusters from findings - for (const f of findings) { - const fClusterIds = f.cluster_ids.split(",").map(Number); - const validClusterIds = fClusterIds.filter((c) => clusterIds.includes(c)); - if (f.cluster_ids === "0") res.push(f); - else if (validClusterIds.length) { - res.push({ ...f, cluster_ids: validClusterIds.join(",") }); - } - } - - return res; - } - - private async getClusterIds() { - const results = await tryber.tables.WpAppqUsecaseCluster.do() - .where({ campaign_id: this.campaignId }) - .select("id"); - - if (!results.length) return []; - - return results.map((c) => c.id); - } - get version() { return this._data?.version; } @@ -243,49 +134,11 @@ export default class UxData { const { id: i, version: v, published: p, ...data } = this._data; return { ...data, - - findings: this.findings, questions: this.questions, sentiments: this.sentiments, }; } - get findings() { - return this._findings.map((f) => { - const severityName = - f.severity_id in this.SEVERITIES - ? this.SEVERITIES[f.severity_id as keyof typeof this.SEVERITIES] - : "Unknown"; - - const videoParts = this._videoParts.filter((v) => v.insight_id === f.id); - - return { - id: f.id, - title: f.title, - description: f.description, - clusters: evaluateClusters(this._clusters), - severity: { id: f.severity_id, name: severityName }, - videoParts: videoParts.map((v) => ({ - id: v.id, - start: v.start, - mediaId: v.media_id, - end: v.end, - description: v.description, - url: v.location, - streamUrl: v.streamUrl, - poster: v.poster, - })), - findingId: f.finding_id, - }; - - function evaluateClusters(clusters: { id: number; name: string }[]) { - if (f.cluster_ids === "0") return "all" as const; - const clusterIds = f.cluster_ids.split(",").map(Number); - return clusters.filter((c) => clusterIds.includes(c.id)); - } - }); - } - get questions() { return this._questions.map((q) => ({ id: q.id, @@ -310,33 +163,6 @@ export default class UxData { return true; } - async verifyUrls( - videoParts: { - id: number; - media_id: number; - insight_id: number; - start: number; - end: number; - description: string; - location: string; - }[] - ) { - const video = []; - for (const v of videoParts) { - const stream = v.location.replace(".mp4", "-stream.m3u8"); - const isValidStream = await checkUrl(stream); - const poster = v.location.replace(".mp4", ".0000000.jpg"); - const isValidPoster = await checkUrl(poster); - video.push({ - ...v, - location: this.mapToDistribution(v.location), - streamUrl: isValidStream ? this.mapToDistribution(stream) : "", - poster: isValidPoster ? this.mapToDistribution(poster) : undefined, - }); - } - return video; - } - private mapToDistribution(url: string) { return mapToDistribution(url); } diff --git a/src/routes/campaigns/campaignId/ux/_get/data.spec.ts b/src/routes/campaigns/campaignId/ux/_get/data.spec.ts index 6c7ebb5b9..5928296e5 100644 --- a/src/routes/campaigns/campaignId/ux/_get/data.spec.ts +++ b/src/routes/campaigns/campaignId/ux/_get/data.spec.ts @@ -56,56 +56,6 @@ describe("GET /campaigns/{campaignId}/ux - data", () => { goal: "This is the goal of the reasearch", users: 100, }); - await tryber.tables.UxCampaignInsights.do().insert([ - { - id: 1, - campaign_id: 1, - version: 1, - title: "Test Insight", - description: "Test Description", - severity_id: 1, - cluster_ids: "1,2", - order: 1, - finding_id: 10, - enabled: 1, - }, - { - id: 2, - campaign_id: 1, - version: 1, - title: "Test Insight All Cluster", - description: "Test Description All Cluster", - severity_id: 1, - cluster_ids: "0", - order: 0, - finding_id: 20, - enabled: 1, - }, - { - id: 3, - campaign_id: 1, - version: 1, - title: "Test Insight Disabled", - description: "Test Description Disabled", - severity_id: 1, - cluster_ids: "0", - order: 0, - finding_id: 30, - enabled: 0, - }, - { - id: 4, - campaign_id: 2, - version: 1, - title: "Test Insight Other CP", - description: "Test Description Other CP", - severity_id: 1, - cluster_ids: "0", - order: 0, - finding_id: 40, - enabled: 1, - }, - ]); await tryber.tables.WpAppqUsecaseCluster.do().insert([ { id: 1, @@ -127,15 +77,6 @@ describe("GET /campaigns/{campaignId}/ux - data", () => { }, ]); - await tryber.tables.UxCampaignVideoParts.do().insert({ - id: 1, - insight_id: 1, - start: 0, - end: 10, - order: 0, - media_id: 1, - description: "Test Description", - }); await tryber.tables.WpAppqUserTaskMedia.do().insert({ id: 1, campaign_task_id: 1, @@ -189,116 +130,12 @@ describe("GET /campaigns/{campaignId}/ux - data", () => { await tryber.tables.WpAppqEvdCampaign.do().delete(); await tryber.tables.UxCampaignData.do().delete(); await tryber.tables.WpAppqCampaignType.do().delete(); - await tryber.tables.UxCampaignInsights.do().delete(); await tryber.tables.WpAppqUsecaseCluster.do().delete(); - await tryber.tables.UxCampaignVideoParts.do().delete(); await tryber.tables.WpAppqUserTaskMedia.do().delete(); await tryber.tables.UxCampaignQuestions.do().delete(); await tryber.tables.UxCampaignSentiments.do().delete(); }); - it("Should return all the enabled findings", async () => { - const response = await request(app) - .get("/campaigns/1/ux") - .set("Authorization", "Bearer admin"); - expect(response.body).toHaveProperty("insights"); - expect(response.body.insights).toHaveLength(2); - expect(response.body.insights[0]).toEqual( - expect.objectContaining({ - title: "Test Insight All Cluster", - description: "Test Description All Cluster", - severity: expect.objectContaining({ - id: 1, - name: "Minor", - }), - clusters: "all", - videoParts: expect.arrayContaining([]), - }) - ); - expect(response.body.insights[1]).toEqual( - expect.objectContaining({ - title: "Test Insight", - description: "Test Description", - severity: expect.objectContaining({ - id: 1, - name: "Minor", - }), - clusters: [ - expect.objectContaining({ - id: 1, - name: "Test Cluster", - }), - expect.objectContaining({ - id: 2, - name: "Test Cluster 2", - }), - ], - videoParts: expect.arrayContaining([]), - }) - ); - }); - - it("Should return all findings of a specific Campaign", async () => { - const response = await request(app) - .get("/campaigns/1/ux") - .set("Authorization", "Bearer admin"); - expect(response.body).toHaveProperty("insights"); - expect(response.body.insights).toHaveLength(2); - expect(response.body.insights).toEqual( - expect.arrayContaining([ - expect.not.objectContaining({ - id: 4, - }), - ]) - ); - }); - - it("Should return the correct ids for each finding", async () => { - const response = await request(app) - .get("/campaigns/1/ux") - .set("Authorization", "Bearer admin"); - expect(response.body).toHaveProperty("insights"); - expect(response.body.insights).toHaveLength(2); - expect(response.body.insights).toEqual( - expect.arrayContaining([ - expect.objectContaining({ - id: 1, - }), - expect.objectContaining({ - id: 2, - }), - ]) - ); - }); - - it("Should return all the video part in a finding", async () => { - const response = await request(app) - .get("/campaigns/1/ux") - .set("Authorization", "Bearer admin"); - expect(response.body).toHaveProperty("insights"); - expect(response.body.insights).toHaveLength(2); - expect(response.body.insights[1]).toEqual( - expect.objectContaining({ - id: 1, - videoParts: expect.arrayContaining([]), - }) - ); - expect(response.body.insights[1].videoParts).toHaveLength(1); - expect(response.body.insights[1].videoParts[0]).toEqual( - expect.objectContaining({ - start: 0, - end: 10, - description: "Test Description", - mediaId: 1, - url: "https://s3.eu-west-1.amazonaws.com/appq.static/ad4fc347f2579800a1920a8be6e181dda0f4b290_1692791543.mp4", - streamUrl: - "https://s3.eu-west-1.amazonaws.com/appq.static/ad4fc347f2579800a1920a8be6e181dda0f4b290_1692791543-stream.m3u8", - poster: - "https://s3.eu-west-1.amazonaws.com/appq.static/ad4fc347f2579800a1920a8be6e181dda0f4b290_1692791543.0000000.jpg", - }) - ); - }); - it("Should return the questions", async () => { const response = await request(app) .get("/campaigns/1/ux") diff --git a/src/routes/campaigns/campaignId/ux/_get/deleted-clusters.spec.ts b/src/routes/campaigns/campaignId/ux/_get/deleted-clusters.spec.ts index 0e9b8d2ad..ae7afa2b7 100644 --- a/src/routes/campaigns/campaignId/ux/_get/deleted-clusters.spec.ts +++ b/src/routes/campaigns/campaignId/ux/_get/deleted-clusters.spec.ts @@ -186,60 +186,9 @@ describe("With draft only", () => { await tryber.tables.WpAppqEvdCampaign.do().delete(); await tryber.tables.WpAppqUsecaseCluster.do().delete(); await tryber.tables.UxCampaignData.do().delete(); - await tryber.tables.UxCampaignInsights.do().delete(); await tryber.tables.UxCampaignSentiments.do().delete(); }); - it("Should not return findings of a deleted clusters", async () => { - const response = await request(app) - .get(`/campaigns/1/ux`) - .set("Authorization", "Bearer admin"); - - expect(response.body.insights.length).toEqual(4); - - expect(response.body.insights).toEqual( - expect.arrayContaining([ - expect.objectContaining({ - id: 1, - }), - expect.objectContaining({ - id: 2, - }), - expect.objectContaining({ - id: 3, - }), - expect.objectContaining({ - id: 6, - }), - ]) - ); - }); - - it("Should remove deleted cluster on returning findings", async () => { - const response = await request(app) - .get(`/campaigns/1/ux`) - .set("Authorization", "Bearer admin"); - - expect(response.body.insights.length).toEqual(4); - expect(response.body.insights).toEqual( - expect.arrayContaining([ - expect.objectContaining({ - id: 1, - }), - expect.objectContaining({ - id: 2, - }), - expect.objectContaining({ - id: 3, - }), - expect.objectContaining({ - id: 6, - clusters: [{ id: 1, name: "Cluster 1" }], - }), - ]) - ); - }); - it("Should return the sentiments if exist the cluster", async () => { const response = await request(app) .get(`/campaigns/1/ux`) diff --git a/src/routes/campaigns/campaignId/ux/_get/draft-modified.spec.ts b/src/routes/campaigns/campaignId/ux/_get/draft-modified.spec.ts index ce287b4e5..29e393f7a 100644 --- a/src/routes/campaigns/campaignId/ux/_get/draft-modified.spec.ts +++ b/src/routes/campaigns/campaignId/ux/_get/draft-modified.spec.ts @@ -30,7 +30,7 @@ const campaign = { customer_title: "Test Customer", }; -describe("GET /campaigns/{campaignId}/ux - draft modified - insight", () => { +describe("GET /campaigns/{campaignId}/ux - draft modified", () => { beforeAll(async () => { await tryber.tables.WpAppqEvdCampaign.do().insert([ { ...campaign, id: 1, campaign_type_id: 10 }, @@ -68,36 +68,11 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - insight", () => { users: 100, }, ]); - await tryber.tables.UxCampaignInsights.do().insert([ - { - campaign_id: 1, - version: 1, - title: "Test Insight", - description: "Test Description", - severity_id: 1, - cluster_ids: "1", - order: 0, - finding_id: 10, - enabled: 1, - }, - { - campaign_id: 1, - version: 2, - title: "Test Modified", - description: "Test Description", - severity_id: 1, - cluster_ids: "1", - order: 0, - finding_id: 20, - enabled: 1, - }, - ]); }); afterAll(async () => { await tryber.tables.WpAppqEvdCampaign.do().delete(); await tryber.tables.WpAppqCampaignType.do().delete(); await tryber.tables.UxCampaignData.do().delete(); - await tryber.tables.UxCampaignInsights.do().delete(); }); it("Should return status published if there are published campaign data and data are not equal to last draft", async () => { @@ -108,7 +83,7 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - insight", () => { }); }); -describe("GET /campaigns/{campaignId}/ux - draft modified - video part", () => { +describe("GET /campaigns/{campaignId}/ux - draft modified", () => { beforeAll(async () => { await tryber.tables.WpAppqEvdCampaign.do().insert([ { ...campaign, id: 1, campaign_type_id: 10 }, @@ -146,42 +121,6 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - video part", () => { users: 100, }, ]); - await tryber.tables.UxCampaignInsights.do().insert([ - { - id: 1, - campaign_id: 1, - version: 1, - title: "Test Insight", - description: "Test Description", - severity_id: 1, - cluster_ids: "1", - order: 0, - finding_id: 10, - enabled: 1, - }, - { - id: 2, - campaign_id: 1, - version: 2, - title: "Test Insight", - description: "Test Description", - severity_id: 1, - cluster_ids: "1", - order: 0, - finding_id: 20, - enabled: 1, - }, - ]); - - await tryber.tables.UxCampaignVideoParts.do().insert({ - id: 1, - insight_id: 1, - start: 0, - end: 10, - order: 0, - media_id: 1, - description: "Test Description", - }); await tryber.tables.WpAppqUserTaskMedia.do().insert({ id: 1, campaign_task_id: 1, @@ -190,15 +129,6 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - video part", () => { tester_id: 1, }); - await tryber.tables.UxCampaignVideoParts.do().insert({ - id: 2, - insight_id: 2, - start: 0, - end: 100, - order: 0, - media_id: 1, - description: "Test Description", - }); await tryber.tables.WpAppqUserTaskMedia.do().insert({ id: 2, campaign_task_id: 1, @@ -211,8 +141,6 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - video part", () => { await tryber.tables.WpAppqEvdCampaign.do().delete(); await tryber.tables.WpAppqCampaignType.do().delete(); await tryber.tables.UxCampaignData.do().delete(); - await tryber.tables.UxCampaignInsights.do().delete(); - await tryber.tables.UxCampaignVideoParts.do().delete(); await tryber.tables.WpAppqUserTaskMedia.do().delete(); }); @@ -261,23 +189,11 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - ux data", () => { users: 100, }, ]); - await tryber.tables.UxCampaignInsights.do().insert({ - campaign_id: 1, - version: 1, - title: "Test Insight", - description: "Test Description", - severity_id: 1, - cluster_ids: "1", - order: 0, - finding_id: 10, - enabled: 1, - }); }); afterAll(async () => { await tryber.tables.WpAppqEvdCampaign.do().delete(); await tryber.tables.UxCampaignData.do().delete(); await tryber.tables.WpAppqCampaignType.do().delete(); - await tryber.tables.UxCampaignInsights.do().delete(); }); it("Should return methodology", async () => { @@ -365,17 +281,6 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - questions", () => { users: 100, }, ]); - await tryber.tables.UxCampaignInsights.do().insert({ - campaign_id: 1, - version: 1, - title: "Test Insight", - description: "Test Description", - severity_id: 1, - cluster_ids: "1", - order: 0, - finding_id: 10, - enabled: 1, - }); await tryber.tables.UxCampaignQuestions.do().insert([ { id: 1, @@ -413,7 +318,6 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - questions", () => { await tryber.tables.WpAppqEvdCampaign.do().delete(); await tryber.tables.UxCampaignData.do().delete(); await tryber.tables.WpAppqCampaignType.do().delete(); - await tryber.tables.UxCampaignInsights.do().delete(); await tryber.tables.UxCampaignQuestions.do().delete(); }); it("Should return questions of last draft version", async () => { @@ -470,17 +374,6 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - sentiments", () => { users: 100, }, ]); - await tryber.tables.UxCampaignInsights.do().insert({ - campaign_id: 1, - version: 1, - title: "Test Insight", - description: "Test Description", - severity_id: 1, - cluster_ids: "1", - order: 0, - finding_id: 10, - enabled: 1, - }); await tryber.tables.WpAppqUsecaseCluster.do().insert([ { id: 1, @@ -548,7 +441,6 @@ describe("GET /campaigns/{campaignId}/ux - draft modified - sentiments", () => { await tryber.tables.WpAppqEvdCampaign.do().delete(); await tryber.tables.UxCampaignData.do().delete(); await tryber.tables.WpAppqCampaignType.do().delete(); - await tryber.tables.UxCampaignInsights.do().delete(); await tryber.tables.UxCampaignQuestions.do().delete(); await tryber.tables.UxCampaignSentiments.do().delete(); await tryber.tables.WpAppqUsecaseCluster.do().delete(); diff --git a/src/routes/campaigns/campaignId/ux/_get/index.ts b/src/routes/campaigns/campaignId/ux/_get/index.ts index 2ecaa13fe..eadc0a6de 100644 --- a/src/routes/campaigns/campaignId/ux/_get/index.ts +++ b/src/routes/campaigns/campaignId/ux/_get/index.ts @@ -87,7 +87,6 @@ export default class Route extends UserRoute<{ | "quantitative" | "quali-quantitative", }, - insights: this.draft.data?.findings || [], sentiments: this.draft.data?.sentiments || [], questions: this.draft.data?.questions || [], }); diff --git a/src/schema.ts b/src/schema.ts index e65595d22..491191bb4 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -1956,31 +1956,6 @@ export interface operations { status: "draft" | "published" | "draft-modified"; goal: string; usersNumber: number; - insights?: { - id: number; - title: string; - severity: { - id: number; - name: string; - }; - description: string; - clusters: - | "all" - | { - id: number; - name: string; - }[]; - videoParts: { - id: number; - start: number; - end: number; - mediaId: number; - url: string; - streamUrl: string; - description: string; - poster?: string; - }[]; - }[]; sentiments: { id: number; value: number;