max / makenotwork
| 1 | //! footnote inserts |
| 2 | |
| 3 | use ; |
| 4 | |
| 5 | /// Insert a footnote on a post. Returns the footnote ID. |
| 6 | |
| 7 | pub async |
| 8 | pool: &PgPool, |
| 9 | post_id: Uuid, |
| 10 | author_id: Uuid, |
| 11 | body_markdown: &str, |
| 12 | body_html: &str, |
| 13 | |
| 14 | query_scalar! |
| 15 | "INSERT INTO post_footnotes (post_id, author_id, body_markdown, body_html) |
| 16 | VALUES ($1, $2, $3, $4) |
| 17 | RETURNING id", |
| 18 | post_id, |
| 19 | author_id, |
| 20 | body_markdown, |
| 21 | body_html, |
| 22 | |
| 23 | .fetch_one |
| 24 | .await |
| 25 | |
| 26 |