Skip to content

Commit

Permalink
release/1.0.4c: Add MaintenanceTenantUpdatedV2 event
Browse files Browse the repository at this point in the history
  • Loading branch information
galales committed Nov 11, 2024
1 parent 12f667a commit aad053f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pagopa/interop-outbound-models",
"version": "1.0.4b",
"version": "1.0.4c",
"description": "PagoPA Interoperability outbound models",
"main": "dist",
"type": "module",
Expand Down
5 changes: 5 additions & 0 deletions proto/v2/tenant/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ message MaintenanceTenantDeletedV2 {
TenantV2 tenant = 2;
}

message MaintenanceTenantUpdatedV2 {
string tenantId = 1;
TenantV2 tenant = 2;
}

message MaintenanceTenantPromotedToCertifierV2 {
TenantV2 tenant = 1;
}
Expand Down
12 changes: 12 additions & 0 deletions src/tenant/eventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
TenantVerifiedAttributeExtensionUpdatedV2,
TenantKindUpdatedV2,
MaintenanceTenantPromotedToCertifierV2,
MaintenanceTenantUpdatedV2,
} from "../gen/v2/tenant/events.js";
import { protobufDecoder } from "../utils.js";

Expand Down Expand Up @@ -52,6 +53,9 @@ export function tenantEventToBinaryDataV2(event: TenantEventV2): Uint8Array {
.with({ type: "MaintenanceTenantDeleted" }, ({ data }) =>
MaintenanceTenantDeletedV2.toBinary(data)
)
.with({ type: "MaintenanceTenantUpdated" }, ({ data }) =>
MaintenanceTenantUpdatedV2.toBinary(data)
)
.with({ type: "TenantKindUpdated" }, ({ data }) =>
TenantKindUpdatedV2.toBinary(data)
)
Expand Down Expand Up @@ -150,6 +154,14 @@ export const TenantEventV2 = z.discriminatedUnion("type", [
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("MaintenanceTenantUpdated"),
data: protobufDecoder(MaintenanceTenantUpdatedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("TenantKindUpdated"),
Expand Down

0 comments on commit aad053f

Please sign in to comment.