File tree Expand file tree Collapse file tree 7 files changed +40
-9
lines changed
Expand file tree Collapse file tree 7 files changed +40
-9
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,18 @@ public async Task<F10AppResponseModel> ExecuteAsync(
2424 CancellationToken ct
2525 )
2626 {
27+ if ( request . TodoTaskListId != 0 )
28+ {
29+ var doesListExtst = await _repository . Value . DoesTodoTaskListExistAsync (
30+ request . TodoTaskListId ,
31+ ct
32+ ) ;
33+ if ( ! doesListExtst )
34+ {
35+ return F10Constant . DefaultResponse . App . TODO_TASK_LIST_NOT_FOUND ;
36+ }
37+ }
38+
2739 var foundTodoTaskLists = await _repository . Value . GetTodoTaskListAsync (
2840 request . TodoTaskListId ,
2941 request . NumberOfRecord ,
Original file line number Diff line number Diff line change 1+ using F10 . Models ;
12using F10 . Presentation ;
23using Microsoft . AspNetCore . Http ;
34
@@ -19,7 +20,13 @@ public static class Query
1920
2021 public static class DefaultResponse
2122 {
22- public static class App { }
23+ public static class App
24+ {
25+ public static readonly F10AppResponseModel TODO_TASK_LIST_NOT_FOUND = new ( )
26+ {
27+ AppCode = AppCode . TODO_TASK_LIST_NOT_FOUND ,
28+ } ;
29+ }
2330
2431 public static class Http
2532 {
@@ -28,6 +35,12 @@ public static class Http
2835 AppCode = ( int ) AppCode . VALIDATION_FAILED ,
2936 HttpCode = StatusCodes . Status400BadRequest ,
3037 } ;
38+
39+ public static readonly F10Response TODO_TASK_LIST_NOT_FOUND = new ( )
40+ {
41+ AppCode = ( int ) AppCode . TODO_TASK_LIST_NOT_FOUND ,
42+ HttpCode = StatusCodes . Status404NotFound ,
43+ } ;
3144 }
3245 }
3346
@@ -36,5 +49,7 @@ public enum AppCode
3649 SUCCESS = 1 ,
3750
3851 VALIDATION_FAILED ,
52+
53+ TODO_TASK_LIST_NOT_FOUND ,
3954 }
4055}
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ public F10Repository(AppDbContext context)
1818 _appContext = context ;
1919 }
2020
21+ public Task < bool > DoesTodoTaskListExistAsync ( long listId , CancellationToken ct )
22+ {
23+ return _appContext . Set < TodoTaskListEntity > ( ) . AnyAsync ( entity => entity . Id == listId , ct ) ;
24+ }
25+
2126 public async Task < IEnumerable < F10TodoTaskListModel > > GetTodoTaskListAsync (
2227 long todoTaskListId ,
2328 int numberOfRecord ,
Original file line number Diff line number Diff line change @@ -12,4 +12,6 @@ Task<IEnumerable<F10TodoTaskListModel>> GetTodoTaskListAsync(
1212 int numberOfRecord ,
1313 CancellationToken ct
1414 ) ;
15+
16+ Task < bool > DoesTodoTaskListExistAsync ( long listId , CancellationToken ct ) ;
1517}
Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ private static void Init()
4242 } ,
4343 }
4444 ) ;
45+
46+ _httpResponseMapper . TryAdd (
47+ F10Constant . AppCode . TODO_TASK_LIST_NOT_FOUND ,
48+ ( appRequest , appResponse ) => F10Constant . DefaultResponse . Http . TODO_TASK_LIST_NOT_FOUND
49+ ) ;
4550 }
4651
4752 public static F10Response Get ( F10AppRequestModel appRequest , F10AppResponseModel appResponse )
Original file line number Diff line number Diff line change @@ -26,13 +26,11 @@ public static class App
2626 public static readonly F13AppResponseModel TASK_NOT_FOUND = new ( )
2727 {
2828 AppCode = AppCode . TASK_NOT_FOUND ,
29- Body = new ( ) { TodoTasks = [ ] , NextCursor = 0 } ,
3029 } ;
3130
3231 public static readonly F13AppResponseModel TODO_TASK_LIST_NOT_FOUND = new ( )
3332 {
3433 AppCode = AppCode . TODO_TASK_LIST_NOT_FOUND ,
35- Body = new ( ) { TodoTasks = [ ] , NextCursor = 0 } ,
3634 } ;
3735 }
3836
@@ -48,14 +46,12 @@ public static class Http
4846 {
4947 AppCode = ( int ) AppCode . TASK_NOT_FOUND ,
5048 HttpCode = StatusCodes . Status404NotFound ,
51- Body = new ( ) { TodoTasks = [ ] , NextCursor = 0 } ,
5249 } ;
5350
5451 public static readonly F13Response TODO_TASK_LIST_NOT_FOUND = new ( )
5552 {
5653 AppCode = ( int ) AppCode . TODO_TASK_LIST_NOT_FOUND ,
5754 HttpCode = StatusCodes . Status404NotFound ,
58- Body = new ( ) { TodoTasks = [ ] , NextCursor = 0 } ,
5955 } ;
6056 }
6157 }
Original file line number Diff line number Diff line change @@ -26,13 +26,11 @@ public static class App
2626 public static readonly F14AppResponseModel TASK_NOT_FOUND = new ( )
2727 {
2828 AppCode = AppCode . TASK_NOT_FOUND ,
29- Body = new ( ) { TodoTasks = [ ] , NextCursor = 0 } ,
3029 } ;
3130
3231 public static readonly F14AppResponseModel TODO_TASK_LIST_NOT_FOUND = new ( )
3332 {
3433 AppCode = AppCode . TODO_TASK_LIST_NOT_FOUND ,
35- Body = new ( ) { TodoTasks = [ ] , NextCursor = 0 } ,
3634 } ;
3735 }
3836
@@ -48,14 +46,12 @@ public static class Http
4846 {
4947 AppCode = ( int ) AppCode . TASK_NOT_FOUND ,
5048 HttpCode = StatusCodes . Status404NotFound ,
51- Body = new ( ) { TodoTasks = [ ] , NextCursor = 0 } ,
5249 } ;
5350
5451 public static readonly F14Response TODO_TASK_LIST_NOT_FOUND = new ( )
5552 {
5653 AppCode = ( int ) AppCode . TODO_TASK_LIST_NOT_FOUND ,
5754 HttpCode = StatusCodes . Status404NotFound ,
58- Body = new ( ) { TodoTasks = [ ] , NextCursor = 0 } ,
5955 } ;
6056 }
6157 }
You can’t perform that action at this time.
0 commit comments