Skip to content

Commit

Permalink
fix(integration): fixed typo in DataTransferObject & added json patch
Browse files Browse the repository at this point in the history
  • Loading branch information
JBBianchi committed Nov 29, 2023
1 parent e23ff8e commit a36c8a7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ModelConstructor } from '@neuroglia/common';
/**
* Represents the base class of all Data Transfer Objects (DTOs)
*/
export abstract class DataTransfertObject extends ModelConstructor {
export abstract class DataTransferObject extends ModelConstructor {
constructor(model?: any) {
super(model);
}
Expand Down
4 changes: 2 additions & 2 deletions projects/neuroglia/integration/src/lib/entity-dto.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DataTransfertObject } from './data-transfer-object';
import { DataTransferObject } from './data-transfer-object';

/**
* Represents the base class for Data Transfer Objects used to describe an entity
*/
export class EntityDataTransferObject<T = string> extends DataTransfertObject {
export class EntityDataTransferObject<T = string> extends DataTransferObject {
constructor(model?: any) {
super(model);
}
Expand Down
2 changes: 2 additions & 0 deletions projects/neuroglia/integration/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export * from './command-dto';
export * from './aggregate-state-dto';
export * from './integration-event.interface';
export * from './integration-event';
export * from './patch-operation';
export * from './json-patch';
4 changes: 2 additions & 2 deletions projects/neuroglia/integration/src/lib/integration-event.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DataTransfertObject } from './data-transfer-object';
import { DataTransferObject } from './data-transfer-object';
import { IIntegrationEvent } from './integration-event.interface';

/**
* Represents the base class for all integration events
*/
export class IntergrationEvent<T = string> extends DataTransfertObject implements IIntegrationEvent<T> {
export class IntergrationEvent<T = string> extends DataTransferObject implements IIntegrationEvent<T> {
constructor(model?: any) {
super(model);
}
Expand Down
14 changes: 14 additions & 0 deletions projects/neuroglia/integration/src/lib/json-patch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ModelConstructor } from '@neuroglia/common';
import { PatchOperation } from './patch-operation';

/**
* Models a JSON Patch document.
*/
export class JsonPatch extends ModelConstructor {
constructor(model?: any) {
super(model);
this.operations = (model?.operations || []).map((operation: PatchOperation) => new PatchOperation(operation));
}
/** The collection of operations. */
operations: PatchOperation[];
}
18 changes: 18 additions & 0 deletions projects/neuroglia/integration/src/lib/patch-operation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ModelConstructor } from '@neuroglia/common';

/**
* Represents a single JSON Patch operation.
*/
export class PatchOperation extends ModelConstructor {
constructor(model?: any) {
super(model);
}
/** The operation type */
op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
/** The source path */
from: string;
/** The target path */
path: string;
/** The value */
value: any;
}

0 comments on commit a36c8a7

Please sign in to comment.