Skip to content

Commit

Permalink
Updated models
Browse files Browse the repository at this point in the history
  • Loading branch information
Carminepo2 committed Nov 13, 2024
1 parent d28c46e commit 1a5a040
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 52 deletions.
1 change: 0 additions & 1 deletion proto/v2/eservice/eservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ message EServiceDescriptorV2 {
optional int64 deprecatedAt = 16;
optional int64 archivedAt = 17;
EServiceAttributesV2 attributes = 18;
repeated DescriptorRejectionReasonV2 rejectionReasons = 19;
}

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

message EServiceDescriptorDelegateSubmittedV2 {
string descriptorId = 1;
EServiceV2 eservice = 2;
}

message EServiceDescriptorDelegatorApprovedV2 {
string descriptorId = 1;
EServiceV2 eservice = 2;
}

message EServiceDescriptorDelegatorRejectedV2 {
string descriptorId = 1;
EServiceV2 eservice = 2;
}
3 changes: 3 additions & 0 deletions proto/v2/tenant/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ message TenantDelegatedProducerFeatureAddedV2 {
TenantV2 tenant = 1;
}

message TenantDelegatedProducerFeatureRemovedV2 {
TenantV2 tenant = 1;
}
36 changes: 0 additions & 36 deletions src/eservice/eventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import {
EServiceDraftDescriptorUpdatedV2,
EServiceDescriptorQuotasUpdatedV2,
EServiceDescriptionUpdatedV2,
EServiceDescriptorDelegateSubmittedV2,
EServiceDescriptorDelegatorApprovedV2,
EServiceDescriptorDelegatorRejectedV2,
} from "../gen/v2/eservice/events.js";

export function eServiceEventToBinaryDataV2(
Expand Down Expand Up @@ -87,15 +84,6 @@ export function eServiceEventToBinaryDataV2(
.with({ type: "EServiceDescriptionUpdated" }, ({ data }) =>
EServiceDescriptionUpdatedV2.toBinary(data)
)
.with({ type: "EServiceDescriptorDelegateSubmitted" }, ({ data }) =>
EServiceDescriptorDelegateSubmittedV2.toBinary(data)
)
.with({ type: "EServiceDescriptorDelegatorApproved" }, ({ data }) =>
EServiceDescriptorDelegatorApprovedV2.toBinary(data)
)
.with({ type: "EServiceDescriptorDelegatorRejected" }, ({ data }) =>
EServiceDescriptorDelegatorRejectedV2.toBinary(data)
)
.exhaustive();
}

Expand Down Expand Up @@ -252,30 +240,6 @@ export const EServiceEventV2 = z.discriminatedUnion("type", [
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("EServiceDescriptorDelegateSubmitted"),
data: protobufDecoder(EServiceDescriptorDelegateSubmittedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("EServiceDescriptorDelegatorApproved"),
data: protobufDecoder(EServiceDescriptorDelegatorApprovedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("EServiceDescriptorDelegatorRejected"),
data: protobufDecoder(EServiceDescriptorDelegatorRejectedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
]);

export type EServiceEventV2 = z.infer<typeof EServiceEventV2>;
12 changes: 12 additions & 0 deletions src/tenant/eventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
TenantKindUpdatedV2,
MaintenanceTenantPromotedToCertifierV2,
TenantDelegatedProducerFeatureAddedV2,
TenantDelegatedProducerFeatureRemovedV2,
} from "../gen/v2/tenant/events.js";
import { protobufDecoder } from "../utils.js";

Expand Down Expand Up @@ -62,6 +63,9 @@ export function tenantEventToBinaryDataV2(event: TenantEventV2): Uint8Array {
.with({ type: "TenantDelegatedProducerFeatureAdded" }, ({ data }) =>
TenantDelegatedProducerFeatureAddedV2.toBinary(data)
)
.with({ type: "TenantDelegatedProducerFeatureRemoved" }, ({ data }) =>
TenantDelegatedProducerFeatureRemovedV2.toBinary(data)
)
.exhaustive();
}

Expand Down Expand Up @@ -178,6 +182,14 @@ export const TenantEventV2 = z.discriminatedUnion("type", [
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("TenantDelegatedProducerFeatureRemoved"),
data: protobufDecoder(TenantDelegatedProducerFeatureRemovedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
]);

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

0 comments on commit 1a5a040

Please sign in to comment.