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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user