From 4db0aa8c131d78ee2bfe04f3f1587e7790e86863 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 9 Aug 2024 10:51:11 +0200 Subject: [PATCH 1/5] Fix show eigensschappen --- src/views/publications/PublicationDetail.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/publications/PublicationDetail.vue b/src/views/publications/PublicationDetail.vue index 28eb56e3..2e571066 100644 --- a/src/views/publications/PublicationDetail.vue +++ b/src/views/publications/PublicationDetail.vue @@ -169,7 +169,7 @@ import { catalogiStore, metadataStore, navigationStore, publicationStore } from
-
+
- Geen Eigenschappen gevonden + Geen eigenschappen gevonden
From 8d527019051c403ab8c5be6420b997bf0f297250 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 9 Aug 2024 10:55:49 +0200 Subject: [PATCH 2/5] Possible fix hydrate publication --- src/entities/publication/publication.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/publication/publication.ts b/src/entities/publication/publication.ts index 2165a65d..2505d810 100644 --- a/src/entities/publication/publication.ts +++ b/src/entities/publication/publication.ts @@ -69,7 +69,7 @@ export class Publication implements TPublication { this.schema = data.schema || '' this.status = data.status || 'Concept' this.attachments = data.attachments || [] - this.attachmentCount = this.attachmentCount || data.attachments.length || 0 + this.attachmentCount = this.attachmentCount || data.attachments?.length || 0 this.themes = data.themes || [] this.data = data.data || { type: '', From 676eeac4e400c6120e62834b81ed8bcb710c42ea Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 9 Aug 2024 11:14:24 +0200 Subject: [PATCH 3/5] Fix set data --- src/modals/publicationData/AddPublicationDataModal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modals/publicationData/AddPublicationDataModal.vue b/src/modals/publicationData/AddPublicationDataModal.vue index a35be621..627f367b 100644 --- a/src/modals/publicationData/AddPublicationDataModal.vue +++ b/src/modals/publicationData/AddPublicationDataModal.vue @@ -87,9 +87,9 @@ export default { }, methods: { AddPublicatieEigenschap() { - publicationStore.publicationItem.data[this.key] = this.value this.loading = true const bodyData = publicationStore.publicationItem + bodyData.data[this.key] = this.value delete bodyData.publicationDate fetch( `/index.php/apps/opencatalogi/api/publications/${publicationStore.publicationItem.id}`, From f979c0bd75ec37fa0a0fe8218ac2bd0a77462941 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 9 Aug 2024 11:28:44 +0200 Subject: [PATCH 4/5] Set publication.data if empty --- src/modals/publicationData/AddPublicationDataModal.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modals/publicationData/AddPublicationDataModal.vue b/src/modals/publicationData/AddPublicationDataModal.vue index 627f367b..c1f2c338 100644 --- a/src/modals/publicationData/AddPublicationDataModal.vue +++ b/src/modals/publicationData/AddPublicationDataModal.vue @@ -89,6 +89,9 @@ export default { AddPublicatieEigenschap() { this.loading = true const bodyData = publicationStore.publicationItem + if (Object.keys(bodyData.data).length < 1) { + bodyData.data = {} + } bodyData.data[this.key] = this.value delete bodyData.publicationDate fetch( From cf394c6e8fd11f5887a8fb5d0b93d41540ee1246 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 9 Aug 2024 11:50:40 +0200 Subject: [PATCH 5/5] Fixed publication.data type --- src/entities/publication/publication.mock.ts | 7 ++++++- src/entities/publication/publication.ts | 12 +++--------- src/entities/publication/publication.types.ts | 4 +--- .../publicationData/AddPublicationDataModal.vue | 3 --- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/entities/publication/publication.mock.ts b/src/entities/publication/publication.mock.ts index ad88bb11..2c819d4f 100644 --- a/src/entities/publication/publication.mock.ts +++ b/src/entities/publication/publication.mock.ts @@ -17,7 +17,12 @@ export const mockPublicationsData = (): TPublication[] => [ modified: '2024-01-02', featured: true, data: { - type: '', + key: 'anyvalue', + streetNumber: 1, + object: { + blabla: 'bla' + }, + array: ['appel', 'peer', 0, [], {}] }, attachments: [], attachmentCount: 1, diff --git a/src/entities/publication/publication.ts b/src/entities/publication/publication.ts index 2505d810..86d06763 100644 --- a/src/entities/publication/publication.ts +++ b/src/entities/publication/publication.ts @@ -18,9 +18,7 @@ export class Publication implements TPublication { public attachments: TAttachment[] public attachmentCount: number public themes: string[] - public data: { - type: string - } + public data: Record public anonymization: { anonymized: boolean @@ -71,9 +69,7 @@ export class Publication implements TPublication { this.attachments = data.attachments || [] this.attachmentCount = this.attachmentCount || data.attachments?.length || 0 this.themes = data.themes || [] - this.data = data.data || { - type: '', - } + this.data = (!Array.isArray(data.data) && data.data) || {} this.anonymization = data.anonymization || { anonymized: false, @@ -121,9 +117,7 @@ export class Publication implements TPublication { attachments: z.object({}).array(), attachmentCount: z.number(), themes: z.string().array(), - data: z.object({ - type: z.string(), - }), + data: z.record(z.string(), z.any()), anonymization: z.object({ anonymized: z.boolean(), results: z.string().max(2500), diff --git a/src/entities/publication/publication.types.ts b/src/entities/publication/publication.types.ts index b8ae4a29..cd3174ac 100644 --- a/src/entities/publication/publication.types.ts +++ b/src/entities/publication/publication.types.ts @@ -17,9 +17,7 @@ export type TPublication = { attachments: TAttachment[] attachmentCount: number themes: string[] - data: { - type: string - } + data: Record anonymization: { anonymized: boolean results: string diff --git a/src/modals/publicationData/AddPublicationDataModal.vue b/src/modals/publicationData/AddPublicationDataModal.vue index c1f2c338..627f367b 100644 --- a/src/modals/publicationData/AddPublicationDataModal.vue +++ b/src/modals/publicationData/AddPublicationDataModal.vue @@ -89,9 +89,6 @@ export default { AddPublicatieEigenschap() { this.loading = true const bodyData = publicationStore.publicationItem - if (Object.keys(bodyData.data).length < 1) { - bodyData.data = {} - } bodyData.data[this.key] = this.value delete bodyData.publicationDate fetch(