diff --git a/.github/workflows/kics.yml b/.github/workflows/kics.yml index a1f7a0dbfc..6c8556a1e4 100644 --- a/.github/workflows/kics.yml +++ b/.github/workflows/kics.yml @@ -100,7 +100,7 @@ jobs: with: # Scanning directory . path: "./tx-backend" - exclude_queries: 2ea04bef-c769-409e-9179-ee3a50b5c0ac,6998389e-66b2-473d-8d05-c8d71ac4d04d,a8e859da-4a43-4e7f-94b8-25d6e3bf8e90,d172a060-8569-4412-8045-3560ebd477e8,2e9b6612-8f69-42e0-a5b8-ed17739c2f3a,d172a060-8569-4412-8045-3560ebd477e8,9f88c88d-824d-4d9a-b985-e22977046042,8c8261c2-19a9-4ef7-ad37-b8bc7bdd4d85,181bd815-767e-4e95-a24d-bb3c87328e19,00b78adf-b83f-419c-8ed8-c6018441dd3a + exclude_queries: 2ea04bef-c769-409e-9179-ee3a50b5c0ac,6998389e-66b2-473d-8d05-c8d71ac4d04d,a8e859da-4a43-4e7f-94b8-25d6e3bf8e90,d172a060-8569-4412-8045-3560ebd477e8,2e9b6612-8f69-42e0-a5b8-ed17739c2f3a,d172a060-8569-4412-8045-3560ebd477e8,9f88c88d-824d-4d9a-b985-e22977046042,8c8261c2-19a9-4ef7-ad37-b8bc7bdd4d85,181bd815-767e-4e95-a24d-bb3c87328e19,00b78adf-b83f-419c-8ed8-c6018441dd3a,86e3702f-c868-44b2-b61d-ea5316c18110 enable_comments: true # Fail on HIGH severity results fail_on: high diff --git a/CHANGELOG.md b/CHANGELOG.md index f91d557b2a..fe9ad5452d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] ### Added +- added multisorting in FE for notifications ### Changed ### Removed +- Owner filter and replaced it with the new filter query param + ## [7.1.0 - 29.09.2023] ### Added - Splitscreen View with sliders on parts and otherParts View diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index 4e49e3b732..36da6d5e49 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -140,7 +140,7 @@ maven/mavencentral/org.eclipse.edc/transfer-spi/0.1.3, Apache-2.0, approved, tec maven/mavencentral/org.eclipse.edc/transform-spi/0.1.3, Apache-2.0, approved, technology.edc maven/mavencentral/org.eclipse.edc/validator-spi/0.1.3, Apache-2.0, approved, technology.edc maven/mavencentral/org.eclipse.edc/web-spi/0.1.3, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.tractusx.irs/irs-registry-client/1.2.1-20230928.131326-5, Apache-2.0, approved, automotive.tractusx +maven/mavencentral/org.eclipse.tractusx.irs/irs-registry-client/1.2.1-20230929.134937-6, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx.traceability/tx-backend/0.0.1-SNAPSHOT, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx.traceability/tx-models/0.0.1-SNAPSHOT, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.flywaydb/flyway-core/9.16.3, Apache-2.0, approved, #7935 diff --git a/DEPENDENCIES_FRONTEND b/DEPENDENCIES_FRONTEND index 9249166597..ef9c2255f9 100644 --- a/DEPENDENCIES_FRONTEND +++ b/DEPENDENCIES_FRONTEND @@ -377,7 +377,7 @@ npm/npmjs/-/flat-cache/3.0.4, MIT, approved, clearlydefined npm/npmjs/-/flatted/3.2.5, ISC AND (ISC AND MIT), approved, #2430 npm/npmjs/-/flatted/3.2.7, ISC AND (ISC AND MIT), approved, #2430 npm/npmjs/-/fn.name/1.1.0, MIT, approved, clearlydefined -npm/npmjs/-/follow-redirects/1.15.2, MIT, approved, clearlydefined +npm/npmjs/-/follow-redirects/1.15.2, MIT, approved, #10782 npm/npmjs/-/for-each/0.3.3, MIT, approved, clearlydefined npm/npmjs/-/forever-agent/0.6.1, Apache-2.0, approved, clearlydefined npm/npmjs/-/form-data/2.3.3, MIT, approved, clearlydefined @@ -1443,7 +1443,7 @@ npm/npmjs/@tsconfig/node16/1.0.2, MIT, approved, clearlydefined npm/npmjs/@tufjs/canonical-json/1.0.0, Apache-2.0 AND MIT, approved, #8047 npm/npmjs/@tufjs/models/1.0.3, MIT, approved, #7600 npm/npmjs/@types/aria-query/4.2.2, MIT, approved, clearlydefined -npm/npmjs/@types/body-parser/1.19.2, MIT, approved, clearlydefined +npm/npmjs/@types/body-parser/1.19.2, MIT, approved, #10831 npm/npmjs/@types/bonjour/3.5.10, MIT, approved, clearlydefined npm/npmjs/@types/connect-history-api-fallback/1.5.0, MIT, approved, #8395 npm/npmjs/@types/connect/3.4.35, MIT, approved, clearlydefined @@ -1480,8 +1480,8 @@ npm/npmjs/@types/d3-timer/3.0.0, MIT, approved, clearlydefined npm/npmjs/@types/d3-transition/3.0.1, MIT, approved, clearlydefined npm/npmjs/@types/d3-zoom/3.0.1, MIT, approved, clearlydefined npm/npmjs/@types/d3/7.4.0, MIT, approved, clearlydefined -npm/npmjs/@types/debug/4.1.7, MIT, approved, clearlydefined -npm/npmjs/@types/eslint-scope/3.7.3, MIT, approved, clearlydefined +npm/npmjs/@types/debug/4.1.7, MIT, approved, #10817 +npm/npmjs/@types/eslint-scope/3.7.3, MIT, approved, #10812 npm/npmjs/@types/eslint/8.4.2, MIT, approved, #2429 npm/npmjs/@types/estree/0.0.51, MIT, approved, clearlydefined npm/npmjs/@types/express-serve-static-core/4.17.34, MIT, approved, #6020 @@ -1498,22 +1498,22 @@ npm/npmjs/@types/lodash-es/4.17.7, MIT, approved, clearlydefined npm/npmjs/@types/lodash/4.14.182, MIT, approved, #4131 npm/npmjs/@types/lodash/4.14.194, MIT, approved, #4131 npm/npmjs/@types/luxon/3.3.0, MIT, approved, clearlydefined -npm/npmjs/@types/mime/1.3.2, MIT, approved, clearlydefined -npm/npmjs/@types/mime/3.0.1, MIT, approved, clearlydefined +npm/npmjs/@types/mime/1.3.2, MIT, approved, #10834 +npm/npmjs/@types/mime/3.0.1, MIT, approved, #10805 npm/npmjs/@types/minimatch/5.1.2, MIT, approved, clearlydefined -npm/npmjs/@types/minimist/1.2.2, MIT, approved, clearlydefined +npm/npmjs/@types/minimist/1.2.2, MIT, approved, #10839 npm/npmjs/@types/mkdirp/1.0.2, MIT, approved, clearlydefined -npm/npmjs/@types/ms/0.7.31, MIT, approved, clearlydefined +npm/npmjs/@types/ms/0.7.31, MIT, approved, #10811 npm/npmjs/@types/node/14.18.34, MIT, approved, #4611 npm/npmjs/@types/node/18.16.0, MIT, approved, #9385 npm/npmjs/@types/node/20.2.3, MIT, approved, clearlydefined -npm/npmjs/@types/normalize-package-data/2.4.1, MIT, approved, clearlydefined +npm/npmjs/@types/normalize-package-data/2.4.1, MIT, approved, #10792 npm/npmjs/@types/parse-json/4.0.0, MIT, approved, clearlydefined npm/npmjs/@types/qs/6.9.7, MIT, approved, clearlydefined -npm/npmjs/@types/range-parser/1.2.4, MIT, approved, clearlydefined +npm/npmjs/@types/range-parser/1.2.4, MIT, approved, #10795 npm/npmjs/@types/retry/0.12.0, MIT, approved, clearlydefined npm/npmjs/@types/semver/7.3.13, MIT, approved, #4668 -npm/npmjs/@types/send/0.17.1, MIT, approved, clearlydefined +npm/npmjs/@types/send/0.17.1, MIT, approved, #10832 npm/npmjs/@types/serve-index/1.9.1, MIT, approved, clearlydefined npm/npmjs/@types/serve-static/1.15.1, MIT, approved, #9188 npm/npmjs/@types/set-cookie-parser/2.4.2, MIT, approved, clearlydefined diff --git a/frontend/src/app/mocks/services/investigations-mock/investigations.model.ts b/frontend/src/app/mocks/services/investigations-mock/investigations.model.ts index 4f6ded56d6..93e98945da 100644 --- a/frontend/src/app/mocks/services/investigations-mock/investigations.model.ts +++ b/frontend/src/app/mocks/services/investigations-mock/investigations.model.ts @@ -20,7 +20,7 @@ ********************************************************************************/ import type { NotificationResponse } from '@shared/model/notification.model'; -import { NotificationStatus } from '@shared/model/notification.model'; +import { NotificationStatus, NotificationType } from '@shared/model/notification.model'; import { Severity } from '@shared/model/severity.model'; import { getRandomAsset } from '../parts-mock/partsAsPlanned/partsAsPlanned.model'; import { MOCK_part_1 } from '../parts-mock/partsAsPlanned/partsAsPlanned.test.model'; @@ -73,6 +73,7 @@ export const buildMockInvestigations = ( targetDate: `2022-${numberToString(month)}-${numberToString(day + 1)}T11:34:12Z`, assetIds: [MOCK_part_1.id, getRandomAsset().id, getRandomAsset().id, getRandomAsset().id], errorMessage: errorInvestigation, + notificationType: NotificationType.INVESTIGATION, }; }); diff --git a/frontend/src/app/mocks/services/otherParts-mock/otherParts.handler.ts b/frontend/src/app/mocks/services/otherParts-mock/otherParts.handler.ts index 110307ef03..ef86b24479 100644 --- a/frontend/src/app/mocks/services/otherParts-mock/otherParts.handler.ts +++ b/frontend/src/app/mocks/services/otherParts-mock/otherParts.handler.ts @@ -29,9 +29,9 @@ import { supplierPartsAsPlannedAssets } from './supplierPartsAsPlanned.model'; export const otherPartsAsBuiltHandlers = [ rest.get(`*${environment.apiUrl}/assets/as-built`, (req, res, ctx) => { const pagination = extractPagination(req); - const owner = req.url.searchParams.get('owner'); + const ownerSearchQuery = req.url.searchParams.get('filter').replace("owner,EQUAL,", ""); - switch (owner) { + switch (ownerSearchQuery) { case 'SUPPLIER': return res(ctx.status(200), ctx.json(mockSupplierAssets)); @@ -44,7 +44,7 @@ export const otherPartsAsBuiltHandlers = [ export const otherPartsAsBuiltHandlersTest = [ rest.get(`*${environment.apiUrl}/assets/as-built`, (req, res, ctx) => { - const owner = req.url.searchParams.get('owner'); + const owner = req.url.searchParams.get('filter').replace("owner,EQUAL,", ""); switch (owner) { case 'SUPPLIER': @@ -60,7 +60,7 @@ export const otherPartsAsBuiltHandlersTest = [ export const otherPartsAsPlannedHandlers = [ rest.get(`*${environment.apiUrl}/assets/as-planned`, (req, res, ctx) => { const pagination = extractPagination(req); - const owner = req.url.searchParams.get('owner'); + const owner = req.url.searchParams.get('filter').replace("owner,EQUAL,", ""); switch (owner) { case 'SUPPLIER': @@ -76,7 +76,7 @@ export const otherPartsAsPlannedHandlers = [ export const otherPartsAsPlannedHandlersTest = [ rest.get(`*${environment.apiUrl}/assets/as-planned`, (req, res, ctx) => { const pagination = extractPagination(req); - const owner = req.url.searchParams.get('owner'); + const owner = req.url.searchParams.get('filter').replace("owner,EQUAL,", ""); switch (owner) { case 'SUPPLIER': diff --git a/frontend/src/app/modules/page/alerts/core/alerts.facade.ts b/frontend/src/app/modules/page/alerts/core/alerts.facade.ts index 74f2f2a346..6595100e6b 100644 --- a/frontend/src/app/modules/page/alerts/core/alerts.facade.ts +++ b/frontend/src/app/modules/page/alerts/core/alerts.facade.ts @@ -47,7 +47,7 @@ export class AlertsFacade { return this.alertsService.getAlert(id); } - public setReceivedAlerts(page = 0, pageSize = 50, sorting: TableHeaderSort = null): void { + public setReceivedAlerts(page = 0, pageSize = 50, sorting: TableHeaderSort[] = []): void { this.alertReceivedSubscription?.unsubscribe(); this.alertReceivedSubscription = this.alertsService .getReceivedAlerts(page, pageSize, sorting) @@ -57,7 +57,7 @@ export class AlertsFacade { }); } - public setQueuedAndRequestedAlerts(page = 0, pageSize = 50, sorting: TableHeaderSort = null): void { + public setQueuedAndRequestedAlerts(page = 0, pageSize = 50, sorting: TableHeaderSort[] = []): void { this.alertQueuedAndRequestedSubscription?.unsubscribe(); this.alertQueuedAndRequestedSubscription = this.alertsService .getCreatedAlerts(page, pageSize, sorting) diff --git a/frontend/src/app/modules/page/alerts/presentation/alerts.component.html b/frontend/src/app/modules/page/alerts/presentation/alerts.component.html index 690261bde0..367ddf6e13 100644 --- a/frontend/src/app/modules/page/alerts/presentation/alerts.component.html +++ b/frontend/src/app/modules/page/alerts/presentation/alerts.component.html @@ -28,9 +28,11 @@ [receivedNotifications$]="alertsReceived$" [translationContext]="TranslationContext.COMMONALERT" [receivedOptionalColumns]="['severity', 'createdBy']" - [receivedSortableColumns]="{status: true, createdDate: true, severity: true, createdBy: true}" + [receivedMultiSortList]="alertReceivedSortList" + [receivedSortableColumns]="{description: true, status: true, createdDate: true, severity: true, createdBy: true}" [queuedAndRequestedOptionalColumns]="['severity', 'sendTo']" - [queuedAndRequestedSortableColumns]="{status: true, createdDate: true, severity: true, sendTo: true}" + [queuedAndRequestedSortableColumns]="{description: true, status: true, createdDate: true, severity: true, sendTo: true}" + [queuedAndRequestedMultiSortList]="alertQueuedAndRequestedSortList" (onReceivedTableConfigChanged)="onReceivedTableConfigChange($event)" (onQueuedAndRequestedTableConfigChanged)="onQueuedAndRequestedTableConfigChange($event)" (selected)="openDetailPage($event)" diff --git a/frontend/src/app/modules/page/alerts/presentation/alerts.component.spec.ts b/frontend/src/app/modules/page/alerts/presentation/alerts.component.spec.ts index a687e4a04a..3fec1dca39 100644 --- a/frontend/src/app/modules/page/alerts/presentation/alerts.component.spec.ts +++ b/frontend/src/app/modules/page/alerts/presentation/alerts.component.spec.ts @@ -65,4 +65,96 @@ describe('AlertsComponent', () => { expect(await waitFor(() => screen.getByText('Alert No 20'))).toBeInTheDocument(); expect(await waitFor(() => screen.getByText('Alert No 84'))).toBeInTheDocument(); }); + + it('should sort received alerts after column status', async () => { + const { fixture } = await renderAlerts(); + const alertsComponent = fixture.componentInstance; + + let setTableFunctionSpy = spyOn(alertsComponent, "setTableSortingList").and.callThrough(); + let statusColumnHeader = await screen.findByText('table.column.status'); + await waitFor(() => {fireEvent.click(statusColumnHeader);}, {timeout: 3000}); + + + expect(setTableFunctionSpy).toHaveBeenCalledWith(['status', 'asc'], "received" ); + + expect(alertsComponent['alertReceivedSortList']).toEqual([["status", "asc"]]); + }); + + it('should sort queued and requested alerts after column status', async () => { + const { fixture } = await renderAlerts(); + const alertsComponent = fixture.componentInstance; + + fireEvent.click(await waitFor(() => screen.getByText('commonAlert.tabs.queuedAndRequested'))); + + let setTableFunctionSpy = spyOn(alertsComponent, "setTableSortingList").and.callThrough(); + let statusColumnHeader = await screen.findByText('table.column.status'); + await waitFor(() => {fireEvent.click(statusColumnHeader);}, {timeout: 3000}); + + + expect(setTableFunctionSpy).toHaveBeenCalledWith(['status', 'asc'], "queued-and-requested" ); + + expect(alertsComponent['alertQueuedAndRequestedSortList']).toEqual([["status", "asc"]]); + }); + + + it('should multisort after column description and status', async () => { + const { fixture } = await renderAlerts(); + const alertsComponent = fixture.componentInstance; + + let setTableFunctionSpy = spyOn(alertsComponent, "setTableSortingList").and.callThrough(); + let descriptionColumnHeader = await screen.findByText('table.column.description'); + await waitFor(() => {fireEvent.click(descriptionColumnHeader);}, {timeout: 3000}); + let statusHeader = await screen.findByText('table.column.status') + + await waitFor(() => {fireEvent.keyDown(statusHeader, { + ctrlKey: true, + charCode: 17 + })}) + expect(alertsComponent['ctrlKeyState']).toBeTruthy(); + await waitFor(() => { + fireEvent.click(statusHeader) + }); + + await waitFor(() => {fireEvent.keyUp(statusHeader, { + ctrlKey: true, + charCode: 17 + })}) + + await waitFor(() => {fireEvent.click(statusHeader)}); + + + expect(setTableFunctionSpy).toHaveBeenCalledWith(['description', 'asc'], "received" ); + expect(setTableFunctionSpy).toHaveBeenCalledWith(['status', 'asc'], "received" ); + expect(alertsComponent['alertReceivedSortList']).toEqual([["description", "asc"], ["status", "desc"]]); + }); + + it('should reset sorting after third click', async () => { + const { fixture } = await renderAlerts(); + const alertsComponent = fixture.componentInstance; + + let descriptionColumnHeader = await screen.findByText('table.column.description'); + await waitFor(() => {fireEvent.click(descriptionColumnHeader);}, {timeout: 3000}); + let statusColumnHeader = await screen.findByText('table.column.status') + + await waitFor(() => {fireEvent.keyDown(statusColumnHeader, { + ctrlKey: true, + charCode: 17 + })}) + + await waitFor(() => { + fireEvent.click(statusColumnHeader) + }); + + await waitFor(() => {fireEvent.keyUp(statusColumnHeader, { + ctrlKey: true, + charCode: 17 + })}) + + await waitFor(() => {fireEvent.click(statusColumnHeader)}); + + await waitFor(() => {fireEvent.click(statusColumnHeader)}); + + expect(alertsComponent['alertReceivedSortList']).toEqual([]); + }); + }); diff --git a/frontend/src/app/modules/page/alerts/presentation/alerts.component.ts b/frontend/src/app/modules/page/alerts/presentation/alerts.component.ts index 1d8c9b48f6..a19667b3b4 100644 --- a/frontend/src/app/modules/page/alerts/presentation/alerts.component.ts +++ b/frontend/src/app/modules/page/alerts/presentation/alerts.component.ts @@ -17,19 +17,20 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import {ChangeDetectorRef, Component, ViewChild} from '@angular/core'; +import { ChangeDetectorRef, Component, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { ALERT_BASE_ROUTE, getRoute } from '@core/known-route'; import { AlertDetailFacade } from '@page/alerts/core/alert-detail.facade'; import { AlertHelperService } from '@page/alerts/core/alert-helper.service'; import { AlertsFacade } from '@page/alerts/core/alerts.facade'; +import { NotificationMenuActionsAssembler } from '@shared/assembler/notificationMenuActions.assembler'; import { NotificationCommonModalComponent } from '@shared/components/notification-common-modal/notification-common-modal.component'; -import { MenuActionConfig, TableEventConfig } from '@shared/components/table/table.model'; +import { MenuActionConfig, TableEventConfig, TableHeaderSort } from '@shared/components/table/table.model'; +import { TableSortingUtil } from '@shared/components/table/tableSortingUtil'; import { NotificationTabInformation } from '@shared/model/notification-tab-information'; -import { Notification } from '@shared/model/notification.model'; +import { Notification, NotificationStatusGroup } from '@shared/model/notification.model'; import { TranslationContext } from '@shared/model/translation-context.model'; import { Subscription } from 'rxjs'; -import {NotificationMenuActionsAssembler} from "@shared/assembler/notificationMenuActions.assembler"; @Component({ selector: 'app-alerts', @@ -44,6 +45,10 @@ export class AlertsComponent { public menuActionsConfig: MenuActionConfig[]; + public alertReceivedSortList: TableHeaderSort[] = []; + public alertQueuedAndRequestedSortList: TableHeaderSort[] = []; + private ctrlKeyState: boolean = false; + private paramSubscription: Subscription; private pagination: TableEventConfig = { page: 0, pageSize: 50, sorting: ['createdDate' , 'desc'] }; @@ -58,13 +63,20 @@ export class AlertsComponent { ) { this.alertsReceived$ = this.alertsFacade.alertsReceived$; this.alertsQueuedAndRequested$ = this.alertsFacade.alertsQueuedAndRequested$; + + window.addEventListener('keydown', (event) => { + this.ctrlKeyState = event.ctrlKey; + }); + window.addEventListener('keyup', (event) => { + this.ctrlKeyState = event.ctrlKey; + }); } public ngOnInit(): void { this.paramSubscription = this.route.queryParams.subscribe(params => { this.pagination.page = params?.pageNumber; - this.alertsFacade.setReceivedAlerts(this.pagination.page, this.pagination.pageSize, this.pagination.sorting); - this.alertsFacade.setQueuedAndRequestedAlerts(this.pagination.page, this.pagination.pageSize, this.pagination.sorting); + this.alertsFacade.setReceivedAlerts(this.pagination.page, this.pagination.pageSize, this.alertReceivedSortList); + this.alertsFacade.setQueuedAndRequestedAlerts(this.pagination.page, this.pagination.pageSize, this.alertQueuedAndRequestedSortList); }) } @@ -83,12 +95,14 @@ export class AlertsComponent { public onReceivedTableConfigChange(pagination: TableEventConfig) { this.pagination = pagination; - this.alertsFacade.setReceivedAlerts(this.pagination.page, this.pagination.pageSize, this.pagination.sorting); + this.setTableSortingList(pagination.sorting, NotificationStatusGroup.RECEIVED); + this.alertsFacade.setReceivedAlerts(this.pagination.page, this.pagination.pageSize, this.alertReceivedSortList); } public onQueuedAndRequestedTableConfigChange(pagination: TableEventConfig) { this.pagination = pagination; - this.alertsFacade.setQueuedAndRequestedAlerts(this.pagination.page, this.pagination.pageSize, this.pagination.sorting); + this.setTableSortingList(pagination.sorting, NotificationStatusGroup.QUEUED_AND_REQUESTED); + this.alertsFacade.setQueuedAndRequestedAlerts(this.pagination.page, this.pagination.pageSize, this.alertQueuedAndRequestedSortList); } public openDetailPage(notification: Notification): void { @@ -103,5 +117,11 @@ export class AlertsComponent { this.ngOnInit(); } + private setTableSortingList(sorting: TableHeaderSort, notificationTable: NotificationStatusGroup): void { + const tableSortList = notificationTable === NotificationStatusGroup.RECEIVED ? + this.alertReceivedSortList : this.alertQueuedAndRequestedSortList; + TableSortingUtil.setTableSortingList(sorting, tableSortList, this.ctrlKeyState); + } + protected readonly TranslationContext = TranslationContext; } diff --git a/frontend/src/app/modules/page/dashboard/abstraction/dashboard.facade.ts b/frontend/src/app/modules/page/dashboard/abstraction/dashboard.facade.ts index 755d8a6e3f..35638ba010 100644 --- a/frontend/src/app/modules/page/dashboard/abstraction/dashboard.facade.ts +++ b/frontend/src/app/modules/page/dashboard/abstraction/dashboard.facade.ts @@ -89,7 +89,7 @@ export class DashboardFacade { private setInvestigations(): void { this.investigationSubscription?.unsubscribe(); - this.investigationSubscription = this.investigationsService.getReceivedInvestigations(0, 5, null).subscribe({ + this.investigationSubscription = this.investigationsService.getReceivedInvestigations(0, 5, []).subscribe({ next: data => this.dashboardState.setInvestigation({ data }), error: (error: Error) => this.dashboardState.setInvestigation({ error }), }); diff --git a/frontend/src/app/modules/page/investigations/core/investigations.facade.ts b/frontend/src/app/modules/page/investigations/core/investigations.facade.ts index 34869482b1..405fc11489 100644 --- a/frontend/src/app/modules/page/investigations/core/investigations.facade.ts +++ b/frontend/src/app/modules/page/investigations/core/investigations.facade.ts @@ -49,7 +49,7 @@ export class InvestigationsFacade { return this.investigationsService.getInvestigation(id); } - public setReceivedInvestigation(page = 0, pageSize = 50, sorting: TableHeaderSort = null): void { + public setReceivedInvestigation(page = 0, pageSize = 50, sorting: TableHeaderSort[] = []): void { this.investigationReceivedSubscription?.unsubscribe(); this.investigationReceivedSubscription = this.investigationsService .getReceivedInvestigations(page, pageSize, sorting) @@ -59,10 +59,10 @@ export class InvestigationsFacade { }); } - public setQueuedAndRequestedInvestigations(page = 0, pageSize = 50, sorting: TableHeaderSort = null): void { + public setQueuedAndRequestedInvestigations(page = 0, pageSize = 50, sorting: TableHeaderSort[] = []): void { this.investigationQueuedAndRequestedSubscription?.unsubscribe(); this.investigationQueuedAndRequestedSubscription = this.investigationsService - .getCreatedInvestigations(page, pageSize, sorting) + .getCreatedInvestigations(page, pageSize, sorting, ) .subscribe({ next: data => (this.investigationsState.investigationsQueuedAndRequested = { data }), error: (error: Error) => (this.investigationsState.investigationsQueuedAndRequested = { error }), diff --git a/frontend/src/app/modules/page/investigations/core/investigationsType.enum.ts b/frontend/src/app/modules/page/investigations/core/investigationsType.enum.ts new file mode 100644 index 0000000000..2169f52309 --- /dev/null +++ b/frontend/src/app/modules/page/investigations/core/investigationsType.enum.ts @@ -0,0 +1,4 @@ +export enum InvestigationsType { + RECEIVED = "Received", + QUEUED_AND_REQUESTED = "Queued and requested" +} diff --git a/frontend/src/app/modules/page/investigations/presentation/investigations.component.html b/frontend/src/app/modules/page/investigations/presentation/investigations.component.html index eb1fd4659c..7e0684f538 100644 --- a/frontend/src/app/modules/page/investigations/presentation/investigations.component.html +++ b/frontend/src/app/modules/page/investigations/presentation/investigations.component.html @@ -30,9 +30,11 @@ [receivedNotifications$]="investigationsReceived$" [translationContext]="TranslationContext.COMMONINVESTIGATION" [receivedOptionalColumns]="['targetDate', 'severity', 'createdBy']" - [receivedSortableColumns]="{status: true, createdDate: true, severity: true, createdBy: true}" + [receivedSortableColumns]="{description: true, status: true, createdDate: true, severity: true, createdBy: true, targetDate: true}" [queuedAndRequestedOptionalColumns]="['targetDate', 'severity', 'sendTo']" - [queuedAndRequestedSortableColumns]="{status: true, createdDate: true, severity: true, sendTo: true}" + [queuedAndRequestedSortableColumns]="{description: true, status: true, createdDate: true, severity: true, sendTo: true, targetDate: true}" + [receivedMultiSortList]="investigationReceivedSortList" + [queuedAndRequestedMultiSortList]="investigationQueuedAndRequestedSortList" (onReceivedTableConfigChanged)="onReceivedTableConfigChanged($event)" (onQueuedAndRequestedTableConfigChanged)="onQueuedAndRequestedTableConfigChanged($event)" (selected)="openDetailPage($event)" diff --git a/frontend/src/app/modules/page/investigations/presentation/investigations.component.spec.ts b/frontend/src/app/modules/page/investigations/presentation/investigations.component.spec.ts index f7e02c4178..e45d5b4d4b 100644 --- a/frontend/src/app/modules/page/investigations/presentation/investigations.component.spec.ts +++ b/frontend/src/app/modules/page/investigations/presentation/investigations.component.spec.ts @@ -65,4 +65,96 @@ describe('InvestigationsComponent', () => { expect(await waitFor(() => screen.getByText('Investigation No 84'))).toBeInTheDocument(); expect(await waitFor(() => screen.getByText('Investigation No 11'))).toBeInTheDocument(); }); + + it('should sort received investigations after column status', async () => { + const { fixture } = await renderInvestigations(); + const investigationComponent = fixture.componentInstance; + + let setTableFunctionSpy = spyOn(investigationComponent, "setTableSortingList").and.callThrough(); + let statusColumnHeader = await screen.findByText('table.column.status'); + await waitFor(() => {fireEvent.click(statusColumnHeader);}, {timeout: 3000}); + + + expect(setTableFunctionSpy).toHaveBeenCalledWith(['status', 'asc'], "received" ); + + expect(investigationComponent['investigationReceivedSortList']).toEqual([["status", "asc"]]); + }); + + it('should sort queued and requested investigations after column status', async () => { + const { fixture } = await renderInvestigations(); + const investigationComponent = fixture.componentInstance; + + fireEvent.click(await waitFor(() => screen.getByText('commonInvestigation.tabs.queuedAndRequested'))); + + let setTableFunctionSpy = spyOn(investigationComponent, "setTableSortingList").and.callThrough(); + let statusColumnHeader = await screen.findByText('table.column.status'); + await waitFor(() => {fireEvent.click(statusColumnHeader);}, {timeout: 3000}); + + + expect(setTableFunctionSpy).toHaveBeenCalledWith(['status', 'asc'], "queued-and-requested" ); + + expect(investigationComponent['investigationQueuedAndRequestedSortList']).toEqual([["status", "asc"]]); + }); + + + it('should multisort after column description and status', async () => { + const { fixture } = await renderInvestigations(); + const investigationsComponent = fixture.componentInstance; + + let setTableFunctionSpy = spyOn(investigationsComponent, "setTableSortingList").and.callThrough(); + let descriptionColumnHeader = await screen.findByText('table.column.description'); + await waitFor(() => {fireEvent.click(descriptionColumnHeader);}, {timeout: 3000}); + let statusHeader = await screen.findByText('table.column.status') + + await waitFor(() => {fireEvent.keyDown(statusHeader, { + ctrlKey: true, + charCode: 17 + })}) + expect(investigationsComponent['ctrlKeyState']).toBeTruthy(); + await waitFor(() => { + fireEvent.click(statusHeader) + }); + + await waitFor(() => {fireEvent.keyUp(statusHeader, { + ctrlKey: true, + charCode: 17 + })}) + + await waitFor(() => {fireEvent.click(statusHeader)}); + + + expect(setTableFunctionSpy).toHaveBeenCalledWith(['description', 'asc'], "received" ); + expect(setTableFunctionSpy).toHaveBeenCalledWith(['status', 'asc'], "received" ); + expect(investigationsComponent['investigationReceivedSortList']).toEqual([["description", "asc"], ["status", "desc"]]); + }); + + it('should reset sorting after third click', async () => { + const { fixture } = await renderInvestigations(); + const investigationsComponent = fixture.componentInstance; + + let descriptionColumnHeader = await screen.findByText('table.column.description'); + await waitFor(() => {fireEvent.click(descriptionColumnHeader);}, {timeout: 3000}); + let statusColumnHeader = await screen.findByText('table.column.status') + + await waitFor(() => {fireEvent.keyDown(statusColumnHeader, { + ctrlKey: true, + charCode: 17 + })}) + + await waitFor(() => { + fireEvent.click(statusColumnHeader) + }); + + await waitFor(() => {fireEvent.keyUp(statusColumnHeader, { + ctrlKey: true, + charCode: 17 + })}) + + await waitFor(() => {fireEvent.click(statusColumnHeader)}); + + await waitFor(() => {fireEvent.click(statusColumnHeader)}); + + expect(investigationsComponent['investigationReceivedSortList']).toEqual([]); + }); + }); diff --git a/frontend/src/app/modules/page/investigations/presentation/investigations.component.ts b/frontend/src/app/modules/page/investigations/presentation/investigations.component.ts index 473e50ecdf..6d0224fba8 100644 --- a/frontend/src/app/modules/page/investigations/presentation/investigations.component.ts +++ b/frontend/src/app/modules/page/investigations/presentation/investigations.component.ts @@ -19,19 +19,20 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import {ChangeDetectorRef, Component, ViewChild} from '@angular/core'; +import { ChangeDetectorRef, Component, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { getRoute, INVESTIGATION_BASE_ROUTE } from '@core/known-route'; import { InvestigationDetailFacade } from '@page/investigations/core/investigation-detail.facade'; import { InvestigationHelperService } from '@page/investigations/core/investigation-helper.service'; +import { NotificationMenuActionsAssembler } from '@shared/assembler/notificationMenuActions.assembler'; import { NotificationCommonModalComponent } from '@shared/components/notification-common-modal/notification-common-modal.component'; -import { MenuActionConfig, TableEventConfig } from '@shared/components/table/table.model'; +import { MenuActionConfig, TableEventConfig, TableHeaderSort } from '@shared/components/table/table.model'; +import { TableSortingUtil } from '@shared/components/table/tableSortingUtil'; import { NotificationTabInformation } from '@shared/model/notification-tab-information'; -import { Notification } from '@shared/model/notification.model'; +import { Notification, NotificationStatusGroup } from '@shared/model/notification.model'; import { TranslationContext } from '@shared/model/translation-context.model'; import { Subscription } from 'rxjs'; import { InvestigationsFacade } from '../core/investigations.facade'; -import {NotificationMenuActionsAssembler} from "@shared/assembler/notificationMenuActions.assembler"; @Component({ selector: 'app-investigations', @@ -45,9 +46,13 @@ export class InvestigationsComponent { public menuActionsConfig: MenuActionConfig[]; + public investigationReceivedSortList: TableHeaderSort[] = []; + public investigationQueuedAndRequestedSortList: TableHeaderSort[] = []; + private ctrlKeyState: boolean = false; + private paramSubscription: Subscription; - private pagination: TableEventConfig = { page: 0, pageSize: 50, sorting: ['createdDate' , 'desc'] }; + private pagination: TableEventConfig = { page: 0, pageSize: 50, sorting: [ 'createdDate', 'desc' ] }; constructor( public readonly helperService: InvestigationHelperService, @@ -55,18 +60,26 @@ export class InvestigationsComponent { private readonly investigationDetailFacade: InvestigationDetailFacade, private readonly router: Router, private readonly route: ActivatedRoute, - private readonly cd: ChangeDetectorRef + private readonly cd: ChangeDetectorRef, ) { this.investigationsReceived$ = this.investigationsFacade.investigationsReceived$; this.investigationsQueuedAndRequested$ = this.investigationsFacade.investigationsQueuedAndRequested$; + + window.addEventListener('keydown', (event) => { + this.ctrlKeyState = event.ctrlKey; + }); + window.addEventListener('keyup', (event) => { + this.ctrlKeyState = event.ctrlKey; + }); + } public ngOnInit(): void { this.paramSubscription = this.route.queryParams.subscribe(params => { this.pagination.page = params?.pageNumber; - this.investigationsFacade.setReceivedInvestigation(this.pagination.page, this.pagination.pageSize, this.pagination.sorting); - this.investigationsFacade.setQueuedAndRequestedInvestigations(this.pagination.page, this.pagination.pageSize, this.pagination.sorting); - }) + this.investigationsFacade.setReceivedInvestigation(this.pagination.page, this.pagination.pageSize, this.investigationReceivedSortList); + this.investigationsFacade.setQueuedAndRequestedInvestigations(this.pagination.page, this.pagination.pageSize, this.investigationQueuedAndRequestedSortList); + }); } public ngAfterViewInit(): void { @@ -81,25 +94,33 @@ export class InvestigationsComponent { public onReceivedTableConfigChanged(pagination: TableEventConfig) { this.pagination = pagination; - this.investigationsFacade.setReceivedInvestigation(this.pagination.page, this.pagination.pageSize, this.pagination.sorting); + this.setTableSortingList(pagination.sorting, NotificationStatusGroup.RECEIVED); + this.investigationsFacade.setReceivedInvestigation(this.pagination.page, this.pagination.pageSize, this.investigationReceivedSortList); } public onQueuedAndRequestedTableConfigChanged(pagination: TableEventConfig) { this.pagination = pagination; - this.investigationsFacade.setQueuedAndRequestedInvestigations(this.pagination.page, this.pagination.pageSize, this.pagination.sorting); + this.setTableSortingList(pagination.sorting, NotificationStatusGroup.QUEUED_AND_REQUESTED); + this.investigationsFacade.setQueuedAndRequestedInvestigations(this.pagination.page, this.pagination.pageSize, this.investigationQueuedAndRequestedSortList); } public openDetailPage(notification: Notification): void { this.investigationDetailFacade.selected = { data: notification }; const { link } = getRoute(INVESTIGATION_BASE_ROUTE); const tabIndex = this.route.snapshot.queryParamMap.get('tabIndex'); - const tabInformation: NotificationTabInformation = {tabIndex: tabIndex, pageNumber: this.pagination.page} - this.router.navigate([`/${link}/${notification.id}`], { queryParams: tabInformation }); + const tabInformation: NotificationTabInformation = { tabIndex: tabIndex, pageNumber: this.pagination.page }; + this.router.navigate([ `/${ link }/${ notification.id }` ], { queryParams: tabInformation }); } public handleConfirmActionCompletedEvent() { this.ngOnInit(); } + private setTableSortingList(sorting: TableHeaderSort, notificationTable: NotificationStatusGroup): void { + const tableSortList = notificationTable === NotificationStatusGroup.RECEIVED ? + this.investigationReceivedSortList : this.investigationQueuedAndRequestedSortList; + TableSortingUtil.setTableSortingList(sorting, tableSortList, this.ctrlKeyState); + } + protected readonly TranslationContext = TranslationContext; } diff --git a/frontend/src/app/modules/page/other-parts/core/other-parts.service.ts b/frontend/src/app/modules/page/other-parts/core/other-parts.service.ts index fda6b4458e..f2830d9721 100644 --- a/frontend/src/app/modules/page/other-parts/core/other-parts.service.ts +++ b/frontend/src/app/modules/page/other-parts/core/other-parts.service.ts @@ -19,56 +19,57 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { HttpParams } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { ApiService } from '@core/api/api.service'; -import { Pagination } from '@core/model/pagination.model'; -import { environment } from '@env'; -import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; -import { Owner } from '@page/parts/model/owner.enum'; -import { Part, PartsResponse } from '@page/parts/model/parts.model'; -import { PartsAssembler } from '@shared/assembler/parts.assembler'; -import { TableHeaderSort } from '@shared/components/table/table.model'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import {HttpParams} from '@angular/common/http'; +import {Injectable} from '@angular/core'; +import {ApiService} from '@core/api/api.service'; +import {Pagination} from '@core/model/pagination.model'; +import {environment} from '@env'; +import {MainAspectType} from '@page/parts/model/mainAspectType.enum'; +import {Owner} from '@page/parts/model/owner.enum'; +import {Part, PartsResponse} from '@page/parts/model/parts.model'; +import {PartsAssembler} from '@shared/assembler/parts.assembler'; +import {TableHeaderSort} from '@shared/components/table/table.model'; +import {Observable} from 'rxjs'; +import {map} from 'rxjs/operators'; @Injectable() export class OtherPartsService { - private url = environment.apiUrl; + private url = environment.apiUrl; - constructor(private readonly apiService: ApiService) {} + constructor(private readonly apiService: ApiService) { + } - public getOtherPartsAsBuilt(page: number, pageSize: number, sorting: TableHeaderSort[], owner: Owner): Observable> { - let sort = sorting.map(sortingItem => PartsAssembler.mapSortToApiSort(sortingItem)); - let params = new HttpParams() - .set('page', page) - .set('size', pageSize) - .set('owner', owner); + public getOtherPartsAsBuilt(page: number, pageSize: number, sorting: TableHeaderSort[], owner: Owner): Observable> { + let sort = sorting.map(sortingItem => PartsAssembler.mapSortToApiSort(sortingItem)); + let params = new HttpParams() + .set('page', page) + .set('size', pageSize) + .set('filter', "owner,EQUAL," + owner); - sort.forEach(sortingItem => { - params = params.append('sort', sortingItem); - }) + sort.forEach(sortingItem => { + params = params.append('sort', sortingItem); + }) - return this.apiService - .getBy(`${this.url}/assets/as-built`, params) - .pipe(map(parts => PartsAssembler.assembleOtherParts(parts, MainAspectType.AS_BUILT))); - } + return this.apiService + .getBy(`${this.url}/assets/as-built`, params) + .pipe(map(parts => PartsAssembler.assembleOtherParts(parts, MainAspectType.AS_BUILT))); + } - public getOtherPartsAsPlanned(page: number, pageSize: number, sorting: TableHeaderSort[], owner: Owner): Observable> { - let sort = sorting.map(sortingItem => PartsAssembler.mapSortToApiSort(sortingItem)); - let params = new HttpParams() - .set('page', page) - .set('size', pageSize) - .set('owner', owner); + public getOtherPartsAsPlanned(page: number, pageSize: number, sorting: TableHeaderSort[], owner: Owner): Observable> { + let sort = sorting.map(sortingItem => PartsAssembler.mapSortToApiSort(sortingItem)); + let params = new HttpParams() + .set('page', page) + .set('size', pageSize) + .set('filter', "owner,EQUAL," + owner); - sort.forEach(sortingItem => { - params = params.append('sort', sortingItem); - }) + sort.forEach(sortingItem => { + params = params.append('sort', sortingItem); + }) - return this.apiService - .getBy(`${this.url}/assets/as-planned`, params) - .pipe(map(parts => PartsAssembler.assembleOtherParts(parts, MainAspectType.AS_BUILT))); - } + return this.apiService + .getBy(`${this.url}/assets/as-planned`, params) + .pipe(map(parts => PartsAssembler.assembleOtherParts(parts, MainAspectType.AS_BUILT))); + } } diff --git a/frontend/src/app/modules/page/other-parts/presentation/customer-parts/customer-parts.component.ts b/frontend/src/app/modules/page/other-parts/presentation/customer-parts/customer-parts.component.ts index 4471d5366a..4acd0c8b5f 100644 --- a/frontend/src/app/modules/page/other-parts/presentation/customer-parts/customer-parts.component.ts +++ b/frontend/src/app/modules/page/other-parts/presentation/customer-parts/customer-parts.component.ts @@ -29,6 +29,7 @@ import { TableEventConfig, TableHeaderSort, } from '@shared/components/table/table.model'; +import { TableSortingUtil } from '@shared/components/table/tableSortingUtil'; import { View } from '@shared/model/view.model'; import { PartDetailsFacade } from '@shared/modules/part-details/core/partDetails.facade'; import { StaticIdService } from '@shared/service/staticId.service'; @@ -36,7 +37,7 @@ import { Observable } from 'rxjs'; @Component({ selector: 'app-customer-parts', - templateUrl: './customer-parts.component.html' + templateUrl: './customer-parts.component.html', }) export class CustomerPartsComponent implements OnInit, OnDestroy { public readonly displayedColumnsAsBuilt: string[] = [ @@ -89,6 +90,7 @@ export class CustomerPartsComponent implements OnInit, OnDestroy { @Input() public bomLifecycle: MainAspectType; + constructor( private readonly otherPartsFacade: OtherPartsFacade, private readonly partDetailsFacade: PartDetailsFacade, @@ -105,11 +107,11 @@ export class CustomerPartsComponent implements OnInit, OnDestroy { } public ngOnInit(): void { - if(this.bomLifecycle === MainAspectType.AS_BUILT) { + if (this.bomLifecycle === MainAspectType.AS_BUILT) { this.customerPartsAsBuilt$ = this.otherPartsFacade.customerPartsAsBuilt$; this.tableCustomerAsBuiltSortList = []; this.otherPartsFacade.setCustomerPartsAsBuilt(); - } else if(this.bomLifecycle === MainAspectType.AS_PLANNED) { + } else if (this.bomLifecycle === MainAspectType.AS_PLANNED) { this.customerPartsAsPlanned$ = this.otherPartsFacade.customerPartsAsPlanned$; this.tableCustomerAsPlannedSortList = []; this.otherPartsFacade.setCustomerPartsAsPlanned(); @@ -117,18 +119,18 @@ export class CustomerPartsComponent implements OnInit, OnDestroy { } public ngAfterViewInit(): void { - if(this.bomLifecycle === MainAspectType.AS_BUILT) { + if (this.bomLifecycle === MainAspectType.AS_BUILT) { this.tableConfigAsBuilt = { displayedColumns: this.displayedColumnsAsBuilt, header: CreateHeaderFromColumns(this.displayedColumnsAsBuilt, 'table.column'), sortableColumns: this.sortableColumnsAsBuilt, - } - } else if(this.bomLifecycle === MainAspectType.AS_PLANNED) { + }; + } else if (this.bomLifecycle === MainAspectType.AS_PLANNED) { this.tableConfigAsPlanned = { displayedColumns: this.displayedColumnsAsPlanned, header: CreateHeaderFromColumns(this.displayedColumnsAsPlanned, 'table.column'), sortableColumns: this.sortableColumnsAsPlanned, - } + }; } } @@ -141,8 +143,8 @@ export class CustomerPartsComponent implements OnInit, OnDestroy { } public onAsBuiltTableConfigChange({ page, pageSize, sorting }: TableEventConfig): void { - this.setTableSortingList(sorting, MainAspectType.AS_BUILT); - this.otherPartsFacade.setCustomerPartsAsBuilt(page, pageSize, this.tableCustomerAsBuiltSortList); + this.setTableSortingList(sorting, MainAspectType.AS_BUILT); + this.otherPartsFacade.setCustomerPartsAsBuilt(page, pageSize, this.tableCustomerAsBuiltSortList); } public onAsPlannedTableConfigChange({ page, pageSize, sorting }: TableEventConfig): void { @@ -150,50 +152,9 @@ export class CustomerPartsComponent implements OnInit, OnDestroy { this.otherPartsFacade.setCustomerPartsAsPlanned(page, pageSize, this.tableCustomerAsPlannedSortList); } - private setTableSortingList(sorting: TableHeaderSort, partTable: MainAspectType): void { - if(!sorting && (this.tableCustomerAsBuiltSortList || this.tableCustomerAsPlannedSortList)) { - this.resetTableSortingList(partTable); - return; - } - - if(this.ctrlKeyState) { - const [columnName] = sorting; - const tableSortList = partTable === MainAspectType.AS_BUILT ? this.tableCustomerAsBuiltSortList : this.tableCustomerAsPlannedSortList; - - // Find the index of the existing entry with the same first item - const index = tableSortList.findIndex( - ([itemColumnName]) => itemColumnName === columnName - ); - - if (index !== -1) { - // Replace the existing entry - tableSortList[index] = sorting; - } else { - // Add the new entry if it doesn't exist - tableSortList.push(sorting); - } - - if(partTable === MainAspectType.AS_BUILT) { - this.tableCustomerAsBuiltSortList = tableSortList - } else { - this.tableCustomerAsPlannedSortList = tableSortList - } - } - // If CTRL is not pressed just add a list with one entry - else if(partTable === MainAspectType.AS_BUILT) { - this.tableCustomerAsBuiltSortList = [sorting]; - } else { - this.tableCustomerAsPlannedSortList = [sorting] - } - } - - private resetTableSortingList(partTable: MainAspectType): void { - if(partTable === MainAspectType.AS_BUILT) { - this.tableCustomerAsBuiltSortList = []; - } else { - this.tableCustomerAsPlannedSortList= []; - } + const tableSortList = partTable === MainAspectType.AS_BUILT ? this.tableCustomerAsBuiltSortList : this.tableCustomerAsPlannedSortList; + TableSortingUtil.setTableSortingList(sorting, tableSortList, this.ctrlKeyState); } protected readonly MainAspectType = MainAspectType; diff --git a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.ts b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.ts index c4b5d7cf91..f21d8c1031 100644 --- a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.ts +++ b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.ts @@ -29,6 +29,7 @@ import { TableEventConfig, TableHeaderSort, } from '@shared/components/table/table.model'; +import { TableSortingUtil } from '@shared/components/table/tableSortingUtil'; import { View } from '@shared/model/view.model'; import { PartDetailsFacade } from '@shared/modules/part-details/core/partDetails.facade'; import { StaticIdService } from '@shared/service/staticId.service'; @@ -37,7 +38,7 @@ import { BehaviorSubject, Observable, Subject } from 'rxjs'; @Component({ selector: 'app-supplier-parts', templateUrl: './supplier-parts.component.html', - styleUrls: ['../other-parts.component.scss'] + styleUrls: [ '../other-parts.component.scss' ], }) export class SupplierPartsComponent implements OnInit, OnDestroy { public readonly displayedColumnsAsBuilt: string[] = [ @@ -80,8 +81,8 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { public tableConfigAsBuilt: TableConfig; public tableConfigAsPlanned: TableConfig; - public supplierPartsAsBuilt$: Observable>>; - public supplierPartsAsPlanned$: Observable>>; + public supplierPartsAsBuilt$: Observable>>; + public supplierPartsAsPlanned$: Observable>>; public readonly deselectPartTrigger$ = new Subject(); public readonly addPartTrigger$ = new Subject(); @@ -116,8 +117,11 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { public get currentSelectedItems(): Part[] { this.selectedItems = this.selectedItems.map(part => { - return {...part, semanticDataModel: SemanticDataModel[part.semanticDataModel.toUpperCase() as keyof typeof SemanticDataModel]} - }) + return { + ...part, + semanticDataModel: SemanticDataModel[part.semanticDataModel.toUpperCase() as keyof typeof SemanticDataModel], + }; + }); return this.selectedItems || []; } @@ -126,11 +130,11 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { } public ngOnInit(): void { - if(this.bomLifecycle === MainAspectType.AS_BUILT) { + if (this.bomLifecycle === MainAspectType.AS_BUILT) { this.supplierPartsAsBuilt$ = this.otherPartsFacade.supplierPartsAsBuilt$; this.tableSupplierAsBuiltSortList = []; this.otherPartsFacade.setSupplierPartsAsBuilt(); - } else if(this.bomLifecycle === MainAspectType.AS_PLANNED) { + } else if (this.bomLifecycle === MainAspectType.AS_PLANNED) { this.supplierPartsAsPlanned$ = this.otherPartsFacade.supplierPartsAsPlanned$; this.tableSupplierAsPlannedSortList = []; this.otherPartsFacade.setSupplierPartsAsPlanned(); @@ -139,14 +143,14 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { public ngAfterViewInit(): void { - if(this.bomLifecycle === MainAspectType.AS_BUILT) { + if (this.bomLifecycle === MainAspectType.AS_BUILT) { this.tableConfigAsBuilt = { displayedColumns: this.displayedColumnsAsBuilt, header: CreateHeaderFromColumns(this.displayedColumnsAsBuilt, 'table.column'), sortableColumns: this.sortableColumnsAsBuilt, }; - } else if(this.bomLifecycle === MainAspectType.AS_PLANNED) { + } else if (this.bomLifecycle === MainAspectType.AS_PLANNED) { this.tableConfigAsPlanned = { displayedColumns: this.displayedColumnsAsPlanned, header: CreateHeaderFromColumns(this.displayedColumnsAsPlanned, 'table.column'), @@ -166,8 +170,8 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { } public onAsBuiltTableConfigChange({ page, pageSize, sorting }: TableEventConfig): void { - this.setTableSortingList(sorting, MainAspectType.AS_BUILT); - this.otherPartsFacade.setSupplierPartsAsBuilt(page, pageSize, this.tableSupplierAsBuiltSortList); + this.setTableSortingList(sorting, MainAspectType.AS_BUILT); + this.otherPartsFacade.setSupplierPartsAsBuilt(page, pageSize, this.tableSupplierAsBuiltSortList); } public onAsPlannedTableConfigChange({ page, pageSize, sorting }: TableEventConfig): void { @@ -180,7 +184,7 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { } public removeItemFromSelection(part: Part): void { - this.deselectPartTrigger$.next([part]); + this.deselectPartTrigger$.next([ part ]); this.currentSelectedItems = this.currentSelectedItems.filter(({ id }) => id !== part.id); } @@ -191,7 +195,7 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { public addItemToSelection(part: Part): void { this.addPartTrigger$.next(part); - this.currentSelectedItems = [...this.currentSelectedItems, part]; + this.currentSelectedItems = [ ...this.currentSelectedItems, part ]; } public submit(): void { @@ -200,48 +204,8 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { private setTableSortingList(sorting: TableHeaderSort, partTable: MainAspectType): void { - if(!sorting && (this.tableSupplierAsBuiltSortList || this.tableSupplierAsPlannedSortList)) { - this.resetTableSortingList(partTable); - return; - } - - if(this.ctrlKeyState) { - const [columnName] = sorting; - const tableSortList = partTable === MainAspectType.AS_BUILT ? this.tableSupplierAsBuiltSortList : this.tableSupplierAsPlannedSortList; - - // Find the index of the existing entry with the same first item - const index = tableSortList.findIndex( - ([itemColumnName]) => itemColumnName === columnName - ); - - if (index !== -1) { - // Replace the existing entry - tableSortList[index] = sorting; - } else { - // Add the new entry if it doesn't exist - tableSortList.push(sorting); - } - - if(partTable === MainAspectType.AS_BUILT) { - this.tableSupplierAsBuiltSortList = tableSortList - } else { - this.tableSupplierAsPlannedSortList = tableSortList - } - } - // If CTRL is not pressed just add a list with one entry - else if(partTable === MainAspectType.AS_BUILT) { - this.tableSupplierAsBuiltSortList = [sorting]; - } else { - this.tableSupplierAsPlannedSortList = [sorting] - } - } - - private resetTableSortingList(partTable: MainAspectType): void { - if(partTable === MainAspectType.AS_BUILT) { - this.tableSupplierAsBuiltSortList = []; - } else { - this.tableSupplierAsPlannedSortList= []; - } + const tableSortList = partTable === MainAspectType.AS_BUILT ? this.tableSupplierAsBuiltSortList : this.tableSupplierAsPlannedSortList; + TableSortingUtil.setTableSortingList(sorting, tableSortList, this.ctrlKeyState); } protected readonly MainAspectType = MainAspectType; diff --git a/frontend/src/app/modules/page/parts/presentation/parts.component.spec.ts b/frontend/src/app/modules/page/parts/presentation/parts.component.spec.ts index f8846bbc47..e047f93eb8 100644 --- a/frontend/src/app/modules/page/parts/presentation/parts.component.spec.ts +++ b/frontend/src/app/modules/page/parts/presentation/parts.component.spec.ts @@ -112,7 +112,6 @@ describe('Parts', () => { expect(setTableFunctionSpy).toHaveBeenCalledWith(['id', 'asc'], "as_built" ); expect(setTableFunctionSpy).toHaveBeenCalledWith(['idShort', 'asc'], "as_built" ); - console.warn(partsComponent.tableAsBuiltSortList); expect(partsComponent['tableAsBuiltSortList']).toEqual([["id", "asc"], ["idShort", "desc"]]); }); diff --git a/frontend/src/app/modules/page/parts/presentation/parts.component.ts b/frontend/src/app/modules/page/parts/presentation/parts.component.ts index 16af99cfd8..c7aeb6d826 100644 --- a/frontend/src/app/modules/page/parts/presentation/parts.component.ts +++ b/frontend/src/app/modules/page/parts/presentation/parts.component.ts @@ -19,232 +19,188 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import {AfterViewInit, Component, OnDestroy, OnInit} from '@angular/core'; -import {Pagination} from '@core/model/pagination.model'; -import {PartsFacade} from '@page/parts/core/parts.facade'; -import {MainAspectType} from '@page/parts/model/mainAspectType.enum'; -import {Part} from '@page/parts/model/parts.model'; +import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core'; +import { Pagination } from '@core/model/pagination.model'; +import { PartsFacade } from '@page/parts/core/parts.facade'; +import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; +import { Part } from '@page/parts/model/parts.model'; +import { BomLifecycleSize } from '@shared/components/bom-lifecycle-activator/bom-lifecycle-activator.model'; import { - CreateHeaderFromColumns, - TableConfig, - TableEventConfig, - TableHeaderSort, + CreateHeaderFromColumns, + TableConfig, + TableEventConfig, + TableHeaderSort, } from '@shared/components/table/table.model'; -import {View} from '@shared/model/view.model'; -import {PartDetailsFacade} from '@shared/modules/part-details/core/partDetails.facade'; -import {StaticIdService} from '@shared/service/staticId.service'; -import {BehaviorSubject, Observable, Subject} from 'rxjs'; -import {BomLifecycleSize} from "@shared/components/bom-lifecycle-activator/bom-lifecycle-activator.model"; -import {BomLifecycleSettingsService, UserSettingView} from "@shared/service/bom-lifecycle-settings.service"; - +import { TableSortingUtil } from '@shared/components/table/tableSortingUtil'; +import { View } from '@shared/model/view.model'; +import { PartDetailsFacade } from '@shared/modules/part-details/core/partDetails.facade'; +import { BomLifecycleSettingsService, UserSettingView } from '@shared/service/bom-lifecycle-settings.service'; +import { StaticIdService } from '@shared/service/staticId.service'; +import { BehaviorSubject, Observable, Subject } from 'rxjs'; @Component({ - selector: 'app-parts', - templateUrl: './parts.component.html', - styleUrls: ['./parts.component.scss'], + selector: 'app-parts', + templateUrl: './parts.component.html', + styleUrls: [ './parts.component.scss' ], }) export class PartsComponent implements OnInit, OnDestroy, AfterViewInit { - public readonly displayedColumnsAsBuilt: string[] = [ - 'select', - 'id', - 'idShort', - 'name', // nameAtManufacturer - 'manufacturer', - 'partId', // Part number / Batch Number / JIS Number - 'manufacturerPartId', - 'customerPartId', // --> semanticModel.customerPartId - 'classification', - //'nameAtManufacturer', --> already in name - 'nameAtCustomer', // --> semanticModel.nameAtCustomer - 'semanticModelId', - 'semanticDataModel', - 'manufacturingDate', - 'manufacturingCountry', - ]; - - - public readonly displayedColumnsAsPlanned: string[] = [ - 'select', - 'id', - 'idShort', - 'name', - 'manufacturer', - 'manufacturerPartId', - 'classification', - 'semanticDataModel', - 'semanticModelId', - 'validityPeriodFrom', - 'validityPeriodTo', - 'psFunction', - 'catenaXSiteId', - 'functionValidFrom', - 'functionValidUntil', - ]; - - public readonly sortableColumnsAsBuilt: Record = { - id: true, - idShort: true, - name: true, - manufacturer: true, - partId: true, - manufacturerPartId: true, - customerPartId: true, - classification: true, - nameAtCustomer: true, - semanticModelId: true, - semanticDataModel: true, - manufacturingDate: true, - manufacturingCountry: true, - + public readonly displayedColumnsAsBuilt: string[] = [ + 'select', + 'id', + 'idShort', + 'name', // nameAtManufacturer + 'manufacturer', + 'partId', // Part number / Batch Number / JIS Number + 'manufacturerPartId', + 'customerPartId', // --> semanticModel.customerPartId + 'classification', + //'nameAtManufacturer', --> already in name + 'nameAtCustomer', // --> semanticModel.nameAtCustomer + 'semanticModelId', + 'semanticDataModel', + 'manufacturingDate', + 'manufacturingCountry', + ]; + + + public readonly displayedColumnsAsPlanned: string[] = [ + 'select', + 'id', + 'idShort', + 'name', + 'manufacturer', + 'manufacturerPartId', + 'classification', + 'semanticDataModel', + 'semanticModelId', + 'validityPeriodFrom', + 'validityPeriodTo', + 'psFunction', + 'catenaXSiteId', + 'functionValidFrom', + 'functionValidUntil', + ]; + + public readonly sortableColumnsAsBuilt: Record = { + id: true, + idShort: true, + name: true, + manufacturer: true, + partId: true, + manufacturerPartId: true, + customerPartId: true, + classification: true, + nameAtCustomer: true, + semanticModelId: true, + semanticDataModel: true, + manufacturingDate: true, + manufacturingCountry: true, + + }; + + public readonly sortableColumnsAsPlanned: Record = { + id: true, + idShort: true, + name: true, + manufacturer: true, + manufacturerPartId: true, + classification: true, + semanticDataModel: true, + semanticModelId: true, + validityPeriodFrom: true, + validityPeriodTo: true, + psFunction: true, + catenaXSiteId: true, + functionValidFrom: true, + functionValidUntil: true, + }; + + public readonly titleId = this.staticIdService.generateId('PartsComponent.title'); + public readonly partsAsBuilt$: Observable>>; + public readonly partsAsPlanned$: Observable>>; + + public readonly isAlertOpen$ = new BehaviorSubject(false); + + public readonly deselectPartTrigger$ = new Subject(); + public readonly addPartTrigger$ = new Subject(); + public readonly currentSelectedItems$ = new BehaviorSubject([]); + + public tableAsBuiltSortList: TableHeaderSort[]; + public tableAsPlannedSortList: TableHeaderSort[]; + + public tableConfigAsBuilt: TableConfig; + public tableConfigAsPlanned: TableConfig; + public bomLifecycleSize: BomLifecycleSize = this.userSettingService.getSize(UserSettingView.PARTS); + protected readonly UserSettingView = UserSettingView; + private ctrlKeyState = false; + + constructor( + private readonly partsFacade: PartsFacade, + private readonly partDetailsFacade: PartDetailsFacade, + private readonly staticIdService: StaticIdService, + private readonly userSettingService: BomLifecycleSettingsService, + ) { + this.partsAsBuilt$ = this.partsFacade.partsAsBuilt$; + this.partsAsPlanned$ = this.partsFacade.partsAsPlanned$; + this.tableAsBuiltSortList = []; + this.tableAsPlannedSortList = []; + + window.addEventListener('keydown', (event) => { + this.ctrlKeyState = event.ctrlKey; + }); + window.addEventListener('keyup', (event) => { + this.ctrlKeyState = event.ctrlKey; + }); + } + + public ngOnInit(): void { + this.partsFacade.setPartsAsBuilt(); + this.partsFacade.setPartsAsPlanned(); + } + + public ngAfterViewInit(): void { + this.tableConfigAsBuilt = { + displayedColumns: this.displayedColumnsAsBuilt, + header: CreateHeaderFromColumns(this.displayedColumnsAsBuilt, 'table.column'), + sortableColumns: this.sortableColumnsAsBuilt, }; - - public readonly sortableColumnsAsPlanned: Record = { - id: true, - idShort: true, - name: true, - manufacturer: true, - manufacturerPartId: true, - classification: true, - semanticDataModel: true, - semanticModelId: true, - validityPeriodFrom: true, - validityPeriodTo: true, - psFunction: true, - catenaXSiteId: true, - functionValidFrom: true, - functionValidUntil: true, + this.tableConfigAsPlanned = { + displayedColumns: this.displayedColumnsAsPlanned, + header: CreateHeaderFromColumns(this.displayedColumnsAsPlanned, 'table.column'), + sortableColumns: this.sortableColumnsAsPlanned, }; - public readonly titleId = this.staticIdService.generateId('PartsComponent.title'); - public readonly partsAsBuilt$: Observable>>; - public readonly partsAsPlanned$: Observable>>; - - public readonly isAlertOpen$ = new BehaviorSubject(false); - - public readonly deselectPartTrigger$ = new Subject(); - public readonly addPartTrigger$ = new Subject(); - public readonly currentSelectedItems$ = new BehaviorSubject([]); - - public tableAsBuiltSortList: TableHeaderSort[]; - public tableAsPlannedSortList: TableHeaderSort[]; - - public tableConfigAsBuilt: TableConfig; - public tableConfigAsPlanned: TableConfig; - - private ctrlKeyState = false; - - - constructor( - private readonly partsFacade: PartsFacade, - private readonly partDetailsFacade: PartDetailsFacade, - private readonly staticIdService: StaticIdService, - private readonly userSettingService: BomLifecycleSettingsService - ) { - this.partsAsBuilt$ = this.partsFacade.partsAsBuilt$; - this.partsAsPlanned$ = this.partsFacade.partsAsPlanned$; - this.tableAsBuiltSortList = []; - this.tableAsPlannedSortList = []; - - window.addEventListener('keydown', (event) => { - this.ctrlKeyState = event.ctrlKey; - }); - window.addEventListener('keyup', (event) => { - this.ctrlKeyState = event.ctrlKey; - }); - } - - public bomLifecycleSize: BomLifecycleSize = this.userSettingService.getSize(UserSettingView.PARTS); - - - public ngOnInit(): void { - this.partsFacade.setPartsAsBuilt(); - this.partsFacade.setPartsAsPlanned(); - } - - public ngAfterViewInit(): void { - this.tableConfigAsBuilt = { - displayedColumns: this.displayedColumnsAsBuilt, - header: CreateHeaderFromColumns(this.displayedColumnsAsBuilt, 'table.column'), - sortableColumns: this.sortableColumnsAsBuilt, - }; - this.tableConfigAsPlanned = { - displayedColumns: this.displayedColumnsAsPlanned, - header: CreateHeaderFromColumns(this.displayedColumnsAsPlanned, 'table.column'), - sortableColumns: this.sortableColumnsAsPlanned, - } - - this.handleTableActivationEvent(this.bomLifecycleSize); - } - - public ngOnDestroy(): void { - this.partsFacade.unsubscribeParts(); - } - - public onSelectItem($event: Record): void { - this.partDetailsFacade.selectedPart = $event as unknown as Part; - } - - public onAsBuiltTableConfigChange({page, pageSize, sorting}: TableEventConfig): void { - this.setTableSortingList(sorting, MainAspectType.AS_BUILT); - this.partsFacade.setPartsAsBuilt(page, pageSize, this.tableAsBuiltSortList); - } - - public onAsPlannedTableConfigChange({page, pageSize, sorting}: TableEventConfig): void { - this.setTableSortingList(sorting, MainAspectType.AS_PLANNED); - this.partsFacade.setPartsAsPlanned(page, pageSize, this.tableAsPlannedSortList); - } - - public handleTableActivationEvent(bomLifecycleSize: BomLifecycleSize) { - this.bomLifecycleSize = bomLifecycleSize; - } - - private setTableSortingList(sorting: TableHeaderSort, partTable: MainAspectType): void { - // if a sorting Columnlist exists but a column gets resetted: - if (!sorting && (this.tableAsBuiltSortList || this.tableAsPlannedSortList)) { - this.resetTableSortingList(partTable); - return; - } - - // if CTRL is pressed at to sortList - if (this.ctrlKeyState) { - const [columnName] = sorting; - const tableSortList = partTable === MainAspectType.AS_BUILT ? this.tableAsBuiltSortList : this.tableAsPlannedSortList - - // Find the index of the existing entry with the same first item - const index = tableSortList.findIndex( - ([itemColumnName]) => itemColumnName === columnName - ); - - if (index !== -1) { - // Replace the existing entry - tableSortList[index] = sorting; - } else { - // Add the new entry if it doesn't exist - tableSortList.push(sorting); - } - if (partTable === MainAspectType.AS_BUILT) { - this.tableAsBuiltSortList = tableSortList - } else { - this.tableAsPlannedSortList = tableSortList - } - } - // If CTRL is not pressed just add a list with one entry - else if (partTable === MainAspectType.AS_BUILT) { - this.tableAsBuiltSortList = [sorting]; - } else { - this.tableAsPlannedSortList = [sorting] - } - } - - private resetTableSortingList(partTable: MainAspectType): void { - if (partTable === MainAspectType.AS_BUILT) { - this.tableAsBuiltSortList = []; - } else { - this.tableAsPlannedSortList = []; - } - } - - protected readonly UserSettingView = UserSettingView; + this.handleTableActivationEvent(this.bomLifecycleSize); + } + + public ngOnDestroy(): void { + this.partsFacade.unsubscribeParts(); + } + + public onSelectItem($event: Record): void { + this.partDetailsFacade.selectedPart = $event as unknown as Part; + } + + public onAsBuiltTableConfigChange({ page, pageSize, sorting }: TableEventConfig): void { + this.setTableSortingList(sorting, MainAspectType.AS_BUILT); + this.partsFacade.setPartsAsBuilt(page, pageSize, this.tableAsBuiltSortList); + } + + public onAsPlannedTableConfigChange({ page, pageSize, sorting }: TableEventConfig): void { + this.setTableSortingList(sorting, MainAspectType.AS_PLANNED); + this.partsFacade.setPartsAsPlanned(page, pageSize, this.tableAsPlannedSortList); + } + + public handleTableActivationEvent(bomLifecycleSize: BomLifecycleSize) { + this.bomLifecycleSize = bomLifecycleSize; + } + + private setTableSortingList(sorting: TableHeaderSort, partTable: MainAspectType): void { + const tableSortingList = partTable === MainAspectType.AS_BUILT ? + this.tableAsBuiltSortList : this.tableAsPlannedSortList; + TableSortingUtil.setTableSortingList(sorting, tableSortingList, this.ctrlKeyState); + + } } diff --git a/frontend/src/app/modules/shared/assembler/notification.assembler.spec.ts b/frontend/src/app/modules/shared/assembler/notification.assembler.spec.ts index 4a108d8e7b..6d0ac66278 100644 --- a/frontend/src/app/modules/shared/assembler/notification.assembler.spec.ts +++ b/frontend/src/app/modules/shared/assembler/notification.assembler.spec.ts @@ -20,15 +20,20 @@ ********************************************************************************/ import { CalendarDateModel } from '@core/model/calendar-date.model'; -import { Notification, NotificationResponse, NotificationStatus } from '@shared/model/notification.model'; +import { + Notification, + NotificationResponse, + NotificationStatus, + NotificationType, +} from '@shared/model/notification.model'; import { Severity } from '@shared/model/severity.model'; import { NotificationAssembler } from './notification.assembler'; describe('InvestigationsAssembler', () => { it('should handle null response', () => { const emptyPage = { content: [], page: 0, pageCount: 0, pageSize: 0, totalItems: 0 }; - expect(NotificationAssembler.assembleNotifications(null)).toEqual(emptyPage); - expect(NotificationAssembler.assembleNotifications(undefined)).toEqual(emptyPage); + expect(NotificationAssembler.assembleNotifications(null, NotificationType.INVESTIGATION)).toEqual(emptyPage); + expect(NotificationAssembler.assembleNotifications(undefined, NotificationType.INVESTIGATION)).toEqual(emptyPage); }); it('should handle empty values', () => { @@ -45,9 +50,10 @@ describe('InvestigationsAssembler', () => { createdDate: new CalendarDateModel(null), targetDate: new CalendarDateModel(null), bpn: '', + notificationType: NotificationType.INVESTIGATION }; - expect(NotificationAssembler.assembleNotification({} as NotificationResponse)).toEqual(expected); + expect(NotificationAssembler.assembleNotification({} as NotificationResponse, NotificationType.INVESTIGATION)).toEqual(expected); }); it('should map properly response', () => { @@ -88,7 +94,7 @@ describe('InvestigationsAssembler', () => { assetIds: [], }, ], - }), + }, NotificationType.INVESTIGATION), ).toEqual({ page: 0, pageCount: 1, @@ -108,6 +114,7 @@ describe('InvestigationsAssembler', () => { reason: { close: '', accept: '', decline: '' }, isFromSender: true, assetIds: [], + notificationType: NotificationType.INVESTIGATION }, { id: 'test-2', @@ -122,6 +129,7 @@ describe('InvestigationsAssembler', () => { reason: { close: '', accept: '', decline: '' }, isFromSender: true, assetIds: [], + notificationType: NotificationType.INVESTIGATION }, ], }); diff --git a/frontend/src/app/modules/shared/assembler/notification.assembler.ts b/frontend/src/app/modules/shared/assembler/notification.assembler.ts index 0ae6245c6e..d4f52cadd1 100644 --- a/frontend/src/app/modules/shared/assembler/notification.assembler.ts +++ b/frontend/src/app/modules/shared/assembler/notification.assembler.ts @@ -27,15 +27,15 @@ import { NotificationResponse, Notifications, NotificationsResponse, - NotificationStatus, + NotificationStatus, NotificationType, } from '../model/notification.model'; export class NotificationAssembler { - public static assembleNotifications(response: NotificationsResponse): Notifications { - return PaginationAssembler.assemblePagination(NotificationAssembler.assembleNotification, response); + public static assembleNotifications(response: NotificationsResponse, notificationType: NotificationType): Notifications { + return PaginationAssembler.assemblePagination(NotificationAssembler.assembleNotification, response, notificationType); } - public static assembleNotification(response: NotificationResponse): Notification { + public static assembleNotification(response: NotificationResponse, myNotificationType: NotificationType): Notification { const { id = null, assetIds = null, @@ -63,6 +63,7 @@ export class NotificationAssembler { const createdBy = { bpn: _createdBy, name: _createdByName }; const sendTo = { bpn: _sendTo, name: _sendToName }; const errorMessage = _errorMessage || undefined; + const notificationType = myNotificationType || undefined; let assembled = { id, @@ -77,6 +78,7 @@ export class NotificationAssembler { createdDate, targetDate, bpn, + notificationType }; return errorMessage ? {...assembled, errorMessage: errorMessage} : assembled; diff --git a/frontend/src/app/modules/shared/components/table/tableSortingUtil.ts b/frontend/src/app/modules/shared/components/table/tableSortingUtil.ts new file mode 100644 index 0000000000..eb6a6bdbc0 --- /dev/null +++ b/frontend/src/app/modules/shared/components/table/tableSortingUtil.ts @@ -0,0 +1,48 @@ +import { TableHeaderSort } from '@shared/components/table/table.model'; + +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +export class TableSortingUtil { + + static setTableSortingList(sorting: TableHeaderSort, tableSortList: TableHeaderSort[], ctrlKeyState: boolean) { + if (!sorting && tableSortList) { + tableSortList.length = 0; + return; + } + + // If CTRL is not pressed, just set the sorting list with one entry + if (!ctrlKeyState) { + tableSortList.length = 0; + tableSortList.push(sorting); + return; + } + + const [ columnName ] = sorting; + const index = tableSortList.findIndex(([ itemColumnName ]) => itemColumnName === columnName); + + if (index !== -1) { + // Replace the existing entry + tableSortList[index] = sorting; + } else { + // Add the new entry if it doesn't exist + tableSortList.push(sorting); + } + } + +} diff --git a/frontend/src/app/modules/shared/model/notification.model.ts b/frontend/src/app/modules/shared/model/notification.model.ts index f001554c21..23ad43585c 100644 --- a/frontend/src/app/modules/shared/model/notification.model.ts +++ b/frontend/src/app/modules/shared/model/notification.model.ts @@ -55,6 +55,11 @@ export interface NotificationUser { name?: string; } +export enum NotificationType { + INVESTIGATION = "Investigation", + ALERT = "Alert" +} + export interface NotificationResponse { id: string; description: string; @@ -89,6 +94,8 @@ export interface Notification { targetDate?: CalendarDateModel; bpn?: string; errorMessage?: string; + + notificationType?: NotificationType; } export type NotificationsResponse = PaginationResponse; diff --git a/frontend/src/app/modules/shared/modules/notification/notification-tab/notification-tab.component.html b/frontend/src/app/modules/shared/modules/notification/notification-tab/notification-tab.component.html index 9da965421b..a487d96237 100644 --- a/frontend/src/app/modules/shared/modules/notification/notification-tab/notification-tab.component.html +++ b/frontend/src/app/modules/shared/modules/notification/notification-tab/notification-tab.component.html @@ -29,6 +29,7 @@ [noShadow]="true" [labelId]="labelId" [showHover]="false" + [multiSortList]="multiSortList" (selected)="selectNotification($event)" (configChanged)="onTableConfigChange($event)" > diff --git a/frontend/src/app/modules/shared/modules/notification/notification-tab/notification-tab.component.ts b/frontend/src/app/modules/shared/modules/notification/notification-tab/notification-tab.component.ts index 45ff4035e6..a053cbff2d 100644 --- a/frontend/src/app/modules/shared/modules/notification/notification-tab/notification-tab.component.ts +++ b/frontend/src/app/modules/shared/modules/notification/notification-tab/notification-tab.component.ts @@ -25,7 +25,7 @@ import { DisplayColumns, MenuActionConfig, TableConfig, - TableEventConfig, + TableEventConfig, TableHeaderSort, } from '@shared/components/table/table.model'; import { Notification, Notifications } from '@shared/model/notification.model'; import { View } from '@shared/model/view.model'; @@ -44,6 +44,7 @@ export class NotificationTabComponent implements AfterViewInit { @Input() menuActionsConfig: MenuActionConfig[]; @Input() optionalColumns: Array<'targetDate' | 'severity' | 'createdBy' | 'sendTo'> = []; @Input() sortableColumns: Record = {}; + @Input() multiSortList: TableHeaderSort[] = []; @Output() tableConfigChanged = new EventEmitter(); @Output() selected = new EventEmitter(); @@ -76,6 +77,7 @@ export class NotificationTabComponent implements AfterViewInit { sendTo: this.userTemplate, }, }; + } public selectNotification(notification: Record): void { @@ -85,4 +87,7 @@ export class NotificationTabComponent implements AfterViewInit { public onTableConfigChange(tableEventConfig: TableEventConfig): void { this.tableConfigChanged.emit(tableEventConfig); } + + + } diff --git a/frontend/src/app/modules/shared/modules/notification/presentation/notification.component.html b/frontend/src/app/modules/shared/modules/notification/presentation/notification.component.html index 3f94a18df0..481c115972 100644 --- a/frontend/src/app/modules/shared/modules/notification/presentation/notification.component.html +++ b/frontend/src/app/modules/shared/modules/notification/presentation/notification.component.html @@ -39,6 +39,7 @@ [menuActionsConfig]="menuActionsConfig" [optionalColumns]="receivedOptionalColumns" [sortableColumns]="receivedSortableColumns" + [multiSortList]="receivedMultiSortList" (tableConfigChanged)="onReceivedTableConfigChanged.emit($event)" (selected)="selected.emit($event)" > @@ -57,6 +58,7 @@ [menuActionsConfig]="menuActionsConfig" [optionalColumns]="queuedAndRequestedOptionalColumns" [sortableColumns]="queuedAndRequestedSortableColumns" + [multiSortList]="queuedAndRequestedMultiSortList" (tableConfigChanged)="onQueuedAndRequestedTableConfigChanged.emit($event)" (selected)="selected.emit($event)" > diff --git a/frontend/src/app/modules/shared/modules/notification/presentation/notification.component.ts b/frontend/src/app/modules/shared/modules/notification/presentation/notification.component.ts index 023bbd93ae..c2f6ac387d 100644 --- a/frontend/src/app/modules/shared/modules/notification/presentation/notification.component.ts +++ b/frontend/src/app/modules/shared/modules/notification/presentation/notification.component.ts @@ -21,7 +21,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { MenuActionConfig, TableEventConfig } from '@shared/components/table/table.model'; +import { MenuActionConfig, TableEventConfig, TableHeaderSort } from '@shared/components/table/table.model'; import { Notification, Notifications } from '@shared/model/notification.model'; import { View } from '@shared/model/view.model'; import { StaticIdService } from '@shared/service/staticId.service'; @@ -41,6 +41,8 @@ export class NotificationComponent { @Input() receivedSortableColumns: Record = {}; @Input() queuedAndRequestedOptionalColumns: Array<'targetDate' | 'severity' | 'sendTo'> = []; @Input() queuedAndRequestedSortableColumns: Record = {}; + @Input() receivedMultiSortList: TableHeaderSort[] = []; + @Input() queuedAndRequestedMultiSortList: TableHeaderSort[] = []; @Output() onReceivedTableConfigChanged = new EventEmitter(); @Output() onQueuedAndRequestedTableConfigChanged = new EventEmitter(); diff --git a/frontend/src/app/modules/shared/service/alerts.service.ts b/frontend/src/app/modules/shared/service/alerts.service.ts index f7c5cfe44d..4bc549da45 100644 --- a/frontend/src/app/modules/shared/service/alerts.service.ts +++ b/frontend/src/app/modules/shared/service/alerts.service.ts @@ -30,10 +30,12 @@ import type { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { Notification, - NotificationCreateResponse, NotificationResponse, + NotificationCreateResponse, + NotificationResponse, Notifications, NotificationsResponse, NotificationStatus, + NotificationType, } from '../model/notification.model'; @Injectable({ @@ -44,29 +46,40 @@ export class AlertsService { constructor(private readonly apiService: ApiService) {} - public getCreatedAlerts(page: number, pageSize: number, sorting: TableHeaderSort): Observable { - const sort = sorting ? `${sorting[0]},${sorting[1]}` : 'createdDate,desc'; + public getCreatedAlerts(page: number, pageSize: number, sorting: TableHeaderSort[]): Observable { + let sort = sorting.length ? sorting : ['createdDate,desc']; + let params = new HttpParams() + .set('page', page) + .set('size', pageSize) - const params = new HttpParams().set('page', page).set('size', pageSize).set('sort', sort); + sort.forEach(sortingItem => { + params = params.append('sort', sortingItem); + }) return this.apiService .getBy(`${this.url}/alerts/created`, params) - .pipe(map(alerts => NotificationAssembler.assembleNotifications(alerts))); + .pipe(map(alerts => NotificationAssembler.assembleNotifications(alerts, NotificationType.ALERT))); } - public getReceivedAlerts(page: number, pageSize: number, sorting: TableHeaderSort): Observable { - const sort = sorting ? `${sorting[0]},${sorting[1]}` : 'createdDate,desc'; - const params = new HttpParams().set('page', page).set('size', pageSize).set('sort', sort); + public getReceivedAlerts(page: number, pageSize: number, sorting: TableHeaderSort[]): Observable { + let sort = sorting.length ? sorting : ['createdDate,desc']; + let params = new HttpParams() + .set('page', page) + .set('size', pageSize) + + sort.forEach(sortingItem => { + params = params.append('sort', sortingItem); + }) return this.apiService .getBy(`${this.url}/alerts/received`, params) - .pipe(map(alerts => NotificationAssembler.assembleNotifications(alerts))); + .pipe(map(alerts => NotificationAssembler.assembleNotifications(alerts, NotificationType.ALERT))); } public getAlert(id: string): Observable { return this.apiService .get(`${this.url}/alerts/${id}`) - .pipe(map(notification => NotificationAssembler.assembleNotification(notification))); + .pipe(map(notification => NotificationAssembler.assembleNotification(notification, NotificationType.ALERT))); } public postAlert(partIds: string[], description: string, severity: Severity, bpn: string, isAsBuilt: boolean): Observable { diff --git a/frontend/src/app/modules/shared/service/investigations.service.ts b/frontend/src/app/modules/shared/service/investigations.service.ts index c1100a1665..4039887808 100644 --- a/frontend/src/app/modules/shared/service/investigations.service.ts +++ b/frontend/src/app/modules/shared/service/investigations.service.ts @@ -36,6 +36,7 @@ import { Notifications, NotificationsResponse, NotificationStatus, + NotificationType, } from '../model/notification.model'; @Injectable({ @@ -46,28 +47,40 @@ export class InvestigationsService { constructor(private readonly apiService: ApiService) {} - public getCreatedInvestigations(page: number, pageSize: number, sorting: TableHeaderSort): Observable { - const sort = sorting ? `${sorting[0]},${sorting[1]}` : 'createdDate,desc'; - const params = new HttpParams().set('page', page).set('size', pageSize).set('sort', sort); + public getCreatedInvestigations(page: number, pageSize: number, sorting: TableHeaderSort[]): Observable { + let sort = sorting.length ? sorting : ['createdDate,desc']; + let params = new HttpParams() + .set('page', page) + .set('size', pageSize) + + sort.forEach(sortingItem => { + params = params.append('sort', sortingItem); + }) return this.apiService .getBy(`${this.url}/investigations/created`, params) - .pipe(map(investigations => NotificationAssembler.assembleNotifications(investigations))); + .pipe(map(investigations => NotificationAssembler.assembleNotifications(investigations, NotificationType.INVESTIGATION))); } - public getReceivedInvestigations(page: number, pageSize: number, sorting: TableHeaderSort): Observable { - const sort = sorting ? `${sorting[0]},${sorting[1]}` : 'createdDate,desc'; - const params = new HttpParams().set('page', page).set('size', pageSize).set('sort', sort); + public getReceivedInvestigations(page: number, pageSize: number, sorting: TableHeaderSort[]): Observable { + let sort = sorting.length ? sorting : ['createdDate,desc']; + let params = new HttpParams() + .set('page', page) + .set('size', pageSize) + + sort.forEach(sortingItem => { + params = params.append('sort', sortingItem); + }) return this.apiService .getBy(`${this.url}/investigations/received`, params) - .pipe(map(investigations => NotificationAssembler.assembleNotifications(investigations))); + .pipe(map(investigations => NotificationAssembler.assembleNotifications(investigations, NotificationType.INVESTIGATION))); } public getInvestigation(id: string): Observable { return this.apiService .get(`${this.url}/investigations/${id}`) - .pipe(map(notification => NotificationAssembler.assembleNotification(notification))); + .pipe(map(notification => NotificationAssembler.assembleNotification(notification, NotificationType.INVESTIGATION))); } public postInvestigation( diff --git a/frontend/src/app/modules/shared/service/parts.service.ts b/frontend/src/app/modules/shared/service/parts.service.ts index f0f984060d..3de03a8516 100644 --- a/frontend/src/app/modules/shared/service/parts.service.ts +++ b/frontend/src/app/modules/shared/service/parts.service.ts @@ -44,7 +44,7 @@ export class PartsService { let params = new HttpParams() .set('page', page) .set('size', pageSize) - .set('owner', 'OWN'); + .set('filter', 'owner,EQUAL,OWN'); sort.forEach(sortingItem => { params = params.append('sort', sortingItem); @@ -60,7 +60,7 @@ export class PartsService { let params = new HttpParams() .set('page', page) .set('size', pageSize) - .set('owner', 'OWN'); + .set('filter', 'owner,EQUAL,OWN'); sort.forEach(sortingItem => { params= params.append('sort', sortingItem); diff --git a/tx-backend/openapi/traceability-foss-backend.json b/tx-backend/openapi/traceability-foss-backend.json index 6f2d0e5241..306b0a0916 100644 --- a/tx-backend/openapi/traceability-foss-backend.json +++ b/tx-backend/openapi/traceability-foss-backend.json @@ -41,14 +41,12 @@ "description" : "The endpoint returns a result of BPN EDC URL mappings.", "operationId" : "getBpnEdcs", "responses" : { - "200" : { - "description" : "Returns the paged result found", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -63,8 +61,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -73,8 +71,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -83,8 +81,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -93,18 +91,20 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "200" : { + "description" : "Returns the paged result found", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -113,8 +113,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -155,8 +155,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -165,18 +165,20 @@ } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -185,8 +187,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -195,20 +197,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -217,8 +217,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -227,8 +227,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -269,8 +269,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -279,18 +279,20 @@ } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -299,8 +301,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -309,20 +311,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -331,8 +331,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -341,8 +341,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -380,8 +380,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -390,8 +390,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -400,8 +400,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -410,8 +410,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -420,8 +420,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -430,18 +430,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "201" : { + "description" : "Created.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/QualityNotificationIdResponse" } } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -450,12 +450,12 @@ } } }, - "201" : { - "description" : "Created.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/QualityNotificationIdResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -500,8 +500,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -510,8 +510,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -520,8 +520,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -530,8 +530,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -540,8 +540,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -550,8 +550,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -560,8 +560,11 @@ } } }, - "500" : { - "description" : "Internal server error.", + "204" : { + "description" : "No content." + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -569,9 +572,6 @@ } } } - }, - "204" : { - "description" : "No content." } }, "security" : [ @@ -613,8 +613,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -623,8 +623,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -633,8 +633,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -643,8 +643,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -653,8 +653,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -663,8 +663,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -673,8 +673,11 @@ } } }, - "500" : { - "description" : "Internal server error.", + "204" : { + "description" : "No content." + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -682,9 +685,6 @@ } } } - }, - "204" : { - "description" : "No content." } }, "security" : [ @@ -716,8 +716,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -726,8 +726,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -736,8 +736,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -746,8 +746,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -756,8 +756,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -766,8 +766,11 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "204" : { + "description" : "No content." + }, + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -776,8 +779,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -785,9 +788,6 @@ } } } - }, - "204" : { - "description" : "No content." } }, "security" : [ @@ -819,8 +819,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -829,8 +829,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -839,8 +839,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -849,8 +849,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -859,8 +859,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -869,8 +869,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -879,8 +879,11 @@ } } }, - "500" : { - "description" : "Internal server error.", + "204" : { + "description" : "No content." + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -888,9 +891,6 @@ } } } - }, - "204" : { - "description" : "No content." } }, "security" : [ @@ -921,8 +921,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -931,8 +931,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -941,8 +941,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -951,8 +951,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -961,8 +961,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -971,18 +971,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "201" : { + "description" : "Created.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/CreateNotificationContractResponse" } } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -991,12 +991,12 @@ } } }, - "201" : { - "description" : "Created.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/CreateNotificationContractResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -1030,8 +1030,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1040,8 +1040,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1050,8 +1050,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1060,8 +1060,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1070,8 +1070,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1080,8 +1080,11 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "201" : { + "description" : "Created." + }, + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1090,8 +1093,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1099,9 +1102,6 @@ } } } - }, - "201" : { - "description" : "Created." } }, "security" : [ @@ -1132,18 +1132,20 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "400" : { - "description" : "Bad request.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1152,8 +1154,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1162,8 +1164,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1172,8 +1174,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1182,8 +1184,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1192,8 +1194,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1202,14 +1204,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -1243,8 +1243,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1253,8 +1253,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1263,8 +1263,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1273,8 +1273,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1283,8 +1283,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1293,8 +1293,11 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "201" : { + "description" : "Created." + }, + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1303,8 +1306,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1312,9 +1315,6 @@ } } } - }, - "201" : { - "description" : "Created." } }, "security" : [ @@ -1345,8 +1345,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1355,8 +1355,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1365,8 +1365,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1375,20 +1375,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1397,18 +1395,20 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1417,8 +1417,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1456,8 +1456,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1466,8 +1466,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1476,8 +1476,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1486,8 +1486,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1496,8 +1496,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1506,18 +1506,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "201" : { + "description" : "Created.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/QualityNotificationIdResponse" } } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1526,12 +1526,12 @@ } } }, - "201" : { - "description" : "Created.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/QualityNotificationIdResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -1576,8 +1576,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1586,8 +1586,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1596,8 +1596,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1606,8 +1606,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1616,8 +1616,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1626,8 +1626,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1636,8 +1636,11 @@ } } }, - "500" : { - "description" : "Internal server error.", + "204" : { + "description" : "No content." + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1645,9 +1648,6 @@ } } } - }, - "204" : { - "description" : "No content." } }, "security" : [ @@ -1689,8 +1689,8 @@ "required" : true }, "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1699,8 +1699,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1709,8 +1709,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1719,8 +1719,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1729,8 +1729,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1739,8 +1739,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1749,8 +1749,11 @@ } } }, - "500" : { - "description" : "Internal server error.", + "204" : { + "description" : "No content." + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1758,9 +1761,6 @@ } } } - }, - "204" : { - "description" : "No content." } }, "security" : [ @@ -1792,8 +1792,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1802,8 +1802,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1812,8 +1812,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1822,8 +1822,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1832,8 +1832,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1842,8 +1842,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1852,8 +1852,11 @@ } } }, - "500" : { - "description" : "Internal server error.", + "204" : { + "description" : "No content." + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1861,9 +1864,6 @@ } } } - }, - "204" : { - "description" : "No content." } }, "security" : [ @@ -1895,8 +1895,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1905,8 +1905,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1915,8 +1915,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1925,8 +1925,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1935,8 +1935,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1945,8 +1945,11 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "204" : { + "description" : "No content." + }, + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1955,8 +1958,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1964,9 +1967,6 @@ } } } - }, - "204" : { - "description" : "No content." } }, "security" : [ @@ -1997,46 +1997,6 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "200" : { "description" : "Returns the assets found", "content" : { @@ -2174,8 +2134,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2193,6 +2153,46 @@ } } } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -2231,6 +2231,66 @@ "required" : true }, "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the updated asset", "content" : { @@ -2358,56 +2418,6 @@ } } }, - "404" : { - "description" : "Not found.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "415" : { "description" : "Unsupported media type", "content" : { @@ -2417,16 +2427,6 @@ } } } - }, - "500" : { - "description" : "Internal server error.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -2457,36 +2457,6 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "200" : { "description" : "Returns the assets found", "content" : { @@ -2614,8 +2584,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2624,8 +2594,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2634,8 +2604,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2644,8 +2614,38 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -2688,9 +2688,19 @@ } } }, - "required" : true - }, - "responses" : { + "required" : true + }, + "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "404" : { "description" : "Not found.", "content" : { @@ -2701,8 +2711,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2838,8 +2848,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2848,8 +2858,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2858,8 +2868,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2877,16 +2887,6 @@ } } } - }, - "500" : { - "description" : "Internal server error.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -2946,6 +2946,16 @@ "description" : "The endpoint returns all shell descriptors.", "operationId" : "findAll", "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "404" : { "description" : "Not found.", "content" : { @@ -2956,8 +2966,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2966,8 +2976,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2976,8 +2986,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2999,8 +3009,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3018,16 +3028,6 @@ } } } - }, - "500" : { - "description" : "Internal server error.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -3047,8 +3047,8 @@ "description" : "The endpoint deletes all shell descriptors.", "operationId" : "deleteAll", "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3057,8 +3057,11 @@ } } }, - "400" : { - "description" : "Bad request.", + "204" : { + "description" : "Deleted." + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3067,8 +3070,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3077,11 +3080,8 @@ } } }, - "204" : { - "description" : "Deleted." - }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3090,8 +3090,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3100,8 +3100,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3110,8 +3110,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3139,8 +3139,8 @@ "description" : "The endpoint Triggers reload of shell descriptors.", "operationId" : "reload", "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3149,8 +3149,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3159,8 +3159,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3169,8 +3169,11 @@ } } }, - "403" : { - "description" : "Forbidden.", + "202" : { + "description" : "Created registry reload job." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3179,11 +3182,8 @@ } } }, - "202" : { - "description" : "Created registry reload job." - }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3192,8 +3192,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3202,8 +3202,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3281,8 +3281,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3291,18 +3291,24 @@ } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : -2147483648, + "type" : "array", + "description" : "Investigations", + "items" : { + "$ref" : "#/components/schemas/InvestigationResponse" + } } } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3311,24 +3317,18 @@ } } }, - "200" : { - "description" : "OK.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : -2147483648, - "type" : "array", - "description" : "Investigations", - "items" : { - "$ref" : "#/components/schemas/InvestigationResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3337,8 +3337,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3347,8 +3347,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3357,8 +3357,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3396,6 +3396,16 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "404" : { "description" : "Not found.", "content" : { @@ -3406,8 +3416,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3416,8 +3426,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3426,8 +3436,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3448,8 +3458,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3467,16 +3477,6 @@ } } } - }, - "500" : { - "description" : "Internal server error.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -3507,18 +3507,20 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "400" : { - "description" : "Bad request.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3527,8 +3529,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3537,20 +3539,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3559,8 +3559,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3569,8 +3569,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3579,8 +3579,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3699,18 +3699,18 @@ "description" : "The endpoint can return limited data based on the user role", "operationId" : "dashboard", "responses" : { - "404" : { - "description" : "Not found.", + "200" : { + "description" : "Returns dashboard data", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/DashboardResponse" } } } }, - "400" : { - "description" : "Bad request.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3719,8 +3719,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3729,18 +3729,18 @@ } } }, - "200" : { - "description" : "Returns dashboard data", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/DashboardResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3749,8 +3749,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3759,8 +3759,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3769,8 +3769,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3845,20 +3845,6 @@ "$ref" : "#/components/schemas/OwnPageable" } }, - { - "name" : "owner", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string", - "enum" : [ - "SUPPLIER", - "CUSTOMER", - "OWN", - "UNKNOWN" - ] - } - }, { "name" : "filter", "in" : "query", @@ -3869,18 +3855,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3889,8 +3865,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3899,8 +3875,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3909,8 +3885,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3919,8 +3895,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3929,8 +3905,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4070,6 +4046,16 @@ } } } + }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -4108,6 +4094,16 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "404" : { "description" : "Not found.", "content" : { @@ -4118,6 +4114,16 @@ } } }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "400" : { "description" : "Bad request.", "content" : { @@ -4275,16 +4281,6 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "415" : { "description" : "Unsupported media type", "content" : { @@ -4294,16 +4290,6 @@ } } } - }, - "500" : { - "description" : "Internal server error.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -4344,8 +4330,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4354,8 +4340,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4364,8 +4350,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4374,20 +4360,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4396,18 +4380,20 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4416,8 +4402,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4453,20 +4439,6 @@ "$ref" : "#/components/schemas/OwnPageable" } }, - { - "name" : "owner", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string", - "enum" : [ - "SUPPLIER", - "CUSTOMER", - "OWN", - "UNKNOWN" - ] - } - }, { "name" : "searchCriteriaRequestParam", "in" : "query", @@ -4477,6 +4449,16 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "404" : { "description" : "Not found.", "content" : { @@ -4487,6 +4469,16 @@ } } }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "400" : { "description" : "Bad request.", "content" : { @@ -4649,16 +4641,6 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "415" : { "description" : "Unsupported media type", "content" : { @@ -4668,16 +4650,6 @@ } } } - }, - "500" : { - "description" : "Internal server error.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -4716,28 +4688,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4746,8 +4698,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4756,8 +4708,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4766,8 +4718,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4776,8 +4728,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4912,6 +4864,26 @@ } } } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -4952,8 +4924,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4962,8 +4934,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4972,8 +4944,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4982,20 +4954,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5004,18 +4974,20 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5024,8 +4996,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5053,8 +5025,8 @@ "description" : "The endpoint returns a map for assets consumed by the map.", "operationId" : "assetsCountryMap", "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5063,18 +5035,22 @@ } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns the assets found", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "type" : "object", + "additionalProperties" : { + "type" : "integer", + "format" : "int64" + } } } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5083,22 +5059,18 @@ } } }, - "200" : { - "description" : "Returns the assets found", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "integer", - "format" : "int64" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5107,8 +5079,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5117,8 +5089,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5127,8 +5099,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5180,8 +5152,8 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5190,18 +5162,23 @@ } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array", + "description" : "Alerts", + "items" : { + "$ref" : "#/components/schemas/AlertResponse" + } } } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5210,23 +5187,18 @@ } } }, - "200" : { - "description" : "OK.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array", - "description" : "Alerts", - "items" : { - "$ref" : "#/components/schemas/AlertResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5235,8 +5207,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5245,8 +5217,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5255,8 +5227,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5294,18 +5266,19 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array" } } } }, - "400" : { - "description" : "Bad request.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5314,8 +5287,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5324,8 +5297,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5334,8 +5307,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5344,8 +5317,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5354,8 +5327,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5364,13 +5337,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -5404,18 +5376,19 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array" } } } }, - "400" : { - "description" : "Bad request.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5424,8 +5397,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5434,8 +5407,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5444,8 +5417,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5454,8 +5427,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5464,8 +5437,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5474,13 +5447,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -5527,8 +5499,11 @@ } ], "responses" : { - "404" : { - "description" : "Not found.", + "204" : { + "description" : "Deleted." + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5537,8 +5512,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5547,8 +5522,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5557,8 +5532,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5567,8 +5542,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5577,8 +5552,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5586,9 +5561,6 @@ } } } - }, - "204" : { - "description" : "Deleted." } }, "security" : [ diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java index 0fe1cd9c89..74022c49f6 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java @@ -37,7 +37,6 @@ import org.eclipse.tractusx.traceability.assets.application.base.request.SyncAssetsRequest; import org.eclipse.tractusx.traceability.assets.application.base.request.UpdateAssetRequest; import org.eclipse.tractusx.traceability.assets.application.base.service.AssetBaseService; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; @@ -182,8 +181,7 @@ public void sync(@Valid @RequestBody SyncAssetsRequest syncAssetsRequest) { mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) @GetMapping("") - public PageResult assets(OwnPageable pageable, @QueryParam("owner") Owner owner, SearchCriteriaRequestParam searchCriteriaRequestParam) { - searchCriteriaRequestParam.addOwnerCriteria(owner); + public PageResult assets(OwnPageable pageable, SearchCriteriaRequestParam searchCriteriaRequestParam) { return AssetAsBuiltResponseMapper.from(assetBaseService.getAssets(OwnPageable.toPageable(pageable), searchCriteriaRequestParam.toSearchCriteria())); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java index c126946fa3..90ea526198 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java @@ -35,7 +35,6 @@ import org.eclipse.tractusx.traceability.assets.application.base.request.SyncAssetsRequest; import org.eclipse.tractusx.traceability.assets.application.base.request.UpdateAssetRequest; import org.eclipse.tractusx.traceability.assets.application.base.service.AssetBaseService; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; @@ -59,9 +58,11 @@ public class AssetAsPlannedController { private final AssetBaseService assetService; + public AssetAsPlannedController(@Qualifier("assetAsPlannedServiceImpl") AssetBaseService assetService) { this.assetService = assetService; } + @Operation(operationId = "sync", summary = "Synchronizes assets from IRS", tags = {"AssetsAsPlanned"}, @@ -177,8 +178,7 @@ public void sync(@Valid @RequestBody SyncAssetsRequest syncAssetsRequest) { mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) @GetMapping("") - public PageResult assets(OwnPageable pageable, @QueryParam("owner") Owner owner, SearchCriteriaRequestParam filter) { - filter.addOwnerCriteria(owner); + public PageResult assets(OwnPageable pageable, SearchCriteriaRequestParam filter) { return AssetAsPlannedResponseMapper.from(assetService.getAssets(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfig.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfig.java index 5d053014d7..3effcd4205 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfig.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfig.java @@ -30,6 +30,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.exception.AssetNotFoundException; import org.eclipse.tractusx.traceability.bpn.domain.model.BpnNotFoundException; +import org.eclipse.tractusx.traceability.common.request.InvalidFilterException; import org.eclipse.tractusx.traceability.common.request.InvalidSortException; import org.eclipse.tractusx.traceability.common.response.ErrorResponse; import org.eclipse.tractusx.traceability.common.security.TechnicalUserAuthorizationException; @@ -41,6 +42,7 @@ import org.eclipse.tractusx.traceability.qualitynotification.domain.investigation.model.exception.InvestigationReceiverBpnMismatchException; import org.eclipse.tractusx.traceability.qualitynotification.domain.investigation.model.exception.InvestigationStatusTransitionNotAllowed; import org.eclipse.tractusx.traceability.qualitynotification.domain.investigation.model.exception.NotificationStatusTransitionNotAllowed; +import org.eclipse.tractusx.traceability.submodel.domain.model.SubmodelNotFoundException; import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -194,6 +196,13 @@ ResponseEntity handleUpdateQualityNotificationValidationException .body(new ErrorResponse(exception.getMessage())); } + @ExceptionHandler(InvalidFilterException.class) + ResponseEntity handleInvalidFilterException(InvalidFilterException exception) { + log.warn("handleInvalidFilterException", exception); + return ResponseEntity.status(HttpStatus.BAD_REQUEST) + .body(new ErrorResponse(exception.getMessage())); + } + @ExceptionHandler(CreateNotificationContractException.class) ResponseEntity handleCreateNotificationContractException(CreateNotificationContractException exception) { log.warn("handleCreateNotificationContractException", exception); @@ -226,4 +235,13 @@ public ResponseEntity handleInvalidSortException(final InvalidSor return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(new ErrorResponse(exception.getMessage())); } + + @ExceptionHandler(SubmodelNotFoundException.class) + ResponseEntity handleSubmodelNotFoundException(SubmodelNotFoundException exception) { + String errorMessage = exception + .getMessage(); + log.warn("handleSubmodelNotFoundException", exception); + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(new ErrorResponse(errorMessage)); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/SecurityConfig.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/SecurityConfig.java index 0f63808366..d1c7204cff 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/SecurityConfig.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/SecurityConfig.java @@ -55,7 +55,8 @@ public class SecurityConfig { "/callback/endpoint-data-reference", "/internal/endpoint-data-reference", "/actuator/**", - "/registry/reload" + "/registry/reload", + "/submodel/**" }; @Value("${jwt.resource-client}") diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMessageMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMessageMapper.java index 680f6d2f9c..93cddaef56 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMessageMapper.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMessageMapper.java @@ -22,9 +22,9 @@ import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.traceability.bpn.domain.service.BpnRepository; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotification; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationMessage; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationSeverity; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotification; import org.springframework.stereotype.Component; import java.time.LocalDateTime; @@ -48,10 +48,10 @@ public QualityNotificationMessage toNotification(EDCNotification edcNotification .id(notificationId) .created(LocalDateTime.now()) .notificationReferenceId(edcNotification.getNotificationId()) - .senderBpnNumber(edcNotification.getSenderBPN()) - .senderManufacturerName(getManufacturerName(edcNotification.getSenderBPN())) - .receiverBpnNumber(edcNotification.getRecipientBPN()) - .receiverManufacturerName(getManufacturerName(edcNotification.getRecipientBPN())) + .createdBy(edcNotification.getSenderBPN()) + .createdByName(getManufacturerName(edcNotification.getSenderBPN())) + .sendTo(edcNotification.getRecipientBPN()) + .sendToName(getManufacturerName(edcNotification.getRecipientBPN())) .edcUrl(edcNotification.getSenderAddress()) .description(edcNotification.getInformation()) .notificationStatus(edcNotification.convertNotificationStatus()) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/request/SearchCriteriaRequestParam.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/request/SearchCriteriaRequestParam.java index 0919c9b492..c32bcc0bef 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/request/SearchCriteriaRequestParam.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/request/SearchCriteriaRequestParam.java @@ -23,7 +23,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Data; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.common.model.SearchOperation; @@ -32,7 +31,6 @@ import java.util.List; import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; @Data @AllArgsConstructor @@ -64,12 +62,4 @@ public List toSearchCriteria() { return filters; } - public void addOwnerCriteria(Owner owner) { - if (nonNull(owner) && isNull(filter)) { - filter = new ArrayList<>(); - filter.add("owner,EQUAL," + owner.name()); - } else if (nonNull(owner) && nonNull(filter)) { - filter.add("owner,EQUAL," + owner.name()); - } - } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/mapper/AlertResponseMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/mapper/AlertResponseMapper.java index 1c733cedca..80fcc8e6c9 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/mapper/AlertResponseMapper.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/mapper/AlertResponseMapper.java @@ -75,28 +75,28 @@ public static PageResult fromAsPageResult(PageResult notifications) { return notifications.stream() .findFirst() - .map(QualityNotificationMessage::getSenderBpnNumber) + .map(QualityNotificationMessage::getCreatedBy) .orElse(null); } private static String getReceiverBPN(Collection notifications) { return notifications.stream() .findFirst() - .map(QualityNotificationMessage::getReceiverBpnNumber) + .map(QualityNotificationMessage::getSendTo) .orElse(null); } private static String getSenderName(Collection notifications) { return notifications.stream() .findFirst() - .map(QualityNotificationMessage::getSenderManufacturerName) + .map(QualityNotificationMessage::getCreatedByName) .orElse(null); } private static String getReceiverName(Collection notifications) { return notifications.stream() .findFirst() - .map(QualityNotificationMessage::getReceiverManufacturerName) + .map(QualityNotificationMessage::getSendToName) .orElse(null); } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/mapper/InvestigationResponseMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/mapper/InvestigationResponseMapper.java index 9b28c3f51b..438087eadc 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/mapper/InvestigationResponseMapper.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/mapper/InvestigationResponseMapper.java @@ -78,28 +78,28 @@ public static PageResult fromAsPageResult(PageResult notifications) { return notifications.stream() .findFirst() - .map(QualityNotificationMessage::getSenderBpnNumber) + .map(QualityNotificationMessage::getCreatedBy) .orElse(null); } private static String getReceiverBPN(Collection notifications) { return notifications.stream() .findFirst() - .map(QualityNotificationMessage::getReceiverBpnNumber) + .map(QualityNotificationMessage::getSendTo) .orElse(null); } private static String getSenderName(Collection notifications) { return notifications.stream() .findFirst() - .map(QualityNotificationMessage::getSenderManufacturerName) + .map(QualityNotificationMessage::getCreatedByName) .orElse(null); } private static String getReceiverName(Collection notifications) { return notifications.stream() .findFirst() - .map(QualityNotificationMessage::getReceiverManufacturerName) + .map(QualityNotificationMessage::getSendToName) .orElse(null); } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/model/QualityNotificationMessage.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/model/QualityNotificationMessage.java index 1104b0b680..7acdde3db6 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/model/QualityNotificationMessage.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/model/QualityNotificationMessage.java @@ -37,13 +37,13 @@ @Data public class QualityNotificationMessage { private final String id; - private final String senderManufacturerName; - private final String receiverManufacturerName; + private final String createdByName; + private final String sendToName; @Builder.Default private final List affectedParts = new ArrayList<>(); private String notificationReferenceId; - private String senderBpnNumber; - private String receiverBpnNumber; + private String createdBy; + private String sendTo; private String edcUrl; private String contractAgreementId; private String description; @@ -71,28 +71,28 @@ void changeStatusTo(QualityNotificationStatus to) { // Important - receiver and sender will be saved in switched order public QualityNotificationMessage copyAndSwitchSenderAndReceiver(BPN applicationBpn) { final String notificationId = UUID.randomUUID().toString(); - String receiverBPN = receiverBpnNumber; - String senderBPN = senderBpnNumber; + String receiverBPN = sendTo; + String senderBPN = createdBy; String receiverName; String senderName; // This is needed to make sure that the app can send a message to the receiver and not addresses itself - if (applicationBpn.value().equals(receiverBpnNumber)) { - receiverBPN = senderBpnNumber; - senderBPN = receiverBpnNumber; - receiverName = senderManufacturerName; - senderName = receiverManufacturerName; + if (applicationBpn.value().equals(sendTo)) { + receiverBPN = createdBy; + senderBPN = sendTo; + receiverName = createdByName; + senderName = sendToName; } else { - receiverName = receiverManufacturerName; - senderName = senderManufacturerName; + receiverName = sendToName; + senderName = createdByName; } return QualityNotificationMessage.builder() .created(LocalDateTime.now()) .id(notificationId) - .senderBpnNumber(senderBPN) - .senderManufacturerName(senderName) - .receiverBpnNumber(receiverBPN) - .receiverManufacturerName(receiverName) + .createdBy(senderBPN) + .createdByName(senderName) + .sendTo(receiverBPN) + .sendToName(receiverName) .edcUrl(edcUrl) .contractAgreementId(contractAgreementId) .description(description) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/EdcNotificationService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/EdcNotificationService.java index 5e4d2bac46..dbc73bdc0a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/EdcNotificationService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/EdcNotificationService.java @@ -26,12 +26,12 @@ import org.eclipse.tractusx.traceability.common.config.AssetsAsyncConfig; import org.eclipse.tractusx.traceability.discovery.domain.model.Discovery; import org.eclipse.tractusx.traceability.discovery.domain.service.DiscoveryService; +import org.eclipse.tractusx.traceability.qualitynotification.domain.base.AlertRepository; +import org.eclipse.tractusx.traceability.qualitynotification.domain.base.InvestigationRepository; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.exception.ContractNegotiationException; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.exception.NoCatalogItemException; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.exception.NoEndpointDataReferenceException; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.exception.SendNotificationException; -import org.eclipse.tractusx.traceability.qualitynotification.domain.base.AlertRepository; -import org.eclipse.tractusx.traceability.qualitynotification.domain.base.InvestigationRepository; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationMessage; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationType; import org.springframework.scheduling.annotation.Async; @@ -53,7 +53,7 @@ public class EdcNotificationService { @Async(value = AssetsAsyncConfig.UPDATE_NOTIFICATION_EXECUTOR) public void asyncNotificationExecutor(QualityNotificationMessage notification) { log.info("::asyncNotificationExecutor::notification {}", notification); - Discovery discovery = discoveryService.getDiscoveryByBPN(notification.getReceiverBpnNumber()); + Discovery discovery = discoveryService.getDiscoveryByBPN(notification.getSendTo()); String senderEdcUrl = discovery.getSenderUrl(); if (notification.getType().equals(QualityNotificationType.ALERT)) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/NotificationPublisherService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/NotificationPublisherService.java index 4a9c16c165..a2b720ce19 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/NotificationPublisherService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/NotificationPublisherService.java @@ -146,10 +146,10 @@ private QualityNotificationMessage createInvestigation(BPN applicationBpn, Strin return QualityNotificationMessage.builder() .id(notificationId) .created(LocalDateTime.now()) - .senderBpnNumber(applicationBpn.value()) - .senderManufacturerName(getManufacturerName(applicationBpn.value())) - .receiverBpnNumber(StringUtils.isBlank(receiverBpn) ? asset.getKey() : receiverBpn) - .receiverManufacturerName(getManufacturerName(asset.getKey())) + .createdBy(applicationBpn.value()) + .createdByName(getManufacturerName(applicationBpn.value())) + .sendTo(StringUtils.isBlank(receiverBpn) ? asset.getKey() : receiverBpn) + .sendToName(getManufacturerName(asset.getKey())) .description(description) .notificationStatus(QualityNotificationStatus.CREATED) .affectedParts(asset.getValue().stream().map(AssetBase::getId).map(QualityNotificationAffectedPart::new).toList()) @@ -167,10 +167,10 @@ private QualityNotificationMessage createAlert(BPN applicationBpn, String descri return QualityNotificationMessage.builder() .id(notificationId) .created(LocalDateTime.now()) - .senderBpnNumber(applicationBpn.value()) - .senderManufacturerName(getManufacturerName(applicationBpn.value())) - .receiverBpnNumber(targetBpn) - .receiverManufacturerName(getManufacturerName(targetBpn)) + .createdBy(applicationBpn.value()) + .createdByName(getManufacturerName(applicationBpn.value())) + .sendTo(targetBpn) + .sendToName(getManufacturerName(targetBpn)) .description(description) .notificationStatus(QualityNotificationStatus.CREATED) .affectedParts(affectedAssets.stream().map(AssetBase::getId).map(QualityNotificationAffectedPart::new).toList()) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/model/AlertNotificationEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/model/AlertNotificationEntity.java index f2d5feb85e..e94734efb2 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/model/AlertNotificationEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/model/AlertNotificationEntity.java @@ -38,8 +38,8 @@ import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationMessage; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationStatus; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationType; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.QualityNotificationMessageBaseEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.QualityNotificationMessageBaseEntity; import java.util.List; @@ -77,10 +77,10 @@ public static QualityNotificationMessage toDomain(AlertNotificationEntity alertN return QualityNotificationMessage.builder() .id(alertNotificationEntity.getId()) .notificationReferenceId(alertNotificationEntity.getNotificationReferenceId()) - .senderBpnNumber(alertNotificationEntity.getSenderBpnNumber()) - .senderManufacturerName(alertNotificationEntity.getSenderManufacturerName()) - .receiverBpnNumber(alertNotificationEntity.getReceiverBpnNumber()) - .receiverManufacturerName(alertNotificationEntity.getReceiverManufacturerName()) + .createdBy(alertNotificationEntity.getCreatedBy()) + .createdByName(alertNotificationEntity.getCreatedByName()) + .sendTo(alertNotificationEntity.getSendTo()) + .sendToName(alertNotificationEntity.getSendToName()) .description(alertNotificationEntity.getAlert().getDescription()) .edcUrl(alertNotificationEntity.getEdcUrl()) .contractAgreementId(alertNotificationEntity.getContractAgreementId()) @@ -108,10 +108,10 @@ public static AlertNotificationEntity from(AlertEntity alertEntity, .id(qualityNotificationMessage.getId()) .alert(alertEntity) .created(qualityNotificationMessage.getCreated()) - .senderBpnNumber(qualityNotificationMessage.getSenderBpnNumber()) - .senderManufacturerName(qualityNotificationMessage.getSenderManufacturerName()) - .receiverBpnNumber(qualityNotificationMessage.getReceiverBpnNumber()) - .receiverManufacturerName(qualityNotificationMessage.getReceiverManufacturerName()) + .createdBy(qualityNotificationMessage.getCreatedBy()) + .createdByName(qualityNotificationMessage.getCreatedByName()) + .sendTo(qualityNotificationMessage.getSendTo()) + .sendToName(qualityNotificationMessage.getSendToName()) .assets(notificationAssets) .assetsAsPlanned(assetAsPlannedEntitiesByAlert) .notificationReferenceId(qualityNotificationMessage.getNotificationReferenceId()) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/edc/model/EDCNotificationFactory.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/edc/model/EDCNotificationFactory.java index f6757e1650..f8b0788f7c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/edc/model/EDCNotificationFactory.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/edc/model/EDCNotificationFactory.java @@ -38,9 +38,9 @@ public static EDCNotification createEdcNotification(String senderEDC, QualityNot } EDCNotificationHeader header = new EDCNotificationHeader( notification.getEdcNotificationId(), - notification.getSenderBpnNumber(), + notification.getCreatedBy(), senderEDC, - notification.getReceiverBpnNumber(), + notification.getSendTo(), NotificationType.from(notification.getType()).getValue(), notification.getSeverity() != null ? notification.getSeverity().getRealName() : QualityNotificationSeverity.MINOR.getRealName(), notification.getNotificationReferenceId(), diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/model/InvestigationNotificationEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/model/InvestigationNotificationEntity.java index 7ff86b083e..f1fd75abb5 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/model/InvestigationNotificationEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/model/InvestigationNotificationEntity.java @@ -38,8 +38,8 @@ import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationMessage; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationStatus; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationType; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.QualityNotificationMessageBaseEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.QualityNotificationMessageBaseEntity; import java.util.List; @@ -78,10 +78,10 @@ public static QualityNotificationMessage toDomain(InvestigationNotificationEntit return QualityNotificationMessage.builder() .id(investigationNotificationEntity.getId()) .notificationReferenceId(investigationNotificationEntity.getNotificationReferenceId()) - .senderBpnNumber(investigationNotificationEntity.getSenderBpnNumber()) - .senderManufacturerName(investigationNotificationEntity.getSenderManufacturerName()) - .receiverBpnNumber(investigationNotificationEntity.getReceiverBpnNumber()) - .receiverManufacturerName(investigationNotificationEntity.getReceiverManufacturerName()) + .createdBy(investigationNotificationEntity.getCreatedBy()) + .createdByName(investigationNotificationEntity.getCreatedByName()) + .sendTo(investigationNotificationEntity.getSendTo()) + .sendToName(investigationNotificationEntity.getSendToName()) .description(investigationNotificationEntity.getInvestigation().getDescription()) .edcUrl(investigationNotificationEntity.getEdcUrl()) .contractAgreementId(investigationNotificationEntity.getContractAgreementId()) @@ -108,10 +108,10 @@ public static InvestigationNotificationEntity from(InvestigationEntity investiga .id(qualityNotificationMessage.getId()) .investigation(investigationEntity) .created(qualityNotificationMessage.getCreated()) - .senderBpnNumber(qualityNotificationMessage.getSenderBpnNumber()) - .senderManufacturerName(qualityNotificationMessage.getSenderManufacturerName()) - .receiverBpnNumber(qualityNotificationMessage.getReceiverBpnNumber()) - .receiverManufacturerName(qualityNotificationMessage.getReceiverManufacturerName()) + .createdBy(qualityNotificationMessage.getCreatedBy()) + .createdByName(qualityNotificationMessage.getCreatedByName()) + .sendTo(qualityNotificationMessage.getSendTo()) + .sendToName(qualityNotificationMessage.getSendToName()) .assets(notificationAssets) .notificationReferenceId(qualityNotificationMessage.getNotificationReferenceId()) .targetDate(qualityNotificationMessage.getTargetDate()) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/model/QualityNotificationMessageBaseEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/model/QualityNotificationMessageBaseEntity.java index 5940e47510..0648f832a5 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/model/QualityNotificationMessageBaseEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/model/QualityNotificationMessageBaseEntity.java @@ -36,10 +36,10 @@ public class QualityNotificationMessageBaseEntity { @Id private String id; - private String senderBpnNumber; - private String senderManufacturerName; - private String receiverBpnNumber; - private String receiverManufacturerName; + private String createdBy; + private String createdByName; + private String sendTo; + private String sendToName; private String edcUrl; private String contractAgreementId; private String notificationReferenceId; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/rest/SubmodelController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/rest/SubmodelController.java new file mode 100644 index 0000000000..a5b0a1da32 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/rest/SubmodelController.java @@ -0,0 +1,97 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.application.rest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import org.eclipse.tractusx.traceability.submodel.application.service.SubmodelService; +import org.eclipse.tractusx.traceability.submodel.domain.model.Submodel; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Tag(name = "Submodel") +@RequestMapping(path = "/submodel/data") +@RequiredArgsConstructor +public class SubmodelController { + + private final SubmodelService submodelService; + + @Operation(operationId = "getSubmodelById", + summary = "Gets Submodel by its id", + tags = {"Submodel"}, + description = "The endpoint returns Submodel for given id. Used for data providing functionality", + security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns the paged result found", content = @Content( + mediaType = "application/json" + )), + @ApiResponse( + responseCode = "401", + description = "Authorization failed.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "429", + description = "Too many requests.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "403", + description = "Forbidden.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)))}) + @GetMapping("/{submodelId}") + public String getSubmodel(@PathVariable String submodelId) { + return submodelService.getById(submodelId).getPayload(); + } + + @PostMapping("/{submodelId}") + @ResponseStatus(HttpStatus.NO_CONTENT) + public void saveSubmodel(@PathVariable String submodelId, @RequestBody String submodelPayload) { + submodelService.save(Submodel.builder() + .id(submodelId) + .payload(submodelPayload) + .build()); + } + + @DeleteMapping + @ResponseStatus(HttpStatus.NO_CONTENT) + public void deleteSubmodels() { + submodelService.deleteAll(); + } + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/service/SubmodelService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/service/SubmodelService.java new file mode 100644 index 0000000000..8f795fc379 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/service/SubmodelService.java @@ -0,0 +1,28 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.application.service; + +import org.eclipse.tractusx.traceability.submodel.domain.model.Submodel; + +public interface SubmodelService { + Submodel getById(String submodelId); + void save(Submodel submodelId); + void deleteAll(); +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/model/Submodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/model/Submodel.java new file mode 100644 index 0000000000..192a83c3e7 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/model/Submodel.java @@ -0,0 +1,30 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.domain.model; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class Submodel { + private final String id; + private final String payload; +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/model/SubmodelNotFoundException.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/model/SubmodelNotFoundException.java new file mode 100644 index 0000000000..96adcf8851 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/model/SubmodelNotFoundException.java @@ -0,0 +1,27 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.domain.model; + +public class SubmodelNotFoundException extends RuntimeException { + + public SubmodelNotFoundException(final String submodelId) { + super("Submodel with id %s not found".formatted(submodelId)); + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/repository/SubmodelRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/repository/SubmodelRepository.java new file mode 100644 index 0000000000..95bde4c51f --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/repository/SubmodelRepository.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.domain.repository; + +import org.eclipse.tractusx.traceability.submodel.domain.model.Submodel; + +import java.util.Optional; + +public interface SubmodelRepository { + + void save(Submodel submodel); + + Optional findById(String id); + + void deleteAll(); +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/service/SubmodelServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/service/SubmodelServiceImpl.java new file mode 100644 index 0000000000..82e655c121 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/domain/service/SubmodelServiceImpl.java @@ -0,0 +1,53 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.domain.service; + +import lombok.RequiredArgsConstructor; +import org.eclipse.tractusx.traceability.submodel.application.service.SubmodelService; +import org.eclipse.tractusx.traceability.submodel.domain.model.Submodel; +import org.eclipse.tractusx.traceability.submodel.domain.model.SubmodelNotFoundException; +import org.eclipse.tractusx.traceability.submodel.domain.repository.SubmodelRepository; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class SubmodelServiceImpl implements SubmodelService { + private final SubmodelRepository submodelRepository; + + void findById(String id) { + submodelRepository.findById(id); + } + + @Override + public Submodel getById(String submodelId) { + return submodelRepository.findById(submodelId) + .orElseThrow(() -> new SubmodelNotFoundException(submodelId)); + } + + @Override + public void save(Submodel submodel) { + submodelRepository.save(submodel); + } + + @Override + public void deleteAll() { + submodelRepository.deleteAll(); + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/model/SubmodelEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/model/SubmodelEntity.java new file mode 100644 index 0000000000..b8e755615a --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/model/SubmodelEntity.java @@ -0,0 +1,56 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.infrastructure.model; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.eclipse.tractusx.traceability.submodel.domain.model.Submodel; + +@Entity +@Table(name = "submodel") +@Getter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class SubmodelEntity { + @Id + private String id; + + private String submodel; + + public static SubmodelEntity from(Submodel submodel) { + return SubmodelEntity.builder() + .id(submodel.getId()) + .submodel(submodel.getPayload()) + .build(); + } + + public Submodel toDomain() { + return Submodel.builder() + .id(getId()) + .payload(getSubmodel()) + .build(); + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/JpaSubmodelRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/JpaSubmodelRepository.java new file mode 100644 index 0000000000..1d08f1c189 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/JpaSubmodelRepository.java @@ -0,0 +1,26 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.infrastructure.reposotory; + +import org.eclipse.tractusx.traceability.submodel.infrastructure.model.SubmodelEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface JpaSubmodelRepository extends JpaRepository { +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/SubmodelRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/SubmodelRepositoryImpl.java new file mode 100644 index 0000000000..0cbddb5774 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/SubmodelRepositoryImpl.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.infrastructure.reposotory; + +import lombok.RequiredArgsConstructor; +import org.eclipse.tractusx.traceability.submodel.domain.model.Submodel; +import org.eclipse.tractusx.traceability.submodel.domain.repository.SubmodelRepository; +import org.eclipse.tractusx.traceability.submodel.infrastructure.model.SubmodelEntity; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +@RequiredArgsConstructor +public class SubmodelRepositoryImpl implements SubmodelRepository { + + private final JpaSubmodelRepository jpaSubmodelRepository; + + @Override + public void save(Submodel submodel) { + jpaSubmodelRepository.save(SubmodelEntity.from(submodel)); + } + + @Override + public Optional findById(String id) { + return jpaSubmodelRepository.findById(id).map(SubmodelEntity::toDomain); + } + + @Override + public void deleteAll() { + jpaSubmodelRepository.deleteAll(); + } +} diff --git a/tx-backend/src/main/resources/db/migration/V39__rename_entity_to_suite_domain_model.sql b/tx-backend/src/main/resources/db/migration/V39__rename_entity_to_suite_domain_model.sql new file mode 100644 index 0000000000..a4d32dd993 --- /dev/null +++ b/tx-backend/src/main/resources/db/migration/V39__rename_entity_to_suite_domain_model.sql @@ -0,0 +1,20 @@ +ALTER TABLE alert_notification + RENAME COLUMN sender_bpn_number TO created_by; +ALTER TABLE alert_notification + RENAME COLUMN sender_manufacturer_name TO created_by_name; +ALTER TABLE alert_notification + RENAME COLUMN receiver_bpn_number TO send_to; +ALTER TABLE alert_notification + RENAME COLUMN receiver_manufacturer_name TO send_to_name; + +ALTER TABLE investigation_notification + RENAME COLUMN sender_bpn_number TO created_by; +ALTER TABLE investigation_notification + RENAME COLUMN sender_manufacturer_name TO created_by_name; +ALTER TABLE investigation_notification + RENAME COLUMN receiver_bpn_number TO send_to; +ALTER TABLE investigation_notification + RENAME COLUMN receiver_manufacturer_name TO send_to_name; + + + diff --git a/tx-backend/src/main/resources/db/migration/V40__submodel_entity.sql b/tx-backend/src/main/resources/db/migration/V40__submodel_entity.sql new file mode 100644 index 0000000000..cf489be5b4 --- /dev/null +++ b/tx-backend/src/main/resources/db/migration/V40__submodel_entity.sql @@ -0,0 +1,6 @@ +CREATE TABLE submodel +( + id VARCHAR(255) NOT NULL, + submodel VARCHAR, + PRIMARY KEY (id) +); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMapperTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMapperTest.java index 5a4707c5aa..f24248fcbe 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMapperTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMapperTest.java @@ -60,17 +60,17 @@ void testToReceiverNotification() { QualityNotificationMessage expectedNotification = NotificationTestDataFactory.createNotificationTestData(); - when(bpnRepository.findManufacturerName(eq(expectedNotification.getSenderBpnNumber()))).thenReturn(Optional.of(expectedNotification.getSenderManufacturerName())); - when(bpnRepository.findManufacturerName(eq(expectedNotification.getReceiverBpnNumber()))).thenReturn(Optional.of(expectedNotification.getReceiverManufacturerName())); + when(bpnRepository.findManufacturerName(eq(expectedNotification.getCreatedBy()))).thenReturn(Optional.of(expectedNotification.getCreatedByName())); + when(bpnRepository.findManufacturerName(eq(expectedNotification.getSendTo()))).thenReturn(Optional.of(expectedNotification.getSendToName())); QualityNotificationMessage actualNotification = notificationMapper.toNotification(edcNotification); assertNotNull(actualNotification.getId()); assertEquals(expectedNotification.getNotificationReferenceId(), actualNotification.getNotificationReferenceId()); - assertEquals(expectedNotification.getSenderBpnNumber(), actualNotification.getSenderBpnNumber()); - assertEquals(expectedNotification.getSenderManufacturerName(), actualNotification.getSenderManufacturerName()); - assertEquals(expectedNotification.getReceiverBpnNumber(), actualNotification.getReceiverBpnNumber()); - assertEquals(expectedNotification.getReceiverManufacturerName(), actualNotification.getReceiverManufacturerName()); + assertEquals(expectedNotification.getCreatedBy(), actualNotification.getCreatedBy()); + assertEquals(expectedNotification.getCreatedByName(), actualNotification.getCreatedByName()); + assertEquals(expectedNotification.getSendTo(), actualNotification.getSendTo()); + assertEquals(expectedNotification.getSendToName(), actualNotification.getSendToName()); assertEquals(expectedNotification.getEdcUrl(), actualNotification.getEdcUrl()); assertNull(actualNotification.getContractAgreementId()); assertEquals("information", actualNotification.getDescription()); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/QualityNotificationMapperTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/QualityNotificationMapperTest.java index d44d017e04..359a331980 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/QualityNotificationMapperTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/QualityNotificationMapperTest.java @@ -53,10 +53,10 @@ void testToReceiverInvestigation() { .notificationReferenceId("Test notification") .notificationStatus(QualityNotificationStatus.RECEIVED) .affectedParts(List.of(new QualityNotificationAffectedPart("123"))) - .senderManufacturerName("senderManufacturerName") - .senderBpnNumber(sender) - .receiverBpnNumber(receiver) - .receiverManufacturerName("receiverManufacturerName") + .createdByName("senderManufacturerName") + .createdBy(sender) + .sendTo(receiver) + .sendToName("receiverManufacturerName") .severity(QualityNotificationSeverity.MINOR) .isInitial(false) .messageId("1") diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerAllIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerAllIT.java index 219a890ff0..b0cc23810d 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerAllIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerAllIT.java @@ -86,7 +86,7 @@ void shoulReturnSupplierAssets() throws JoseException { given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) - .queryParam("owner", "SUPPLIER") + .queryParam("filter", "owner,EQUAL,SUPPLIER") .when() .get("/api/assets/as-built") .then() @@ -104,7 +104,7 @@ void shouldReturnOwnAssets() throws JoseException { given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) - .queryParam("owner", "OWN") + .queryParam("filter", "owner,EQUAL,OWN") .when() .get("/api/assets/as-built") .then() @@ -152,7 +152,7 @@ void shouldReturnAssetsByOwnerFiltering(String ownerValue, int totalItemsValue) given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) - .queryParam("owner", ownerValue) + .queryParam("filter", "owner,EQUAL," + ownerValue) .when() .get("/api/assets/as-built") .then() diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerAllIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerAllIT.java index 71c861ad7c..55748c12ec 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerAllIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerAllIT.java @@ -84,11 +84,11 @@ void shouldReturnAssetsByOwnerFiltering(String ownerValue, int totalItemsValue) //GIVEN assetsSupport.defaultAssetsAsPlannedStored(); - //THEN + //THEN filter=owner,EQUAL,OWN given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) - .queryParam("owner", ownerValue) + .queryParam("filter", "owner,EQUAL," + ownerValue) .when() .get("/api/assets/as-planned") .then() diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/PublisherAlertsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/PublisherAlertsControllerIT.java index 319e85a48e..ca2386eccb 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/PublisherAlertsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/PublisherAlertsControllerIT.java @@ -26,8 +26,6 @@ import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.common.security.JwtRole; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotification; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotificationFactory; import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; import org.eclipse.tractusx.traceability.integration.common.support.AlertNotificationsSupport; import org.eclipse.tractusx.traceability.integration.common.support.AlertsSupport; @@ -43,6 +41,8 @@ import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationSeverity; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationStatus; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationType; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotification; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotificationFactory; import org.hamcrest.Matchers; import org.jose4j.lang.JoseException; import org.junit.jupiter.api.BeforeEach; @@ -90,10 +90,10 @@ void shouldReceiveAlert() { .id("some-id") .notificationStatus(QualityNotificationStatus.SENT) .affectedParts(List.of(new QualityNotificationAffectedPart("urn:uuid:d387fa8e-603c-42bd-98c3-4d87fef8d2bb"))) - .senderManufacturerName("bpn-a") - .senderBpnNumber("Sender Manufacturer name") - .receiverBpnNumber("BPNL00000003AXS3") - .receiverManufacturerName("Receiver manufacturer name") + .createdByName("bpn-a") + .createdBy("Sender Manufacturer name") + .sendTo("BPNL00000003AXS3") + .sendToName("Receiver manufacturer name") .severity(QualityNotificationSeverity.MINOR) .targetDate(Instant.parse("2018-11-30T18:35:24.00Z")) .isInitial(false) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java index 910936e2c6..31761a6f56 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java @@ -609,11 +609,11 @@ void shouldReturnProperlyPagedReceivedAlerts() throws JoseException { .builder() .id(UUID.randomUUID().toString()) .alert(alert) - .senderBpnNumber(senderBPN) + .createdBy(senderBPN) .status(NotificationStatusBaseEntity.CREATED) - .senderManufacturerName(senderName) - .receiverBpnNumber(receiverBPN) - .receiverManufacturerName(receiverName) + .createdByName(senderName) + .sendTo(receiverBPN) + .sendToName(receiverName) .messageId("messageId") .build(); @@ -787,11 +787,11 @@ void shouldReturnAlertById() throws JoseException { .builder() .id("1") .alert(persistedAlert) - .senderBpnNumber(senderBPN) - .senderManufacturerName(senderName) - .receiverBpnNumber(receiverBPN) + .createdBy(senderBPN) + .createdByName(senderName) + .sendTo(receiverBPN) .status(NotificationStatusBaseEntity.CREATED) - .receiverManufacturerName(receiverName) + .sendToName(receiverName) .build()); notificationEntity.setAlert(persistedAlert); alertNotificationsSupport.storedAlertNotification(notificationEntity); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/PublisherInvestigationsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/PublisherInvestigationsControllerIT.java index 01aaf7e398..beba5ae8c2 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/PublisherInvestigationsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/PublisherInvestigationsControllerIT.java @@ -25,8 +25,6 @@ import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.common.security.JwtRole; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotification; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotificationFactory; import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport; import org.eclipse.tractusx.traceability.integration.common.support.InvestigationNotificationsSupport; @@ -43,6 +41,8 @@ import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationStatus; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationType; import org.eclipse.tractusx.traceability.qualitynotification.domain.investigation.service.InvestigationsReceiverService; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotification; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotificationFactory; import org.hamcrest.Matchers; import org.jose4j.lang.JoseException; import org.junit.jupiter.api.BeforeEach; @@ -89,10 +89,10 @@ void shouldReceiveNotification() { .id("some-id") .notificationStatus(QualityNotificationStatus.SENT) .affectedParts(List.of(new QualityNotificationAffectedPart("urn:uuid:d387fa8e-603c-42bd-98c3-4d87fef8d2bb"))) - .senderManufacturerName("bpn-a") - .senderBpnNumber("Sender Manufacturer name") - .receiverBpnNumber("BPNL00000003AXS3") - .receiverManufacturerName("Receiver manufacturer name") + .createdByName("bpn-a") + .createdBy("Sender Manufacturer name") + .sendTo("BPNL00000003AXS3") + .sendToName("Receiver manufacturer name") .severity(QualityNotificationSeverity.MINOR) .isInitial(false) .targetDate(Instant.parse("2018-11-30T18:35:24.00Z")) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java index 5389fdeaee..21808809b7 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java @@ -612,11 +612,11 @@ void shouldReturnProperlyPagedReceivedInvestigations() throws JoseException { .builder() .id(UUID.randomUUID().toString()) .investigation(investigation) - .senderBpnNumber(senderBPN) + .createdBy(senderBPN) .status(NotificationStatusBaseEntity.CREATED) - .senderManufacturerName(senderName) - .receiverBpnNumber(receiverBPN) - .receiverManufacturerName(receiverName) + .createdByName(senderName) + .sendTo(receiverBPN) + .sendToName(receiverName) .messageId("messageId") .build(); @@ -790,11 +790,11 @@ void shouldReturnInvestigationById() throws JoseException { .builder() .id("1") .investigation(persistedInvestigation) - .senderBpnNumber(senderBPN) - .senderManufacturerName(senderName) - .receiverBpnNumber(receiverBPN) + .createdBy(senderBPN) + .createdByName(senderName) + .sendTo(receiverBPN) .status(NotificationStatusBaseEntity.CREATED) - .receiverManufacturerName(receiverName) + .sendToName(receiverName) .build()); notificationEntity.setInvestigation(persistedInvestigation); investigationNotificationsSupport.storedNotification(notificationEntity); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/submodel/SubmodelControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/submodel/SubmodelControllerIT.java new file mode 100644 index 0000000000..514df790e4 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/submodel/SubmodelControllerIT.java @@ -0,0 +1,125 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.integration.submodel; + +import io.restassured.http.ContentType; +import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; +import org.eclipse.tractusx.traceability.submodel.infrastructure.model.SubmodelEntity; +import org.eclipse.tractusx.traceability.submodel.infrastructure.reposotory.JpaSubmodelRepository; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +import static io.restassured.RestAssured.given; +import static org.assertj.core.api.Assertions.assertThat; + +class SubmodelControllerIT extends IntegrationTestSpecification { + + @Autowired + JpaSubmodelRepository jpaSubmodelRepository; + + @Test + void givenNoSubmodels_whenDeleteAll_thenDeleteSubmodelsFromDatabase() { + // given + String submodelId = "UUID:Xa123123"; + jpaSubmodelRepository.save(SubmodelEntity.builder() + .id(submodelId) + .submodel("payload") + .build()); + List savedSubmodels = jpaSubmodelRepository.findAll(); + assertThat(savedSubmodels).isNotEmpty(); + + // when + given() + .log().all() + .when() + .delete("/api/submodel/data") + .then() + .log().all() + .statusCode(204); + + // then + List submodelsAfterDeletion = jpaSubmodelRepository.findAll(); + assertThat(submodelsAfterDeletion).isEmpty(); + } + + @Test + void givenSubmodel_whenGetById_thenGetIt() { + // given + String submodelId = "UUID:Xa123123"; + String payload = "Payload string"; + jpaSubmodelRepository.save(SubmodelEntity.builder() + .id(submodelId) + .submodel(payload) + .build()); + + // when + String responseBody = given() + .log().all() + .when() + .get("/api/submodel/data/" + submodelId) + .then() + .log().all() + .statusCode(200) + .extract() + .asString(); + + // then + assertThat(responseBody).isEqualTo(payload); + } + + @Test + void givenNoSubmodels_whenGetById_thenNotFound() { + // given + String submodelId = "UUID:Xa123123"; + + // when/then + given() + .log().all() + .when() + .get("/api/submodel/data/" + submodelId) + .then() + .log().all() + .statusCode(404); + } + + @Test + void givenSubmodel_whenSave_thenSaveIntoDatabase() { + // given + String submodelId = "submodelId"; + String requestContent = "test request"; + + // when + given() + .contentType(ContentType.JSON) + .log().all() + .when() + .body(requestContent) + .post("/api/submodel/data/" + submodelId) + .then() + .statusCode(204); + + // then + SubmodelEntity entity = jpaSubmodelRepository.findById(submodelId).get(); + assertThat(entity.getId()).isEqualTo(submodelId); + assertThat(entity.getSubmodel()).isEqualTo(requestContent); + } +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/response/AlertResponseTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/response/AlertResponseTest.java index 804b9eef94..c4eb08fabb 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/response/AlertResponseTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/response/AlertResponseTest.java @@ -53,11 +53,11 @@ void givenQualityNotification_whenFrom_thenConstructProperAlertResponse() { .hasFieldOrPropertyWithValue("description", notification.getDescription()) .hasFieldOrPropertyWithValue("createdBy", notification.getNotifications().stream() .findFirst() - .map(QualityNotificationMessage::getSenderBpnNumber) + .map(QualityNotificationMessage::getCreatedBy) .orElse(null)) .hasFieldOrPropertyWithValue("createdByName", notification.getNotifications().stream() .findFirst() - .map(QualityNotificationMessage::getSenderManufacturerName) + .map(QualityNotificationMessage::getCreatedByName) .orElse(null)) .hasFieldOrPropertyWithValue("createdDate", notification.getCreatedAt().toString()) .hasFieldOrPropertyWithValue("assetIds", notification.getAssetIds()) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertControllerTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertControllerTest.java index 5ea4a9ecae..cee1f3f9ad 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertControllerTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertControllerTest.java @@ -107,11 +107,11 @@ void givenRequest_whenGetAlert_thenProperResponse() { .hasFieldOrPropertyWithValue("description", notification.getDescription()) .hasFieldOrPropertyWithValue("createdBy", notification.getNotifications().stream() .findFirst() - .map(QualityNotificationMessage::getSenderBpnNumber) + .map(QualityNotificationMessage::getCreatedBy) .orElse(null)) .hasFieldOrPropertyWithValue("createdByName", notification.getNotifications().stream() .findFirst() - .map(QualityNotificationMessage::getSenderManufacturerName) + .map(QualityNotificationMessage::getCreatedByName) .orElse(null)) .hasFieldOrPropertyWithValue("createdDate", notification.getCreatedAt().toString()) .hasFieldOrPropertyWithValue("assetIds", notification.getAssetIds()) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/model/NotificationTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/model/NotificationTest.java index 9536dafd95..60adcc2a2f 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/model/NotificationTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/model/NotificationTest.java @@ -41,8 +41,8 @@ void testCopyAndSwitchSenderAndReceiverIsAppBpn() { QualityNotificationMessage switchedNotification = notificationTestData.copyAndSwitchSenderAndReceiver(applicationBPN); // Then - assertThat(switchedNotification.getReceiverBpnNumber()).isEqualTo(senderBPN); - assertThat(switchedNotification.getSenderBpnNumber()).isEqualTo(receiverBPN); + assertThat(switchedNotification.getSendTo()).isEqualTo(senderBPN); + assertThat(switchedNotification.getCreatedBy()).isEqualTo(receiverBPN); } @Test @@ -58,7 +58,7 @@ void testCopyAndSwitchSenderAndReceiverIsNotAppBpn() { QualityNotificationMessage switchedNotification = notificationTestData.copyAndSwitchSenderAndReceiver(applicationBPN); // Then - assertThat(switchedNotification.getReceiverBpnNumber()).isEqualTo(receiverBPN); - assertThat(switchedNotification.getSenderBpnNumber()).isEqualTo(senderBPN); + assertThat(switchedNotification.getSendTo()).isEqualTo(receiverBPN); + assertThat(switchedNotification.getCreatedBy()).isEqualTo(senderBPN); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/EdcNotificationServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/EdcNotificationServiceTest.java index fb920234b4..6d2755fd04 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/EdcNotificationServiceTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/EdcNotificationServiceTest.java @@ -21,17 +21,17 @@ import org.eclipse.tractusx.traceability.discovery.domain.model.Discovery; import org.eclipse.tractusx.traceability.discovery.domain.service.DiscoveryService; +import org.eclipse.tractusx.traceability.qualitynotification.domain.base.AlertRepository; +import org.eclipse.tractusx.traceability.qualitynotification.domain.base.InvestigationRepository; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.exception.ContractNegotiationException; -import org.eclipse.tractusx.traceability.qualitynotification.domain.base.service.InvestigationsEDCFacade; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.exception.NoCatalogItemException; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.exception.NoEndpointDataReferenceException; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.exception.SendNotificationException; -import org.eclipse.tractusx.traceability.qualitynotification.domain.base.AlertRepository; -import org.eclipse.tractusx.traceability.qualitynotification.domain.base.InvestigationRepository; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationMessage; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationSeverity; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationType; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.service.EdcNotificationService; +import org.eclipse.tractusx.traceability.qualitynotification.domain.base.service.InvestigationsEDCFacade; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -78,7 +78,7 @@ void testNotificationsServiceUpdateAsync() { when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); // and QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.INVESTIGATION) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -106,7 +106,7 @@ void testNotificationsServiceAlertNotificationUpdateAsync() { when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); // and QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.ALERT) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -132,7 +132,7 @@ void givenNoCatalogItemException_whenHandleSendingInvestigation_thenHandleIt() { Discovery discovery = Discovery.builder().senderUrl(edcSenderUrl).receiverUrls(List.of(edcReceiverUrl)).build(); when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.INVESTIGATION) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -159,7 +159,7 @@ void givenSendNotificationException_whenHandleSendingInvestigation_thenHandleIt( Discovery discovery = Discovery.builder().senderUrl(edcSenderUrl).receiverUrls(List.of(edcReceiverUrl)).build(); when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.INVESTIGATION) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -186,7 +186,7 @@ void givenSendNoEndpointDataReferenceException_whenHandleSendingInvestigation_th Discovery discovery = Discovery.builder().senderUrl(edcSenderUrl).receiverUrls(List.of(edcReceiverUrl)).build(); when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.INVESTIGATION) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -213,7 +213,7 @@ void givenContractNegotiationException_whenHandleSendingInvestigation_thenHandle Discovery discovery = Discovery.builder().senderUrl(edcSenderUrl).receiverUrls(List.of(edcReceiverUrl)).build(); when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.INVESTIGATION) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -241,7 +241,7 @@ void givenNoCatalogItemException_whenHandleSendingAlert_thenHandleIt() { Discovery discovery = Discovery.builder().senderUrl(edcSenderUrl).receiverUrls(List.of(edcReceiverUrl)).build(); when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.ALERT) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -268,7 +268,7 @@ void givenSendNotificationException_whenHandleSendingAlert_thenHandleIt() { Discovery discovery = Discovery.builder().senderUrl(edcSenderUrl).receiverUrls(List.of(edcReceiverUrl)).build(); when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.ALERT) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -295,7 +295,7 @@ void givenSendNoEndpointDataReferenceException_whenHandleSendingAlert_thenHandle Discovery discovery = Discovery.builder().senderUrl(edcSenderUrl).receiverUrls(List.of(edcReceiverUrl)).build(); when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.ALERT) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) @@ -322,7 +322,7 @@ void givenContractNegotiationException_whenHandleSendingAlert_thenHandleIt() { Discovery discovery = Discovery.builder().senderUrl(edcSenderUrl).receiverUrls(List.of(edcReceiverUrl)).build(); when(discoveryService.getDiscoveryByBPN(bpn)).thenReturn(discovery); QualityNotificationMessage notification = QualityNotificationMessage.builder() - .receiverBpnNumber(bpn) + .sendTo(bpn) .type(QualityNotificationType.ALERT) .targetDate(Instant.now()) .severity(QualityNotificationSeverity.MINOR) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/InvestigationsReceiverServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/InvestigationsReceiverServiceTest.java index eaa2dc09d1..b265bd6505 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/InvestigationsReceiverServiceTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/InvestigationsReceiverServiceTest.java @@ -23,8 +23,6 @@ import org.eclipse.tractusx.traceability.common.mapper.NotificationMessageMapper; import org.eclipse.tractusx.traceability.common.mapper.QualityNotificationMapper; import org.eclipse.tractusx.traceability.common.model.BPN; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotification; -import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotificationFactory; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.InvestigationRepository; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotification; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationAffectedPart; @@ -33,6 +31,8 @@ import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationStatus; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationType; import org.eclipse.tractusx.traceability.qualitynotification.domain.investigation.service.InvestigationsReceiverService; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotification; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.edc.model.EDCNotificationFactory; import org.eclipse.tractusx.traceability.testdata.InvestigationTestDataFactory; import org.eclipse.tractusx.traceability.testdata.NotificationTestDataFactory; import org.junit.jupiter.api.DisplayName; @@ -80,10 +80,10 @@ void testHandleNotificationReceiveValidSentNotification() { QualityNotificationMessage notification = QualityNotificationMessage.builder() .id("123") .notificationReferenceId("id123") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description("123") @@ -123,10 +123,10 @@ void testHandleNotificationUpdateValidAcknowledgeNotificationTransition() { QualityNotificationMessage notification = QualityNotificationMessage.builder() .id("123") .notificationReferenceId("id123") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description("123") @@ -165,10 +165,10 @@ void testHandleNotificationUpdateValidDeclineNotificationTransition() { QualityNotificationMessage notification = QualityNotificationMessage.builder() .id("123") .notificationReferenceId("id123") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description("123") @@ -206,10 +206,10 @@ void testHandleNotificationUpdateValidAcceptedNotificationTransition() { QualityNotificationMessage notification = QualityNotificationMessage.builder() .id("123") .notificationReferenceId("id123") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description("123") @@ -247,10 +247,10 @@ void testHandleNotificationUpdateValidCloseNotificationTransition() { QualityNotificationMessage notification = QualityNotificationMessage.builder() .id("123") .notificationReferenceId("id123") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description("123") diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/NotificationPublisherServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/NotificationPublisherServiceTest.java index 0a281afb17..4fa141b7c6 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/NotificationPublisherServiceTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/qualitynotification/domain/service/NotificationPublisherServiceTest.java @@ -121,7 +121,7 @@ void testStartAlertSuccessful() { .containsExactly(QualityNotificationSeverity.MINOR); assertThat(result.getNotifications()).hasSize(1) .first() - .hasFieldOrPropertyWithValue("receiverBpnNumber", receiverBPN); + .hasFieldOrPropertyWithValue("sendTo", receiverBPN); verify(assetRepository).getAssetsById(Arrays.asList("asset-1", "asset-2")); } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/InvestigationTestDataFactory.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/InvestigationTestDataFactory.java index c72c528437..27749d7260 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/InvestigationTestDataFactory.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/InvestigationTestDataFactory.java @@ -43,10 +43,10 @@ public static QualityNotification createInvestigationTestData(QualityNotificatio QualityNotificationMessage notification = QualityNotificationMessage.builder() .id("1") .notificationReferenceId("notificationId") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description(description) @@ -104,10 +104,10 @@ public static QualityNotification createInvestigationTestData(QualityNotificatio QualityNotificationMessage notification = QualityNotificationMessage.builder() .id("1") .notificationReferenceId("notificationId") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description(description) @@ -143,10 +143,10 @@ public static QualityNotification createInvestigationTestData(QualityNotificatio QualityNotificationMessage notification = QualityNotificationMessage.builder() .id("1") .notificationReferenceId("notificationId") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description(description) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/NotificationTestDataFactory.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/NotificationTestDataFactory.java index 11be4d3f25..ad3018cf1b 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/NotificationTestDataFactory.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/NotificationTestDataFactory.java @@ -36,10 +36,10 @@ public static QualityNotificationMessage createNotificationTestData() { return QualityNotificationMessage.builder() .id("123") .notificationReferenceId("id123") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description("123") @@ -59,10 +59,10 @@ public static QualityNotificationMessage createNotificationTestData(QualityNotif return QualityNotificationMessage.builder() .id("123") .notificationReferenceId("id123") - .senderBpnNumber("senderBPN") - .senderManufacturerName("senderManufacturerName") - .receiverBpnNumber("recipientBPN") - .receiverManufacturerName("receiverManufacturerName") + .createdBy("senderBPN") + .createdByName("senderManufacturerName") + .sendTo("recipientBPN") + .sendToName("receiverManufacturerName") .edcUrl("senderAddress") .contractAgreementId("agreement") .description("123")