import type { Colony } from '../../generated/prisma'; import type { AnyNewDomainEvent } from '../domain-events/domain-event-types'; /** * The ColonyCreated event of a colony that was just written (create, split * child, CSV import). The caller records it in the transaction that wrote the * colony. Backup restore deliberately records none. */ export function colonyCreatedEvent( colony: Pick, actorUserId: string, ): AnyNewDomainEvent<'ColonyCreated'> { return { type: 'ColonyCreated', aggregateType: 'Colony', aggregateId: colony.id, actorUserId, payload: { apiaryId: colony.apiaryId }, }; }