refactor(db): Store thread body in the posts table
This is a simplification over the previous approach. The OP of a thread is just a normal post like any other in this model, which allows some code simplifications (and future query convenience).
This commit is contained in:
parent
a90d1cc1a4
commit
8c30ef92f6
5 changed files with 36 additions and 23 deletions
|
|
@ -105,12 +105,16 @@ pub fn submit_thread(state: State<AppState>,
|
|||
|
||||
let new_thread = NewThread {
|
||||
title: input.0.title,
|
||||
body: input.0.body,
|
||||
author_name: author.name,
|
||||
author_email: author.email,
|
||||
};
|
||||
|
||||
state.db.send(CreateThread(new_thread))
|
||||
let msg = CreateThread {
|
||||
new_thread,
|
||||
body: input.0.body,
|
||||
};
|
||||
|
||||
state.db.send(msg)
|
||||
.from_err()
|
||||
.and_then(move |res| {
|
||||
let thread = res?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue