Skip to content

Commit

Permalink
Support Relationship Decomposition Based Identity Deletion (#330)
Browse files Browse the repository at this point in the history
* chore: update transport types

* chore: update runtime types
  • Loading branch information
jkoenig134 authored Nov 15, 2024
1 parent 0465930 commit 04cc4a0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions packages/runtime/src/types/transport/RelationshipDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ export enum RelationshipAuditLogEntryReason {
AcceptanceOfReactivation = "AcceptanceOfReactivation",
RejectionOfReactivation = "RejectionOfReactivation",
RevocationOfReactivation = "RevocationOfReactivation",
Decomposition = "Decomposition"
Decomposition = "Decomposition",
DecompositionDueToIdentityDeletion = "DecompositionDueToIdentityDeletion"
}

export interface RelationshipAuditLogEntryDTO {
createdAt: string;
createdBy: string;
createdByDevice: string;
createdByDevice?: string;
reason: RelationshipAuditLogEntryReason;
oldStatus?: RelationshipStatus;
newStatus: RelationshipStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class RelationshipMapper {
return {
createdAt: entry.createdAt.toString(),
createdBy: entry.createdBy.toString(),
createdByDevice: entry.createdByDevice.toString(),
createdByDevice: entry.createdByDevice?.toString(),
reason: entry.reason,
oldStatus: entry.oldStatus,
newStatus: entry.newStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class RelationshipAuditLog {
return RelationshipAuditLogEntry.from({
createdAt: CoreDate.from(entry.createdAt),
createdBy: CoreAddress.from(entry.createdBy),
createdByDevice: CoreId.from(entry.createdByDevice),
createdByDevice: entry.createdByDevice ? CoreId.from(entry.createdByDevice) : undefined,
reason: entry.reason,
oldStatus: entry.oldStatus,
newStatus: entry.newStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RelationshipStatus } from "../transmission/RelationshipStatus";
export interface IRelationshipAuditLogEntry extends ISerializable {
createdAt: ICoreDate;
createdBy: ICoreAddress;
createdByDevice: ICoreId;
createdByDevice?: ICoreId;
reason: RelationshipAuditLogEntryReason;
oldStatus?: RelationshipStatus;
newStatus: RelationshipStatus;
Expand All @@ -22,9 +22,9 @@ export class RelationshipAuditLogEntry extends Serializable implements IRelation
@serialize()
public createdBy: CoreAddress;

@validate()
@validate({ nullable: true })
@serialize()
public createdByDevice: CoreId;
public createdByDevice?: CoreId;

@validate({
customValidator: (v) => (!Object.values(RelationshipAuditLogEntryReason).includes(v) ? `must be one of: ${Object.values(RelationshipAuditLogEntryReason)}` : undefined)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface BackboneRelationshipAuditLog extends Array<BackboneRelationship
export interface BackboneRelationshipAuditLogEntry {
createdAt: string;
createdBy: string;
createdByDevice: string;
createdByDevice?: string;
reason: RelationshipAuditLogEntryReason;
oldStatus?: RelationshipStatus;
newStatus: RelationshipStatus;
Expand All @@ -21,5 +21,6 @@ export enum RelationshipAuditLogEntryReason {
AcceptanceOfReactivation = "AcceptanceOfReactivation",
RejectionOfReactivation = "RejectionOfReactivation",
RevocationOfReactivation = "RevocationOfReactivation",
Decomposition = "Decomposition"
Decomposition = "Decomposition",
DecompositionDueToIdentityDeletion = "DecompositionDueToIdentityDeletion"
}

0 comments on commit 04cc4a0

Please sign in to comment.