Skip to content

Commit 0108f74

Browse files
Carminepo2Viktor-K
authored andcommitted
PIN-6648 - Removed instanceLabel (#1773)
1 parent 96f03ae commit 0108f74

File tree

65 files changed

+283
-961
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+283
-961
lines changed

collections/bff/catalog/Create EService Instance From Template.bru

-9
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ headers {
1818
Authorization: {{JWT}}
1919
}
2020

21-
body:json {
22-
{
23-
"instanceLabel": "{{randomUuid}}"
24-
}
25-
}
26-
2721
script:pre-request {
2822
const { v4 } = require('uuid');
2923
bru.setVar("randomUuid", v4() );
@@ -32,9 +26,6 @@ script:pre-request {
3226
docs {
3327
This endpoint creates a new EService instance from an existing template.
3428

35-
Request body fields:
36-
- instanceLabel: (Optional) Custom name to identify the new instance
37-
3829
Returns a CreatedEServiceDescriptor object with status 200 on success containing:
3930
- id: ID of the created EService
4031
- descriptorId: ID of the first descriptor

collections/bff/catalog/Update EService Template Instance general information.bru

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ body:json {
2323
"isSignalHubEnabled": true,
2424
"isConsumerDelegable": true,
2525
"isClientAccessDelegable": false,
26-
"instanceLabel": ""
2726
}
2827
}
2928

collections/catalog/Create EService from existing Template.bru

-17
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,3 @@ headers {
1515
X-Correlation-Id: {{correlation-id}}
1616
}
1717

18-
body:json {
19-
{
20-
"instanceLabel": "{{uuid}}"
21-
}
22-
}
23-
24-
script:pre-request {
25-
function generateUUID() {
26-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
27-
var r = Math.random() * 16 | 0,
28-
v = c == 'x' ? r : (r & 0x3 | 0x8);
29-
return v.toString(16);
30-
});
31-
}
32-
33-
bru.setVar("uuid", generateUUID())
34-
}

collections/catalog/Edit Eservice Template Instance.bru

-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@ body:json {
2424
"isSignalHubEnabled": true,
2525
"isConsumerDelegable": true,
2626
"isClientAccessDelegable": false,
27-
"instanceLabel": ""
2827
}
2928
}

docker/readmodel-db/catalog.sql

+1-9
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,11 @@ CREATE TABLE IF NOT EXISTS readmodel_catalog.eservice (
1212
is_signal_hub_enabled BOOLEAN,
1313
is_consumer_delegable BOOLEAN,
1414
is_client_access_delegable BOOLEAN,
15+
template_id UUID,
1516
PRIMARY KEY (id),
1617
CONSTRAINT eservice_id_metadata_version_unique UNIQUE (id, metadata_version)
1718
);
1819

19-
CREATE TABLE IF NOT EXISTS readmodel_catalog.eservice_template_ref (
20-
eservice_template_id UUID NOT NULL,
21-
eservice_id UUID NOT NULL REFERENCES readmodel_catalog.eservice (id) ON DELETE CASCADE,
22-
metadata_version INTEGER NOT NULL,
23-
instance_label VARCHAR,
24-
PRIMARY KEY (eservice_template_id, eservice_id),
25-
FOREIGN KEY (eservice_id, metadata_version) REFERENCES readmodel_catalog.eservice (id, metadata_version) DEFERRABLE INITIALLY DEFERRED
26-
);
27-
2820
CREATE TABLE IF NOT EXISTS readmodel_catalog.eservice_descriptor (
2921
id UUID,
3022
eservice_id UUID NOT NULL REFERENCES readmodel_catalog.eservice (id) ON DELETE CASCADE,

packages/agreement-outbound-writer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"vitest": "1.6.0"
3030
},
3131
"dependencies": {
32-
"@pagopa/interop-outbound-models": "1.5.4",
32+
"@pagopa/interop-outbound-models": "1.6.1",
3333
"@protobuf-ts/runtime": "2.9.4",
3434
"connection-string": "4.4.0",
3535
"dotenv-flow": "4.1.0",

packages/api-clients/open-api/apiGatewayApi.yml

-3
Original file line numberDiff line numberDiff line change
@@ -2635,9 +2635,6 @@ components:
26352635
templateId:
26362636
type: string
26372637
format: uuid
2638-
instanceLabel:
2639-
type: string
2640-
format: uuid
26412638
templateVersionId:
26422639
type: string
26432640
format: uuid

packages/api-clients/open-api/bffApi.yml

-12
Original file line numberDiff line numberDiff line change
@@ -17534,10 +17534,6 @@ components:
1753417534
type: boolean
1753517535
isClientAccessDelegable:
1753617536
type: boolean
17537-
instanceLabel:
17538-
type: string
17539-
minLength: 5
17540-
maxLength: 60
1754117537
EServiceSeed:
1754217538
type: object
1754317539
additionalProperties: false
@@ -18102,8 +18098,6 @@ components:
1810218098
format: uuid
1810318099
templateName:
1810418100
type: string
18105-
instanceLabel:
18106-
type: string
1810718101
templateInterface:
1810818102
$ref: "#/components/schemas/EServiceDoc"
1810918103
interfaceMetadata:
@@ -20514,10 +20508,6 @@ components:
2051420508
type: object
2051520509
additionalProperties: false
2051620510
properties:
20517-
instanceLabel:
20518-
type: string
20519-
minLength: 5
20520-
maxLength: 60
2052120511
isSignalHubEnabled:
2052220512
type: boolean
2052320513
isConsumerDelegable:
@@ -20577,8 +20567,6 @@ components:
2057720567
type: array
2057820568
items:
2057920569
$ref: "#/components/schemas/CompactDescriptor"
20580-
instanceLabel:
20581-
type: string
2058220570
EServiceTemplateInstances:
2058320571
type: object
2058420572
additionalProperties: false

packages/api-clients/open-api/catalogApi.yml

+3-13
Original file line numberDiff line numberDiff line change
@@ -2205,10 +2205,6 @@ components:
22052205
type: boolean
22062206
isClientAccessDelegable:
22072207
type: boolean
2208-
instanceLabel:
2209-
type: string
2210-
minLength: 5
2211-
maxLength: 60
22122208
DescriptorSeedForEServiceCreation:
22132209
required:
22142210
- audience
@@ -2579,9 +2575,9 @@ components:
25792575
type: boolean
25802576
isClientAccessDelegable:
25812577
type: boolean
2582-
templateRef:
2583-
$ref: "#/components/schemas/EServiceTemplateRef"
2584-
required: false
2578+
templateId:
2579+
type: string
2580+
format: uuid
25852581
EServiceTemplateRef:
25862582
type: object
25872583
additionalProperties: false
@@ -2591,8 +2587,6 @@ components:
25912587
id:
25922588
type: string
25932589
format: uuid
2594-
instanceLabel:
2595-
type: string
25962590
EServiceTemplateVersionRef:
25972591
type: object
25982592
additionalProperties: false
@@ -3040,10 +3034,6 @@ components:
30403034
type: object
30413035
additionalProperties: false
30423036
properties:
3043-
instanceLabel:
3044-
type: string
3045-
minLength: 5
3046-
maxLength: 60
30473037
isSignalHubEnabled:
30483038
type: boolean
30493039
isConsumerDelegable:

packages/api-gateway/src/services/catalogService.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,9 @@ export async function enhanceEservice(
259259
isSignalHubEnabled: eservice.isSignalHubEnabled,
260260
isConsumerDelegable: eservice.isConsumerDelegable,
261261
isClientAccessDelegable: eservice.isClientAccessDelegable,
262-
templateRef: eservice.templateRef
262+
templateRef: eservice.templateId
263263
? {
264-
templateId: eservice.templateRef.id,
265-
instanceLabel: eservice.templateRef.instanceLabel,
264+
templateId: eservice.templateId,
266265
templateVersionId: latestValidDescriptor.templateVersionRef?.id,
267266
}
268267
: undefined,

packages/backend-for-frontend/src/api/catalogApiConverter.ts

-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ export function toBffEServiceTemplateInstance(
411411
producerName: producer.name,
412412
latestDescriptor: validDescriptors.at(-1),
413413
descriptors: validDescriptors,
414-
instanceLabel: eservice.templateRef?.instanceLabel,
415414
};
416415
}
417416

packages/backend-for-frontend/src/services/catalogService.ts

+5-10
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ const enhanceProducerEService = (
194194
: undefined;
195195

196196
const eserviceTemplate = eserviceTemplates.find(
197-
(t) => t.id === eservice.templateRef?.id
197+
(t) => t.id === eservice.templateId
198198
);
199199

200200
return {
@@ -397,7 +397,7 @@ export function catalogServiceBuilder(
397397
},
398398
});
399399

400-
const eServiceTemplateId = eservice.templateRef?.id;
400+
const eServiceTemplateId = eservice.templateId;
401401

402402
const eserviceTemplate = eServiceTemplateId
403403
? await eserviceTemplateProcessClient.getEServiceTemplateById({
@@ -462,7 +462,6 @@ export function catalogServiceBuilder(
462462
templateRef: eserviceTemplate && {
463463
templateId: eserviceTemplate.id,
464464
templateName: eserviceTemplate.name,
465-
instanceLabel: eservice.templateRef?.instanceLabel,
466465
templateVersionId: descriptor.templateVersionRef?.id,
467466
templateInterface: eserviceTemplateInterface
468467
? toBffCatalogApiDescriptorDoc(eserviceTemplateInterface)
@@ -799,7 +798,7 @@ export function catalogServiceBuilder(
799798
const eserviceTemplatesIds = Array.from(
800799
new Set(
801800
res.results
802-
.map((r) => r.templateRef?.id)
801+
.map((r) => r.templateId)
803802
.filter((id): id is string => !!id)
804803
)
805804
);
@@ -1100,7 +1099,7 @@ export function catalogServiceBuilder(
11001099

11011100
const previousDescriptor = retrieveLatestDescriptor(eService.descriptors);
11021101

1103-
if (eService.templateRef) {
1102+
if (eService.templateId) {
11041103
const { id } =
11051104
await catalogProcessClient.createTemplateInstanceDescriptor(
11061105
{
@@ -1698,11 +1697,7 @@ export function catalogServiceBuilder(
16981697
seed: bffApi.InstanceEServiceSeed,
16991698
{ headers, logger }: WithLogger<BffAppContext>
17001699
): Promise<bffApi.CreatedEServiceDescriptor> => {
1701-
logger.info(
1702-
`Creating EService from template ${templateId} ${
1703-
seed.instanceLabel ? `with instanceLabel ${seed.instanceLabel}` : ""
1704-
}`
1705-
);
1700+
logger.info(`Creating EService from template ${templateId}`);
17061701

17071702
const eService =
17081703
await catalogProcessClient.createEServiceInstanceFromTemplate(seed, {

packages/backend-for-frontend/src/services/validators.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
import {
88
delegationKind,
99
delegationState,
10-
EService,
1110
EServiceId,
11+
EServiceTemplateId,
1212
TenantId,
1313
} from "pagopa-interop-models";
1414
import { match } from "ts-pattern";
@@ -214,9 +214,10 @@ export function assertIsDraftEservice(eservice: catalogApi.EService): void {
214214
export function assertEServiceNotTemplateInstance(
215215
eservice: catalogApi.EService
216216
): asserts eservice is catalogApi.EService & {
217-
templateRef: NonNullable<EService["templateRef"]>;
217+
templateId: EServiceTemplateId | undefined;
218218
} {
219-
if (eservice.templateRef !== undefined) {
220-
throw templateInstanceNotAllowed(eservice.id, eservice.templateRef.id);
219+
const templateId = eservice.templateId;
220+
if (templateId !== undefined) {
221+
throw templateInstanceNotAllowed(eservice.id, templateId);
221222
}
222223
}

packages/backend-for-frontend/test/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const toEserviceCatalogProcessMock = (
6868
mode: "DELIVER" as const,
6969
technology: "REST" as const,
7070
riskAnalysis: [],
71-
templateRef: eservice.templateRef,
71+
templateId: eservice.templateId,
7272
descriptors: [
7373
{
7474
...descriptor,

packages/catalog-outbound-writer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"vitest": "1.6.0"
3030
},
3131
"dependencies": {
32-
"@pagopa/interop-outbound-models": "1.5.4",
32+
"@pagopa/interop-outbound-models": "1.6.1",
3333
"@protobuf-ts/runtime": "2.9.4",
3434
"connection-string": "4.4.0",
3535
"dotenv-flow": "4.1.0",

packages/catalog-outbound-writer/src/converters/toOutboundEventV2.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
EServiceV2,
44
EServiceDescriptorV2,
55
EServiceDocumentV2,
6-
EServiceTemplateRefV2,
76
EServiceTemplateVersionRefV2,
87
TemplateInstanceInterfaceMetadataV2,
98
} from "pagopa-interop-models";
@@ -12,7 +11,6 @@ import {
1211
EServiceV2 as OutboundEServiceV2,
1312
EServiceDescriptorV2 as OutboundEServiceDescriptorV2,
1413
EServiceDocumentV2 as OutboundEServiceDocumentV2,
15-
EServiceTemplateRefV2 as OutboundEServiceTemplateRefV2,
1614
EServiceTemplateVersionRefV2 as OutboundEServiceTemplateVersionRefV2,
1715
TemplateInstanceInterfaceMetadataV2 as OutboundTemplateInstanceInterfaceMetadataV2,
1816
} from "@pagopa/interop-outbound-models";
@@ -28,15 +26,6 @@ function toOutboundEServiceDocumentV2(
2826
};
2927
}
3028

31-
function toOutboundEServiceTemplateRefV2(
32-
templateRef: EServiceTemplateRefV2
33-
): Exact<OutboundEServiceTemplateRefV2, EServiceTemplateRefV2> {
34-
return {
35-
id: templateRef.id,
36-
instanceLabel: templateRef.instanceLabel,
37-
};
38-
}
39-
4029
function toOutboundTemplateInstanceInterfaceMetadataV2(
4130
interfaceMetadata: TemplateInstanceInterfaceMetadataV2
4231
): Exact<
@@ -86,9 +75,7 @@ function toOutboundEServiceV2(
8675
...eservice,
8776
riskAnalysis: undefined,
8877
descriptors: eservice.descriptors.map(toOutboundDescriptorV2),
89-
templateRef:
90-
eservice.templateRef &&
91-
toOutboundEServiceTemplateRefV2(eservice.templateRef),
78+
templateId: eservice.templateId,
9279
};
9380
}
9481

packages/catalog-process/src/model/domain/apiConverter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,5 +205,5 @@ export const eServiceToApiEService = (
205205
isSignalHubEnabled: eservice.isSignalHubEnabled,
206206
isConsumerDelegable: eservice.isConsumerDelegable,
207207
isClientAccessDelegable: eservice.isClientAccessDelegable,
208-
templateRef: eservice.templateRef,
208+
templateId: eservice.templateId,
209209
});

packages/catalog-process/src/model/domain/models.ts

-9
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import {
1212
AttributeId,
1313
TenantId,
1414
EServiceTemplateId,
15-
EServiceTemplateVersionId,
16-
EserviceAttributes,
1715
} from "pagopa-interop-models";
1816

1917
export type ApiGetEServicesFilters = {
@@ -44,13 +42,6 @@ export type EServiceDocument = {
4442
readonly serverUrls: string[];
4543
};
4644

47-
export type EServiceTemplateReferences = {
48-
readonly id: EServiceTemplateId;
49-
readonly versionId: EServiceTemplateVersionId;
50-
readonly attributes: EserviceAttributes;
51-
readonly instanceLabel?: string;
52-
};
53-
5445
export const consumer = z.object({
5546
descriptorVersion: z.string(),
5647
descriptorState: DescriptorState,

0 commit comments

Comments
 (0)