@kerthin/domain
Version:
Kerthin Domain (based on DDD)
29 lines (21 loc) • 733 B
text/typescript
import { AggregateRoot, Aggregate, ValueObjectProp, UniqueEntityID } from '../../lib';
import { Name } from './name.value-object';
import { Info } from './info.value-object';
import { ExampleEntity } from './example.entity';
export class ExampleAggregate2 extends AggregateRoot {
name: Name;
info: Array<Info>;
example: ExampleEntity;
example2: Array<ExampleEntity>;
static create(data: any, ownId?: string): ExampleAggregate2 {
return new ExampleAggregate2(data, ownId && new UniqueEntityID(ownId));
}
update<T>(data: T) {
this.setValueObjects(data);
}
}