mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-04 10:12:47 +00:00
Fix query errors in Db::share_project
This commit is contained in:
parent
9902211af1
commit
0310e27347
2 changed files with 9 additions and 5 deletions
|
@ -1296,10 +1296,11 @@ where
|
||||||
SELECT projects.id, worktrees.root_name
|
SELECT projects.id, worktrees.root_name
|
||||||
FROM projects
|
FROM projects
|
||||||
LEFT JOIN worktrees ON projects.id = worktrees.project_id
|
LEFT JOIN worktrees ON projects.id = worktrees.project_id
|
||||||
WHERE room_id = $1 AND host_user_id = $2
|
WHERE room_id = $1 AND host_connection_id = $2
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.bind(room_id)
|
.bind(room_id)
|
||||||
|
.bind(participant.peer_id as i32)
|
||||||
.fetch(&mut *tx);
|
.fetch(&mut *tx);
|
||||||
|
|
||||||
let mut projects = HashMap::default();
|
let mut projects = HashMap::default();
|
||||||
|
@ -1341,14 +1342,14 @@ where
|
||||||
let mut tx = self.pool.begin().await?;
|
let mut tx = self.pool.begin().await?;
|
||||||
let project_id = sqlx::query_scalar(
|
let project_id = sqlx::query_scalar(
|
||||||
"
|
"
|
||||||
INSERT INTO projects (host_user_id, host_connection_id, room_id)
|
INSERT INTO projects (room_id, host_user_id, host_connection_id)
|
||||||
VALUES ($1, $2, $3)
|
VALUES ($1, $2, $3)
|
||||||
RETURNING id
|
RETURNING id
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
.bind(room_id)
|
||||||
.bind(user_id)
|
.bind(user_id)
|
||||||
.bind(connection_id.0 as i32)
|
.bind(connection_id.0 as i32)
|
||||||
.bind(room_id)
|
|
||||||
.fetch_one(&mut tx)
|
.fetch_one(&mut tx)
|
||||||
.await
|
.await
|
||||||
.map(ProjectId)?;
|
.map(ProjectId)?;
|
||||||
|
@ -1357,6 +1358,7 @@ where
|
||||||
sqlx::query(
|
sqlx::query(
|
||||||
"
|
"
|
||||||
INSERT INTO worktrees (id, project_id, root_name)
|
INSERT INTO worktrees (id, project_id, root_name)
|
||||||
|
VALUES ($1, $2, $3)
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.bind(worktree.id as i32)
|
.bind(worktree.id as i32)
|
||||||
|
@ -1387,6 +1389,7 @@ where
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let room = self.commit_room_transaction(room_id, tx).await?;
|
let room = self.commit_room_transaction(room_id, tx).await?;
|
||||||
|
dbg!(&room);
|
||||||
Ok((project_id, room))
|
Ok((project_id, room))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -849,7 +849,8 @@ impl Server {
|
||||||
RoomId::from_proto(request.payload.room_id),
|
RoomId::from_proto(request.payload.room_id),
|
||||||
&request.payload.worktrees,
|
&request.payload.worktrees,
|
||||||
)
|
)
|
||||||
.await?;
|
.await
|
||||||
|
.unwrap();
|
||||||
response.send(proto::ShareProjectResponse {
|
response.send(proto::ShareProjectResponse {
|
||||||
project_id: project_id.to_proto(),
|
project_id: project_id.to_proto(),
|
||||||
})?;
|
})?;
|
||||||
|
|
Loading…
Reference in a new issue