import { AggregateRoot } from "@nestjs/cqrs" ; import { MediaCreatedEvent } from "../events/impl/media-created.event" ; import { MediaUpdatedEvent } from "../events/impl/media-updated.event" ; import { UpdateMediaDto } from "../dto/update-media.dto" ; import { CreateMediaDto } from "../dto/create-media.dto" ; import { UpdateMediaCreatorDto } from "../dto/update-media-creator.dto" ; export class Media extends AggregateRoot { constructor ( public readonly id ) { super ( ) ; } createMedia ( createMediaDto ) { this . apply ( new MediaCreatedEvent ( this . id , createMediaDto ) ) ; } updateMedia ( updateMediaDto ) { this . apply ( new MediaUpdatedEvent ( this . id , updateMediaDto ) ) ; } updateMediaCreator ( updateMediaCreatorDto ) { this . apply ( new MediaUpdatedEvent ( this . id , updateMediaCreatorDto ) ) ; } }