Skip to content

Commit

Permalink
Revert "Undo e-service model change"
Browse files Browse the repository at this point in the history
This reverts commit 502b26b.
  • Loading branch information
Carminepo2 committed Oct 14, 2024
1 parent 502b26b commit f1ef54e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions proto/v2/eservice/eservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ message EServiceV2 {
repeated EServiceDescriptorV2 descriptors = 6;
int64 createdAt = 7;
EServiceModeV2 mode = 8;
optional string delegationId = 9;
}

message EServiceAttributeValueV2 {
Expand Down
10 changes: 10 additions & 0 deletions proto/v2/eservice/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,13 @@ message EServiceDescriptorDocumentDeletedV2 {
message EServiceDescriptionUpdatedV2 {
EServiceV2 eservice = 1;
}

message EServiceDelegationAssignedV2 {
string delegationId = 1;
EServiceV2 eservice = 2;
}

message EServiceDelegationRevokedV2 {
string delegationId = 1;
EServiceV2 eservice = 2;
}
24 changes: 24 additions & 0 deletions src/eservice/eventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
EServiceDraftDescriptorUpdatedV2,
EServiceDescriptorQuotasUpdatedV2,
EServiceDescriptionUpdatedV2,
EServiceDelegationAssignedV2,
EServiceDelegationRevokedV2,
} from "../gen/v2/eservice/events.js";

export function eServiceEventToBinaryDataV2(
Expand Down Expand Up @@ -84,6 +86,12 @@ export function eServiceEventToBinaryDataV2(
.with({ type: "EServiceDescriptionUpdated" }, ({ data }) =>
EServiceDescriptionUpdatedV2.toBinary(data)
)
.with({ type: "EServiceDelegationAssigned" }, ({ data }) =>
EServiceDescriptionUpdatedV2.toBinary(data)
)
.with({ type: "EServiceDelegationRevoked" }, ({ data }) =>
EServiceDescriptionUpdatedV2.toBinary(data)
)
.exhaustive();
}

Expand Down Expand Up @@ -240,6 +248,22 @@ export const EServiceEventV2 = z.discriminatedUnion("type", [
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("EServiceDelegationAssigned"),
data: protobufDecoder(EServiceDelegationAssignedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("EServiceDelegationRevoked"),
data: protobufDecoder(EServiceDelegationRevokedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
]);

export type EServiceEventV2 = z.infer<typeof EServiceEventV2>;

0 comments on commit f1ef54e

Please sign in to comment.