Open
Conversation
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
neSpecc
reviewed
Apr 17, 2024
| * Listen to the note related events | ||
| */ | ||
| EventBus.getInstance().addEventListener(NOTE_ADDED_EVENT_NAME, async (event) => { | ||
| const { noteId, userId } = (event as CustomEvent<{ noteId: number; userId: number }>).detail; |
Member
There was a problem hiding this comment.
can we get rid of this casting? Maybe we can declare EventMap. Example:
https://github.com/codex-team/notes.web/blob/main/src/domain/event-bus/index.ts#L14-L29
Comment on lines
+15
to
+16
| super(NOTE_VISITED_EVENT_NAME, { detail: { noteId, | ||
| userId } }); |
Member
There was a problem hiding this comment.
bad line break
Suggested change
| super(NOTE_VISITED_EVENT_NAME, { detail: { noteId, | |
| userId } }); | |
| super(NOTE_VISITED_EVENT_NAME, { | |
| detail: { | |
| noteId, | |
| userId | |
| } | |
| }); |
| /** | ||
| * Note visited event | ||
| */ | ||
| export class NoteVisitedEvent extends CustomEvent<{ noteId: number; userId: number }> { |
Member
There was a problem hiding this comment.
Suggested change
| export class NoteVisitedEvent extends CustomEvent<{ noteId: number; userId: number }> { | |
| export class NoteVisitedEvent extends CustomEvent<{ noteId: Note['id']; userId: User['id'] }> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Working on event-bus, I tried to keep it in domain layer only and cover noteVisits and noteSettings.
But had to use noteSettings directly from presentation layer in getting the role of user to determine whether he can edit the note or not.
Other than that, it is fine.