diff --git a/src/entities/catalogi/catalogi.mock.ts b/src/entities/catalogi/catalogi.mock.ts index 57d81e88..11ec77dc 100644 --- a/src/entities/catalogi/catalogi.mock.ts +++ b/src/entities/catalogi/catalogi.mock.ts @@ -19,6 +19,7 @@ export const mockCatalogiData = (): TCatalogi[] => [ rsin: '987654321', pki: 'PKI-12345-67890', }, + metadata: ['1', '3'], }, { id: '2', @@ -37,6 +38,7 @@ export const mockCatalogiData = (): TCatalogi[] => [ rsin: '987654321', pki: 'PKI-12345-67890', }, + metadata: [], }, { id: '3', @@ -56,6 +58,7 @@ export const mockCatalogiData = (): TCatalogi[] => [ rsin: '987654321', pki: 'PKI-12345-67890', }, + metadata: ['1', '3'], }, ] diff --git a/src/entities/catalogi/catalogi.ts b/src/entities/catalogi/catalogi.ts index dd1d1202..3a51fa2f 100644 --- a/src/entities/catalogi/catalogi.ts +++ b/src/entities/catalogi/catalogi.ts @@ -20,6 +20,8 @@ export class Catalogi implements TCatalogi { pki: string } + public metadata: string[] + constructor(data: TCatalogi) { this.hydrate(data) } @@ -42,6 +44,7 @@ export class Catalogi implements TCatalogi { rsin: '', pki: '', } + this.metadata = data.metadata || [] } /* istanbul ignore next */ @@ -62,6 +65,7 @@ export class Catalogi implements TCatalogi { rsin: z.string(), pki: z.string(), }), + metadata: z.string().array(), }) const result = schema.safeParse({ diff --git a/src/entities/catalogi/catalogi.types.ts b/src/entities/catalogi/catalogi.types.ts index 47750642..548b3d2b 100644 --- a/src/entities/catalogi/catalogi.types.ts +++ b/src/entities/catalogi/catalogi.types.ts @@ -15,4 +15,5 @@ export type TCatalogi = { rsin: string pki: string } + metadata: string[] } diff --git a/src/modals/Modals.vue b/src/modals/Modals.vue index 1e1eb9e7..224a7064 100644 --- a/src/modals/Modals.vue +++ b/src/modals/Modals.vue @@ -11,6 +11,7 @@ + @@ -37,6 +38,7 @@ import EditMetaDataPropertyModal from './metaData/EditMetaDataPropertyModal.vue' import AddCatalogModal from './catalog/AddCatalogModal.vue' import EditCatalogModal from './catalog/EditCatalogModal.vue' +import AddCatalogiMetadata from './catalogiMetadata/AddCatalogiMetadata.vue' import AddDirectoryModal from './directory/AddDirectoryModal.vue' import EditListingModal from './directory/EditListingModal.vue' import AddOrganisationModal from './organisation/AddOrganisationModal.vue' @@ -59,6 +61,7 @@ export default { EditMetaDataPropertyModal, AddCatalogModal, EditCatalogModal, + AddCatalogiMetadata, AddDirectoryModal, EditListingModal, AddPublicationDataModal, diff --git a/src/modals/catalogiMetadata/AddCatalogiMetadata.vue b/src/modals/catalogiMetadata/AddCatalogiMetadata.vue new file mode 100644 index 00000000..ca6d4ee1 --- /dev/null +++ b/src/modals/catalogiMetadata/AddCatalogiMetadata.vue @@ -0,0 +1,179 @@ + + + + + + + diff --git a/src/store/modules/configuration.specs.js b/src/store/modules/configuration.specs.js deleted file mode 100644 index 085b544a..00000000 --- a/src/store/modules/configuration.specs.js +++ /dev/null @@ -1,137 +0,0 @@ -/* eslint-disable no-console */ -import { createPinia, setActivePinia } from 'pinia' - -import { Configuration } from '../../entities/index.js' -import { useConfigurationStore } from './configuration.js' - -describe( - 'Metadata Store', () => { - beforeEach( - () => { - setActivePinia(createPinia()) - }, - ) - - it( - 'sets configuration item correctly', () => { - const store = useConfigurationStore() - - store.setConfigurationItem(testData[0]) - - expect(store.configurationItem).toBeInstanceOf(Configuration) - expect(store.configurationItem).toEqual(testData[0]) - expect(store.configurationItem.validate()).toBe(true) - - store.setConfigurationItem(testData[1]) - - expect(store.configurationItem).toBeInstanceOf(Configuration) - expect(store.configurationItem).not.toEqual(testData[1]) - expect(store.configurationItem.validate()).toBe(true) - - store.setConfigurationItem(testData[2]) - - expect(store.configurationItem).toBeInstanceOf(Configuration) - expect(store.configurationItem).toEqual(testData[2]) - expect(store.configurationItem.validate()).toBe(false) - }, - ) - - it( - 'sets configuration list correctly', () => { - const store = useConfigurationStore() - - store.setConfigurationItem(testData) - - expect(store.configurationList).toHaveLength(testData.length) - - expect(store.configurationList[0]).toBeInstanceOf(Configuration) - expect(store.configurationList[0]).toEqual(testData[0]) - expect(store.configurationList[0].validate()).toBe(true) - - expect(store.configurationList[1]).toBeInstanceOf(Configuration) - expect(store.configurationList[1]).not.toEqual(testData[1]) - expect(store.configurationList[1].validate()).toBe(true) - - expect(store.configurationList[2]).toBeInstanceOf(Configuration) - expect(store.configurationList[2]).toEqual(testData[2]) - expect(store.configurationList[2].validate()).toBe(false) - }, - ) - }, -) - -const testData = [ - { // full data - id: '1', - reference: 'ref1', - title: 'test 1', - summary: 'a short form summary', - description: 'a really really long description about this catalogus', - image: 'https://example.com/image.jpg', - category: 'category1', - portal: 'portal1', - catalogi: 'catalogi1', - metaData: 'meta1', - publicationDate: '2024-01-01', - modified: '2024-01-02', - featured: true, - organisation: [{ name: 'Org1' }], - data: [{ key: 'value1' }], - attachments: ['attachment1'], - attachmentCount: 1, - schema: 'schema1', - status: 'status1', - license: 'MIT', - themes: 'theme1', - anonymization: { anonymized: 'yes', results: 'success' }, - language: { code: 'en', level: 'native' }, - }, - { // partial data - id: '2', - reference: 'ref2', - title: 'test 2', - summary: 'a short form summary', - description: 'a really really long description about this catalogus', - image: 'https://example.com/image.jpg', - category: 'category2', - portal: 'portal2', - catalogi: 'catalogi2', - metaData: 'meta2', - publicationDate: '2024-01-01', - modified: '2024-01-02', - featured: true, - organisation: [{ name: 'Org1' }], - data: [{ key: 'value1' }], - attachments: ['attachment1'], - attachmentCount: 1, - - themes: 'theme1', - anonymization: { anonymized: 'yes', results: 'success' }, - language: { code: 'en', level: 'native' }, - }, - { // invalid data - id: '3', - reference: 'ref3', - title: '', - summary: 'a short form summary', - description: 'a really really long description about this catalogus', - image: 'https://example.com/image.jpg', - category: 'category3', - portal: 'portal3', - catalogi: 'catalogi3', - metaData: 'meta3', - publicationDate: '2024-01-01', - modified: '2024-01-02', - featured: true, - organisation: [{ name: 'Org1' }], - data: [{ key: 'value1' }], - attachments: ['attachment1'], - attachmentCount: 1, - schema: 'schema1', - status: 'status1', - license: 'MIT', - themes: 'theme1', - anonymization: { anonymized: 'yes', results: 'success' }, - language: { code: 'en', level: 'native' }, - }, -] diff --git a/src/views/catalogi/CatalogiDetails.vue b/src/views/catalogi/CatalogiDetails.vue index bdc03ef6..7fd2afad 100644 --- a/src/views/catalogi/CatalogiDetails.vue +++ b/src/views/catalogi/CatalogiDetails.vue @@ -41,6 +41,12 @@ import { catalogiStore, navigationStore } from '../../store/store.js' Catalogus bekijken + + + Metadata toevoegen +