Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIN-5555 eservice delegateClientAccess #1193

Merged
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fae70a9
change eservice process
MalpenZibo Nov 11, 2024
040addd
return idDelegable field
MalpenZibo Nov 11, 2024
e520c92
add minimal test
MalpenZibo Nov 11, 2024
ffee648
fix typo
MalpenZibo Nov 11, 2024
1743067
feat: add isClientAccessDelegable field
paologaleotti Nov 12, 2024
c562c98
fix: openapi naming
paologaleotti Nov 12, 2024
2c9dbce
change eservice process
MalpenZibo Nov 11, 2024
cd1c0ee
return idDelegable field
MalpenZibo Nov 11, 2024
fe9117d
add minimal test
MalpenZibo Nov 11, 2024
0f7ec96
fix typo
MalpenZibo Nov 11, 2024
29cbeac
feat: add tests
paologaleotti Nov 12, 2024
c3204f3
Merge branch 'feature/eservice-isdelegable-PIN-5554' of https://githu…
paologaleotti Nov 12, 2024
a8eff9f
update outbound models
MalpenZibo Nov 12, 2024
57a391d
Merge branch 'feature/incaricato' into feature/eservice-isdelegable-P…
MalpenZibo Nov 12, 2024
1bf21ef
fix
MalpenZibo Nov 12, 2024
29abdd0
fix test
MalpenZibo Nov 13, 2024
4e14a41
Merge branch 'feature/eservice-isdelegable-PIN-5554' of https://githu…
paologaleotti Nov 13, 2024
b5779e8
fix: catalog service
paologaleotti Nov 13, 2024
2fa39aa
fix: add missing field in tests
paologaleotti Nov 13, 2024
b59b6c1
fix: add field in test
paologaleotti Nov 13, 2024
2dad452
Merge branch 'feature/incaricato' into feature/eservice-isdelegable-P…
paologaleotti Nov 13, 2024
b7c93e4
Merge branch 'feature/eservice-isdelegable-PIN-5554' into feature/ese…
paologaleotti Nov 13, 2024
38e56fe
fixes
MalpenZibo Nov 18, 2024
6dac364
Merge branch 'feature/incaricato' into feature/eservice-isdelegable-P…
MalpenZibo Nov 18, 2024
93242f6
Merge branch 'feature/eservice-isdelegable-PIN-5554' of https://githu…
paologaleotti Nov 18, 2024
ceb30ab
fix: merge fix
paologaleotti Nov 18, 2024
60cf97d
fix: fields
paologaleotti Nov 18, 2024
9e53397
remove flag from service update
paologaleotti Nov 18, 2024
6adfebb
fix: set flag to false when isDelegable is false
paologaleotti Nov 19, 2024
dfcfdbb
add missing isDelegable prop
MalpenZibo Nov 19, 2024
633f044
update bruno files
MalpenZibo Nov 19, 2024
48de0e5
Merge branch 'feature/eservice-isdelegable-PIN-5554' into feature/ese…
paologaleotti Nov 19, 2024
68b1dc7
add missing isSignalHubEnabled
MalpenZibo Nov 19, 2024
5a2858f
manage isClientAccessDelegable update when updating isDelegable flag
paologaleotti Nov 20, 2024
d8f67fa
fix: bff and manual testing
paologaleotti Nov 20, 2024
5ff0de6
Merge branch 'feature/eservice-isdelegable-PIN-5554' into feature/ese…
paologaleotti Nov 20, 2024
f545500
feat: reintroduce flag update
paologaleotti Nov 20, 2024
2bbbe0f
feat: add tests
paologaleotti Nov 25, 2024
7d72dbf
fix: tests
paologaleotti Nov 25, 2024
547823a
Merge branch 'feature/incaricato' of https://github.com/pagopa/intero…
paologaleotti Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion collections/bff/catalog/Create a new EService.bru
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ body:json {
"description": "This is a test from BFF",
"technology": "SOAP",
"mode": "DELIVER",
"isSignalHubEnabled": true
"isSignalHubEnabled": true,
"isDelegable": true,
"isClientAccessDelegable": true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ body:json {
"description": "test eservice updated from BFF",
"technology": "SOAP",
"mode": "RECEIVE",
"isSignalHubEnabled": false
"isSignalHubEnabled": false,
"isDelegable": false,
"isClientAccessDelegable": false
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/api-clients/open-api/apiGatewayApi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2619,6 +2619,10 @@ components:
type: string
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
EServiceAttributes:
description: the attributes set associated to the EService
properties:
Expand Down
20 changes: 20 additions & 0 deletions packages/api-clients/open-api/bffApi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12973,6 +12973,10 @@ components:
$ref: "#/components/schemas/EServiceMode"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
EServiceSeed:
type: object
additionalProperties: false
Expand All @@ -12992,6 +12996,10 @@ components:
$ref: "#/components/schemas/EServiceMode"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
UpdateEServiceDescriptorQuotas:
required:
- voucherLifespan
Expand Down Expand Up @@ -13239,6 +13247,10 @@ components:
$ref: "#/components/schemas/Mail"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
ProducerEServiceDetails:
type: object
additionalProperties: false
Expand Down Expand Up @@ -13267,6 +13279,10 @@ components:
$ref: "#/components/schemas/EServiceRiskAnalysis"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
EServiceMode:
type: string
description: Risk Analysis Mode
Expand Down Expand Up @@ -13394,6 +13410,10 @@ components:
$ref: "#/components/schemas/Mail"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
EServiceDoc:
type: object
additionalProperties: false
Expand Down
12 changes: 12 additions & 0 deletions packages/api-clients/open-api/catalogApi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,10 @@ components:
$ref: "#/components/schemas/DescriptorSeedForEServiceCreation"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
UpdateEServiceSeed:
type: object
additionalProperties: false
Expand All @@ -1151,6 +1155,10 @@ components:
$ref: "#/components/schemas/EServiceMode"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
DescriptorSeedForEServiceCreation:
required:
- audience
Expand Down Expand Up @@ -1459,6 +1467,10 @@ components:
$ref: "#/components/schemas/EServiceMode"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
isClientAccessDelegable:
type: boolean
EServiceMode:
type: string
description: Risk Analysis Mode
Expand Down
2 changes: 2 additions & 0 deletions packages/api-gateway/src/services/catalogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,7 @@ export async function enhanceEservice(
serverUrls: latestNonDraftDescriptor.serverUrls,
producer: producerOrganization,
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
isClientAccessDelegable: eservice.isClientAccessDelegable,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export function toBffCatalogDescriptorEService(
toBffCatalogApiEserviceRiskAnalysis
),
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
isClientAccessDelegable: eservice.isClientAccessDelegable,
};
}

Expand Down Expand Up @@ -265,6 +267,8 @@ export function toBffCatalogApiProducerDescriptorEService(
),
descriptors: notDraftDecriptors,
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
isClientAccessDelegable: eservice.isClientAccessDelegable,
};
}

Expand Down
2 changes: 2 additions & 0 deletions packages/backend-for-frontend/src/model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,7 @@ export const ConfigurationEservice = z.object({
descriptor: ConfigurationDescriptor,
riskAnalysis: z.array(ConfigurationRiskAnalysis),
isSignalHubEnabled: z.boolean().optional(),
isDelegable: z.boolean().optional(),
isClientAccessDelegable: z.boolean().optional(),
});
export type ConfigurationEservice = z.infer<typeof ConfigurationEservice>;
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ export function catalogServiceBuilder(
toBffCatalogApiEserviceRiskAnalysis
),
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
isClientAccessDelegable: eservice.isClientAccessDelegable,
};
},
updateEServiceDescription: async (
Expand Down Expand Up @@ -1131,6 +1133,8 @@ export function catalogServiceBuilder(
importedEservice.descriptor.agreementApprovalPolicy,
},
isSignalHubEnabled: importedEservice.isSignalHubEnabled,
isDelegable: importedEservice.isDelegable,
isClientAccessDelegable: importedEservice.isClientAccessDelegable,
};

const pollEServiceById = createPollingByCondition(() =>
Expand Down
2 changes: 2 additions & 0 deletions packages/backend-for-frontend/src/utilities/fileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export function buildJsonConfig(
technology: eservice.technology,
mode: eservice.mode,
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
isClientAccessDelegable: eservice.isClientAccessDelegable,
descriptor: {
interface: descriptor.interface && {
prettyName: descriptor.interface.prettyName,
Expand Down
2 changes: 2 additions & 0 deletions packages/catalog-process/src/model/domain/apiConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,6 @@ export const eServiceToApiEService = (
})),
descriptors: eservice.descriptors.map(descriptorToApiDescriptor),
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
isClientAccessDelegable: eservice.isClientAccessDelegable,
});
14 changes: 13 additions & 1 deletion packages/catalog-process/src/services/catalogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
eserviceMode,
} from "pagopa-interop-models";
import { catalogApi } from "pagopa-interop-api-clients";
import { match } from "ts-pattern";
import { match, P } from "ts-pattern";
import {
apiAgreementApprovalPolicyToAgreementApprovalPolicy,
apiEServiceModeToEServiceMode,
Expand Down Expand Up @@ -437,6 +437,12 @@ export function catalogServiceBuilder(
createdAt: creationDate,
riskAnalysis: [],
isSignalHubEnabled: seed.isSignalHubEnabled,
isDelegable: seed.isDelegable,
isClientAccessDelegable: match(seed.isDelegable)
.with(P.nullish, () => undefined)
.with(false, () => false)
.with(true, () => seed.isClientAccessDelegable)
.exhaustive(),
};

const eserviceCreationEvent = toCreateEventEServiceAdded(
Expand Down Expand Up @@ -558,6 +564,12 @@ export function catalogServiceBuilder(
}))
: eservice.data.descriptors,
isSignalHubEnabled: eserviceSeed.isSignalHubEnabled,
isDelegable: eserviceSeed.isDelegable,
isClientAccessDelegable: match(eserviceSeed.isDelegable)
.with(P.nullish, () => undefined)
.with(false, () => false)
.with(true, () => eserviceSeed.isClientAccessDelegable)
.exhaustive(),
};

const event = toCreateEventEServiceUpdated(
Expand Down
11 changes: 11 additions & 0 deletions packages/catalog-process/test/createEService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ describe("create eservice", () => {
});
it("should write on event-store for the creation of an eservice", async () => {
const isSignalHubEnabled = randomArrayItem([false, true, undefined]);
const isDelegable = randomArrayItem([false, true, undefined]);
const isClientAccessDelegable = isDelegable
? randomArrayItem([false, true, undefined])
: undefined;

const eservice = await catalogService.createEService(
{
name: mockEService.name,
Expand All @@ -49,6 +54,8 @@ describe("create eservice", () => {
mode: "DELIVER",
descriptor: buildDescriptorSeedForEserviceCreation(mockDescriptor),
isSignalHubEnabled,
isDelegable,
isClientAccessDelegable,
},
{
authData: getMockAuthData(mockEService.producerId),
Expand Down Expand Up @@ -96,12 +103,16 @@ describe("create eservice", () => {
id: eservice.id,
descriptors: [],
isSignalHubEnabled,
isDelegable,
isClientAccessDelegable,
};
const expectedEserviceWithDescriptor: EService = {
paologaleotti marked this conversation as resolved.
Show resolved Hide resolved
...mockEService,
createdAt: new Date(),
id: eservice.id,
isSignalHubEnabled,
isDelegable,
isClientAccessDelegable,
descriptors: [
{
...mockDescriptor,
Expand Down
3 changes: 3 additions & 0 deletions packages/catalog-process/test/getEserviceById.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ describe("get eservice by id", () => {
id: generateId(),
name: "eservice 001",
descriptors: [descriptor1],
isSignalHubEnabled: true,
isDelegable: true,
isClientAccessDelegable: true,
};
await addOneEService(eservice1);
const authData: AuthData = {
Expand Down
3 changes: 3 additions & 0 deletions packages/catalog-process/test/getEservices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ describe("get eservices", () => {
name: "eservice 001 test",
descriptors: [descriptor1],
producerId: organizationId1,
isSignalHubEnabled: true,
isDelegable: true,
isClientAccessDelegable: true,
};
await addOneEService(eservice1);

Expand Down
7 changes: 7 additions & 0 deletions packages/catalog-process/test/updateEservice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ describe("update eService", () => {
vi.spyOn(fileManager, "delete");

const isSignalHubEnabled = randomArrayItem([false, true, undefined]);
const isClientAccessDelegable = randomArrayItem([false, true, undefined]);
paologaleotti marked this conversation as resolved.
Show resolved Hide resolved
const isDelegable = randomArrayItem([false, true, undefined]);

const descriptor: Descriptor = {
...getMockDescriptor(),
state: descriptorState.draft,
Expand All @@ -59,6 +62,8 @@ describe("update eService", () => {
technology: "REST",
mode: "DELIVER",
isSignalHubEnabled,
isDelegable,
isClientAccessDelegable,
},
{
authData: getMockAuthData(mockEService.producerId),
Expand All @@ -72,6 +77,8 @@ describe("update eService", () => {
...eservice,
name: updatedName,
isSignalHubEnabled,
isDelegable,
isClientAccessDelegable,
};

const writtenEvent = await readLastEserviceEvent(mockEService.id);
Expand Down
2 changes: 2 additions & 0 deletions packages/models/proto/v2/eservice/eservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ message EServiceV2 {
repeated EServiceRiskAnalysisV2 riskAnalysis = 8;
EServiceModeV2 mode = 9;
optional bool isSignalHubEnabled = 10;
optional bool isDelegable = 11;
optional bool isClientAccessDelegable = 12;
}


Expand Down
2 changes: 2 additions & 0 deletions packages/models/src/eservice/eservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,7 @@ export const EService = z.object({
riskAnalysis: z.array(RiskAnalysis),
mode: EServiceMode,
isSignalHubEnabled: z.boolean().optional(),
isDelegable: z.boolean().optional(),
isClientAccessDelegable: z.boolean().optional(),
});
export type EService = z.infer<typeof EService>;