Active request page (#16)

Also:
- refactored snoozed and answered list pages to use a common list format
- reworked the URLs to make them more consistent
- eliminated current "full" API endpoint, and renamed existing "complete" endpoint to "full"
This commit is contained in:
Daniel J. Summers
2018-08-17 22:12:14 -05:00
parent d3aff4a110
commit e351fe5b56
16 changed files with 261 additions and 245 deletions

View File

@@ -267,7 +267,7 @@ type AppDbContext (opts : DbContextOptions<AppDbContext>) =
}
/// Retrieve a request, including its history and notes, by its ID and user ID
member this.TryCompleteRequestById requestId userId =
member this.TryFullRequestById requestId userId =
task {
match! this.TryJournalById requestId userId with
| Some req ->
@@ -281,18 +281,3 @@ type AppDbContext (opts : DbContextOptions<AppDbContext>) =
| None -> return None
| None -> return None
}
/// Retrieve a request, including its history, by its ID and user ID
member this.TryFullRequestById requestId userId =
task {
match! this.TryJournalById requestId userId with
| Some req ->
let! fullReq =
this.Requests.AsNoTracking()
.Include(fun r -> r.history)
.FirstOrDefaultAsync(fun r -> r.requestId = requestId && r.userId = userId)
match toOption fullReq with
| Some _ -> return Some { req with history = List.ofSeq fullReq.history }
| None -> return None
| None -> return None
}