Skip to content

Commit

Permalink
feat: move events to BuildingBlocks & fix up the issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HunorTotBagi committed Feb 11, 2025
1 parent ec138f3 commit 5f80c6f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
</ItemGroup>

<ItemGroup>
<Folder Include="Notes\Note\Events\" />
<Folder Include="Notes\Note\ValueObjects\" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using BuildingBlocks.Domain.Abstractions;
using BuildingBlocks.Domain.ValueObjects.Ids;

namespace BuildingBlocks.Domain.Notes.Note.Events
{
public record NoteCreatedEvent(NoteId NoteId) : IDomainEvent;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using BuildingBlocks.Domain.Abstractions;
using BuildingBlocks.Domain.ValueObjects.Ids;

namespace BuildingBlocks.Domain.Notes.Note.Events;

public record NoteUpdatedEvent(NoteId NoteId) : IDomainEvent;

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions Backend/src/Modules/Notes/Notes.Domain/Models/Note.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Notes.Domain.Events;
using BuildingBlocks.Domain.Notes.Note.Events;

namespace Notes.Domain.Models;

Expand All @@ -23,7 +23,7 @@ public static Note Create(NoteId id, string title, string content,
Importance = importance
};

note.AddDomainEvent(new NoteCreatedEvent(note));
note.AddDomainEvent(new NoteCreatedEvent(note.Id));

return note;
}
Expand All @@ -36,7 +36,7 @@ public void Update(string title, string content, DateTime timestamp,
Timestamp = timestamp;
Importance = importance;

AddDomainEvent(new NoteUpdatedEvent(this));
AddDomainEvent(new NoteUpdatedEvent(Id));
}

#endregion
Expand Down

0 comments on commit 5f80c6f

Please sign in to comment.