File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed
fplus-http-server/src/router
fplus-lib/src/core/allocator Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -37,20 +37,24 @@ pub async fn create_from_json(file: web::Json<ChangedAllocator>) -> actix_web::R
37
37
38
38
match process_allocator_file ( file_name) . await {
39
39
Ok ( model) => {
40
- if model. multisig_address . is_empty ( ) {
40
+ if model. pathway_addresses . msig . is_empty ( ) {
41
41
return Ok ( HttpResponse :: BadRequest ( ) . body ( "Missing or invalid multisig_address" ) ) ;
42
42
}
43
43
let verifiers_gh_handles = if model. application . verifiers_gh_handles . is_empty ( ) {
44
44
None
45
45
} else {
46
46
Some ( model. application . verifiers_gh_handles . join ( ", " ) ) // Join verifiers in a string if exists
47
47
} ;
48
-
48
+
49
+ let owner_repo_parts: Vec < & str > = model. application . allocation_bookkeeping . split ( '/' ) . collect ( ) ;
50
+ let owner = parts[ 3 ] ;
51
+ let repo = parts[ 4 ] ;
52
+
49
53
let allocator_model = match allocators_db:: create_or_update_allocator (
50
- model . owner . clone ( ) ,
51
- model . repo . clone ( ) ,
54
+ owner. to_string ( ) ,
55
+ owner . to_string ( ) ,
52
56
None ,
53
- Some ( model. multisig_address ) ,
57
+ Some ( model. pathway_addresses . msig ) ,
54
58
verifiers_gh_handles,
55
59
model. multisig_threshold
56
60
) . await {
Original file line number Diff line number Diff line change @@ -2,21 +2,22 @@ use serde::{Serialize, Deserialize};
2
2
3
3
#[ derive( Serialize , Deserialize , Debug ) ]
4
4
pub struct AllocatorModel {
5
- #[ serde( rename = "slug" ) ]
6
- pub repo : String ,
7
- #[ serde( rename = "organization" ) ]
8
- pub owner : String ,
9
- #[ serde( rename = "address" ) ]
10
- pub multisig_address : String ,
11
5
pub application : Application ,
12
6
#[ serde( rename = "multisig_threshold" ) ]
13
7
pub multisig_threshold : Option < i32 > ,
8
+ pub pathway_addresses : AllocatorModelPathwayAddresses
9
+ }
10
+
11
+ #[ derive( Serialize , Deserialize , Debug ) ]
12
+ pub struct AllocatorModelPathwayAddresses {
13
+ pub msig : String ,
14
14
}
15
15
16
16
#[ derive( Serialize , Deserialize , Debug ) ]
17
17
pub struct Application {
18
18
#[ serde( rename = "github_handles" ) ]
19
- pub verifiers_gh_handles : Vec < String >
19
+ pub verifiers_gh_handles : Vec < String > ,
20
+ pub allocation_bookkeeping : String ,
20
21
}
21
22
22
23
#[ derive( Debug , Serialize , Deserialize ) ]
You can’t perform that action at this time.
0 commit comments