Skip to content

Commit 9b2301f

Browse files
authored
feat: move mono ui model to ceres for reuse (#1545)
1 parent e81a7e7 commit 9b2301f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+605
-1983
lines changed

Cargo.toml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -36,83 +36,83 @@ neptune = { path = "neptune" }
3636
git-internal = "0.1.0"
3737

3838
#====
39-
anyhow = "1.0.98"
40-
serde = { version = "1.0.219", features = ["derive"] }
41-
serde_json = "1.0.140"
39+
anyhow = "1.0.100"
40+
serde = { version = "1.0.228", features = ["derive"] }
41+
serde_json = "1.0.145"
4242
tracing = "0.1.41"
43-
tracing-subscriber = "0.3.19"
43+
tracing-subscriber = "0.3.20"
4444
tracing-appender = "0.2.3"
45-
thiserror = "2.0.12"
46-
clap = "4.5.43"
45+
thiserror = "2.0.17"
46+
clap = "4.5.49"
4747

4848
#====
49-
tokio = "1.45.1"
49+
tokio = "1.48"
5050
tokio-stream = "0.1.17"
51-
tokio-util = "0.7.15"
52-
async-trait = "0.1.88"
51+
tokio-util = "0.7.16"
52+
async-trait = "0.1.89"
5353
async-stream = "0.3.6"
5454
futures = "0.3.31"
5555
futures-util = "0.3.31"
56-
axum = { version = "0.8.4", features = ["macros", "json"] }
57-
axum-extra = "0.10.1"
56+
axum = { version = "0.8.6", features = ["macros", "json"] }
57+
axum-extra = "0.10.3"
5858
russh = "0.52.1"
59-
tower-http = "0.6.4"
59+
tower-http = "0.6.6"
6060
tower = "0.5.2"
6161
time = { version = "0.3", features = ["serde"] }
6262

6363
#====
64-
sea-orm = "1.1.12"
65-
sea-orm-migration = "1.1.12"
64+
sea-orm = "1.1.17"
65+
sea-orm-migration = "1.1.17"
6666

6767
#====
6868
rand = "0.9.2"
6969
rand_chacha = "0.9.0"
70-
flate2 = "1.1.1"
70+
flate2 = "1.1.4"
7171
bstr = "1.12.0"
7272
smallvec = "1.15.1"
7373
bytes = "1.10.1"
74-
memchr = "2.7.4"
75-
chrono = { version = "0.4.41", features = ["serde"] }
74+
memchr = "2.7.6"
75+
chrono = { version = "0.4.42", features = ["serde"] }
7676
sha1 = "0.10.6"
7777
hex = "0.4.3"
7878

7979
go-defer = "0.1.0"
8080
colored = "3.0.0"
8181
idgenerator = "2.0.0"
8282
num_cpus = "1.17.0"
83-
config = "0.15.11"
84-
reqwest = "0.12.18"
83+
config = "0.15.18"
84+
reqwest = "0.12.24"
8585
lazy_static = "1.5.0"
86-
uuid = "1.17.0"
87-
regex = "1.11.1"
88-
ed25519-dalek = "2.1.1"
89-
ctrlc = "3.4.7"
86+
uuid = "1.18.1"
87+
regex = "1.12.2"
88+
ed25519-dalek = "2.2.0"
89+
ctrlc = "3.5.0"
9090
ring = "0.17.14"
91-
cedar-policy = "4.4.1"
91+
cedar-policy = "4.7.0"
9292
secp256k1 = "0.30.0"
9393
pgp = "0.15.0"
9494
openssl = "0.10.73"
9595
oauth2 = "5.0.0"
9696
base64 = "0.22.1"
9797
encoding_rs = "0.8.35"
98-
aws-config = "1.6.3"
99-
aws-sdk-s3 = "1.90.0"
100-
utoipa = { version = "5.3.1", features = ["chrono"] }
98+
aws-config = "1.8.8"
99+
aws-sdk-s3 = "1.108.0"
100+
utoipa = { version = "5.4.0", features = ["chrono"] }
101101
utoipa-axum = "0.2.0"
102102
utoipa-swagger-ui = "9.0.2"
103-
tempfile = "3.20.0"
103+
tempfile = "3.23.0"
104104
rdkafka = "0.38.0"
105105
threadpool = "1.8.1"
106106
lru-mem = "0.3.0"
107107
dashmap = "6.1.0"
108-
rayon = "1.10.0"
108+
rayon = "1.11.0"
109109
byteorder = "1.5.0"
110110
bincode = "2.0.1"
111111
once_cell = "1.21.3"
112112
testcontainers = "0.25.0"
113113
scopeguard = "1.2.0"
114114
serial_test = "3.2.0"
115-
sysinfo = "0.36.0"
115+
sysinfo = "0.36.1"
116116
http = "1.3.1"
117117
byte-unit = "5.1.6"
118118
ignore = "0.4.23"
@@ -122,13 +122,13 @@ path-absolutize = "3.1.1"
122122
pathdiff = "0.2.3"
123123
rpassword = "7.4.0"
124124
similar = "2.7.0"
125-
url = "2.5.4"
125+
url = "2.5.7"
126126
wax = "0.6.0"
127127
pager = "0.16.1"
128128
jemallocator = "0.5.4"
129-
mimalloc = "0.1.46"
129+
mimalloc = "0.1.48"
130130
assert_cmd = "2.0.17"
131-
tower-sessions = { version = "0.12.1", features = ["memory-store"] }
131+
tower-sessions = { version = "0.12.3", features = ["memory-store"] }
132132
dotenvy = "0.15.7"
133133
tokio-tungstenite = "0.27.0"
134134
tungstenite = "0.27.0"
@@ -138,17 +138,17 @@ bs58 = "0.5.1"
138138
syn = "2.0"
139139
quote = "1.0"
140140
proc-macro2 = "1.0"
141-
log = "0.4.27"
142-
env_logger = "0.11.7"
143-
qdrant-client = "1.7"
144-
walkdir = "2.4"
141+
log = "0.4.28"
142+
env_logger = "0.11.8"
143+
qdrant-client = "1.15"
144+
walkdir = "2.5"
145145
dagrs = "0.5.0"
146146
tar = "0.4"
147-
indexmap = "2.10.0"
147+
indexmap = "2.11.4"
148148
envsubst = "0.2.1"
149149
diffs = "0.5.1"
150-
libc = "0.2.172"
151-
zstd-sys = "2.0.15+zstd.1.5.7"
150+
libc = "0.2.177"
151+
zstd-sys = "2.0.16"
152152
quickcheck = "1.0.3"
153153
directories = "6.0.0"
154154
dotenv = "0.15"

ceres/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ sysinfo = { workspace = true }
3939
utoipa = { workspace = true }
4040
base64 = { workspace = true }
4141
http = { workspace = true }
42-
regex = "1.11.1"
42+
regex = { workspace = true }
4343
tokio-util = {workspace = true}
44+
uuid = { workspace = true, features = ["v4"] }
4445

4546
[dev-dependencies]
4647
tempfile = { workspace = true }

ceres/src/api_service/mono_api_service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use std::sync::Arc;
4242

4343
use crate::api_service::ApiHandler;
4444
use crate::model::blame::{BlameQuery, BlameResult};
45-
use crate::model::cl::ClDiffFile;
45+
use crate::model::change_list::ClDiffFile;
4646
use crate::model::git::CreateEntryInfo;
4747
use crate::model::third_party::{ThirdPartyClient, ThirdPartyRepoTrait};
4848
use crate::protocol::{SmartProtocol, TransportProtocol};
@@ -1418,7 +1418,7 @@ impl MonoApiService {
14181418
#[cfg(test)]
14191419
mod test {
14201420
use super::*;
1421-
use crate::model::cl::ClDiffFile;
1421+
use crate::model::change_list::ClDiffFile;
14221422
use git_internal::hash::SHA1;
14231423
use std::path::PathBuf;
14241424
use std::str::FromStr;

mono/src/api/cl/mod.rs renamed to ceres/src/model/change_list.rs

Lines changed: 113 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
1+
use std::path::PathBuf;
12
use std::str::FromStr;
23

3-
use ceres::{
4-
merge_checker::{CheckType, ConditionResult},
5-
model::cl::ClDiffFile,
6-
};
7-
use jupiter::model::cl_dto::CLDetails;
8-
use serde::Serialize;
4+
use serde::{Deserialize, Serialize};
95
use utoipa::ToSchema;
106
use uuid::Uuid;
117

12-
use crate::api::{conversation::ConversationItem, label::LabelItem};
138
use callisto::{check_result, sea_orm_active_enums::MergeStatusEnum};
149
use common::model::CommonPage;
10+
use git_internal::hash::SHA1;
11+
use jupiter::model::cl_dto::CLDetails;
12+
use jupiter::model::common::ListParams;
1513
use neptune::model::diff_model::DiffItem;
1614

17-
pub mod cl_router;
18-
mod model;
15+
use crate::merge_checker::{CheckType, ConditionResult};
16+
use crate::model::{conversation::ConversationItem, label::LabelItem};
17+
18+
#[derive(Deserialize, ToSchema)]
19+
pub struct AssigneeUpdatePayload {
20+
pub assignees: Vec<String>,
21+
pub item_id: i64,
22+
pub link: String,
23+
}
24+
25+
#[derive(Deserialize, ToSchema)]
26+
pub struct ListPayload {
27+
pub status: String,
28+
pub author: Option<String>,
29+
pub labels: Option<Vec<i64>>,
30+
pub assignees: Option<Vec<String>>,
31+
pub sort_by: Option<String>,
32+
pub asc: bool,
33+
}
34+
35+
impl From<ListPayload> for ListParams {
36+
fn from(value: ListPayload) -> Self {
37+
Self {
38+
status: value.status,
39+
author: value.author,
40+
labels: value.labels,
41+
assignees: value.assignees,
42+
sort_by: value.sort_by,
43+
asc: value.asc,
44+
}
45+
}
46+
}
1947

2048
#[derive(Serialize, ToSchema)]
2149
pub struct CLDetailRes {
@@ -62,22 +90,22 @@ pub struct FilesChangedPage {
6290
#[derive(Serialize, Debug, ToSchema)]
6391
pub struct MuiTreeNode {
6492
id: String,
65-
label: String,
93+
pub label: String,
6694
#[serde(skip_serializing_if = "Option::is_none")]
6795
#[schema(no_recursion)]
68-
children: Option<Vec<MuiTreeNode>>,
96+
pub children: Option<Vec<MuiTreeNode>>,
6997
}
7098

7199
impl MuiTreeNode {
72-
fn new(label: &str) -> Self {
100+
pub fn new(label: &str) -> Self {
73101
Self {
74102
id: Uuid::new_v4().to_string(),
75103
label: label.to_string(),
76104
children: None,
77105
}
78106
}
79107

80-
fn insert_path(&mut self, parts: &[&str]) {
108+
pub fn insert_path(&mut self, parts: &[&str]) {
81109
if parts.is_empty() {
82110
return;
83111
}
@@ -207,3 +235,75 @@ pub enum RequirementsState {
207235
UNMERGEABLE,
208236
MERGEABLE,
209237
}
238+
239+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
240+
#[allow(dead_code)]
241+
pub struct VerifyClPayload {
242+
pub assignees: Vec<String>,
243+
}
244+
245+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
246+
pub struct ReviewerPayload {
247+
pub reviewer_usernames: Vec<String>,
248+
}
249+
250+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
251+
pub struct ReviewersResponse {
252+
pub result: Vec<ReviewerInfo>,
253+
}
254+
255+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
256+
pub struct ChangeReviewerStatePayload {
257+
pub approved: bool,
258+
}
259+
260+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
261+
pub struct ChangeReviewStatePayload {
262+
pub conversation_id: i64,
263+
pub resolved: bool,
264+
}
265+
266+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
267+
pub struct ReviewerInfo {
268+
pub username: String,
269+
pub approved: bool,
270+
}
271+
272+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
273+
pub struct CloneRepoPayload {
274+
pub owner: String,
275+
pub repo: String,
276+
}
277+
278+
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
279+
pub enum ClDiffFile {
280+
New(PathBuf, SHA1),
281+
Deleted(PathBuf, SHA1),
282+
// path, old_hash, new_hash
283+
Modified(PathBuf, SHA1, SHA1),
284+
}
285+
286+
impl ClDiffFile {
287+
pub fn path(&self) -> &PathBuf {
288+
match self {
289+
ClDiffFile::New(path, _) => path,
290+
ClDiffFile::Deleted(path, _) => path,
291+
ClDiffFile::Modified(path, _, _) => path,
292+
}
293+
}
294+
295+
pub fn kind_weight(&self) -> u8 {
296+
match self {
297+
ClDiffFile::New(_, _) => 0,
298+
ClDiffFile::Deleted(_, _) => 1,
299+
ClDiffFile::Modified(_, _, _) => 2,
300+
}
301+
}
302+
}
303+
304+
#[derive(Serialize)]
305+
pub struct BuckFile {
306+
pub buck: SHA1,
307+
pub buck_config: SHA1,
308+
pub path: PathBuf,
309+
}

ceres/src/model/cl.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +0,0 @@
1-
use std::path::PathBuf;
2-
3-
use serde::{Deserialize, Serialize};
4-
5-
use git_internal::hash::SHA1;
6-
7-
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
8-
pub enum ClDiffFile {
9-
New(PathBuf, SHA1),
10-
Deleted(PathBuf, SHA1),
11-
// path, old_hash, new_hash
12-
Modified(PathBuf, SHA1, SHA1),
13-
}
14-
15-
impl ClDiffFile {
16-
pub fn path(&self) -> &PathBuf {
17-
match self {
18-
ClDiffFile::New(path, _) => path,
19-
ClDiffFile::Deleted(path, _) => path,
20-
ClDiffFile::Modified(path, _, _) => path,
21-
}
22-
}
23-
24-
pub fn kind_weight(&self) -> u8 {
25-
match self {
26-
ClDiffFile::New(_, _) => 0,
27-
ClDiffFile::Deleted(_, _) => 1,
28-
ClDiffFile::Modified(_, _, _) => 2,
29-
}
30-
}
31-
}
32-
33-
#[derive(Serialize)]
34-
pub struct BuckFile {
35-
pub buck: SHA1,
36-
pub buck_config: SHA1,
37-
pub path: PathBuf,
38-
}
File renamed without changes.

mono/src/api/conversation/mod.rs renamed to ceres/src/model/conversation.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use utoipa::ToSchema;
55

66
use callisto::{mega_conversation, reactions, sea_orm_active_enums::ConvTypeEnum};
77

8-
pub mod conv_router;
9-
108
#[derive(Serialize, ToSchema)]
119
pub struct ConversationItem {
1210
pub id: i64,

0 commit comments

Comments
 (0)