File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
Core/Application/Services
Infrastructure.WebApi/Controllers/v1 Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -24,5 +24,6 @@ public interface INoteTaker
2424 CategoryDto TakeCategorizedNote ( Guid categoryId , NewNoteMessage newNoteMessage ) ;
2525 CategoryDto RemoveCategorizedNote ( Guid categoryId , Guid noteId ) ;
2626 IList < NoteDto > ListCategorizedNotes ( Guid categoryId ) ;
27+ NoteDto ReadCategorizedNote ( Guid categoryId , Guid noteId ) ;
2728 }
2829}
Original file line number Diff line number Diff line change @@ -177,6 +177,13 @@ public IList<NoteDto> ListCategorizedNotes(Guid categoryId)
177177 return _mapper . Map < IList < NoteDto > > ( category . Notes ) ;
178178 }
179179
180+ public NoteDto ReadCategorizedNote ( Guid categoryId , Guid noteId )
181+ {
182+ var category = GetCategory ( categoryId ) ;
183+ var note = category . RevealNote ( noteId ) ;
184+ return _mapper . Map < NoteDto > ( note ) ;
185+ }
186+
180187 private ICategory GetDefaultCategory ( )
181188 {
182189 var defaultCategoryName = "default" ;
Original file line number Diff line number Diff line change @@ -113,5 +113,22 @@ public IActionResult GetNotesFromCategory(Guid id)
113113 var noteDtos = _noteTaker . ListCategorizedNotes ( id ) ;
114114 return Ok ( noteDtos ) ;
115115 }
116+
117+ /// <summary>
118+ /// Get all notes from the given category
119+ /// </summary>
120+ /// <param name="id">Category Identifier.</param>
121+ /// <param name="noteId">Note Identifier.</param>
122+ /// <response code="200">Note found and returned</response>
123+ // GET api/v1/categories/{id}/notes/{id}
124+
125+ [ HttpGet , Route ( "{id:guid}/notes/{noteId:guid}" ) ]
126+ [ ProducesResponseType ( typeof ( NoteDto ) , 200 ) ]
127+ [ ProducesResponseType ( typeof ( BadRequestResult ) , 400 ) ]
128+ public IActionResult GetNoteFromCategory ( Guid id , Guid noteId )
129+ {
130+ var noteDto = _noteTaker . ReadCategorizedNote ( id , noteId ) ;
131+ return Ok ( noteDto ) ;
132+ }
116133 }
117134}
You can’t perform that action at this time.
0 commit comments