mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
create op table
This commit is contained in:
@ -4,7 +4,7 @@ use crate::{
|
||||
sqlx_ext::{map_sqlx_error, DBTransaction, SqlBuilder},
|
||||
};
|
||||
use anyhow::Context;
|
||||
use flowy_document::protobuf::{CreateDocParams, Doc, QueryDocParams, SaveDocParams};
|
||||
use flowy_document::protobuf::{CreateDocParams, Doc, QueryDocParams, UpdateDocParams};
|
||||
use flowy_net::{errors::ServerError, response::FlowyResponse};
|
||||
use sqlx::{postgres::PgArguments, PgPool, Postgres};
|
||||
use uuid::Uuid;
|
||||
@ -55,9 +55,9 @@ pub(crate) async fn read_doc(
|
||||
|
||||
pub(crate) async fn update_doc(
|
||||
pool: &PgPool,
|
||||
mut params: SaveDocParams,
|
||||
mut params: UpdateDocParams,
|
||||
) -> Result<FlowyResponse, ServerError> {
|
||||
let doc_id = Uuid::parse_str(¶ms.id)?;
|
||||
let doc_id = Uuid::parse_str(¶ms.doc_id)?;
|
||||
let mut transaction = pool
|
||||
.begin()
|
||||
.await
|
||||
|
@ -4,7 +4,7 @@ use actix_web::{
|
||||
};
|
||||
use sqlx::PgPool;
|
||||
|
||||
use flowy_document::protobuf::{QueryDocParams, SaveDocParams};
|
||||
use flowy_document::protobuf::{QueryDocParams, UpdateDocParams};
|
||||
use flowy_net::errors::ServerError;
|
||||
|
||||
use crate::service::{
|
||||
@ -25,7 +25,7 @@ pub async fn update_handler(
|
||||
payload: Payload,
|
||||
pool: Data<PgPool>,
|
||||
) -> Result<HttpResponse, ServerError> {
|
||||
let params: SaveDocParams = parse_from_payload(payload).await?;
|
||||
let params: UpdateDocParams = parse_from_payload(payload).await?;
|
||||
let response = update_doc(pool.get_ref(), params).await?;
|
||||
Ok(response.into())
|
||||
}
|
||||
|
Reference in New Issue
Block a user