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 2165a65d..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 @@ -69,11 +67,9 @@ 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: '', - } + 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 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}`, 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