@@ -46,12 +46,12 @@ pub trait CompanyServiceApi: Send + Sync {
46
46
async fn create_company (
47
47
& self ,
48
48
name : String ,
49
- country_of_registration : String ,
50
- city_of_registration : String ,
49
+ country_of_registration : Option < String > ,
50
+ city_of_registration : Option < String > ,
51
51
postal_address : PostalAddress ,
52
52
email : String ,
53
- registration_number : String ,
54
- registration_date : String ,
53
+ registration_number : Option < String > ,
54
+ registration_date : Option < String > ,
55
55
proof_of_registration_file_upload_id : Option < String > ,
56
56
logo_file_upload_id : Option < String > ,
57
57
timestamp : u64 ,
@@ -209,12 +209,12 @@ impl CompanyServiceApi for CompanyService {
209
209
async fn create_company (
210
210
& self ,
211
211
name : String ,
212
- country_of_registration : String ,
213
- city_of_registration : String ,
212
+ country_of_registration : Option < String > ,
213
+ city_of_registration : Option < String > ,
214
214
postal_address : PostalAddress ,
215
215
email : String ,
216
- registration_number : String ,
217
- registration_date : String ,
216
+ registration_number : Option < String > ,
217
+ registration_date : Option < String > ,
218
218
proof_of_registration_file_upload_id : Option < String > ,
219
219
logo_file_upload_id : Option < String > ,
220
220
timestamp : u64 ,
@@ -385,7 +385,10 @@ impl CompanyServiceApi for CompanyService {
385
385
& full_identity. key_pair . get_public_key ( ) ,
386
386
)
387
387
. await ?;
388
- company. logo_file = logo_file. clone ( ) ;
388
+ // only override the picture, if there is a new one
389
+ if logo_file. is_some ( ) {
390
+ company. logo_file = logo_file. clone ( ) ;
391
+ }
389
392
390
393
self . store . update ( id, & company) . await ?;
391
394
@@ -603,13 +606,13 @@ impl CompanyServiceApi for CompanyService {
603
606
pub struct CompanyToReturn {
604
607
pub id : String ,
605
608
pub name : String ,
606
- pub country_of_registration : String ,
607
- pub city_of_registration : String ,
609
+ pub country_of_registration : Option < String > ,
610
+ pub city_of_registration : Option < String > ,
608
611
#[ serde( flatten) ]
609
612
pub postal_address : PostalAddress ,
610
613
pub email : String ,
611
- pub registration_number : String ,
612
- pub registration_date : String ,
614
+ pub registration_number : Option < String > ,
615
+ pub registration_date : Option < String > ,
613
616
pub proof_of_registration_file : Option < File > ,
614
617
pub logo_file : Option < File > ,
615
618
pub signatories : Vec < String > ,
@@ -637,12 +640,12 @@ impl CompanyToReturn {
637
640
pub struct Company {
638
641
pub id : String ,
639
642
pub name : String ,
640
- pub country_of_registration : String ,
641
- pub city_of_registration : String ,
643
+ pub country_of_registration : Option < String > ,
644
+ pub city_of_registration : Option < String > ,
642
645
pub postal_address : PostalAddress ,
643
646
pub email : String ,
644
- pub registration_number : String ,
645
- pub registration_date : String ,
647
+ pub registration_number : Option < String > ,
648
+ pub registration_date : Option < String > ,
646
649
pub proof_of_registration_file : Option < File > ,
647
650
pub logo_file : Option < File > ,
648
651
pub signatories : Vec < String > ,
@@ -717,12 +720,12 @@ pub mod tests {
717
720
Company {
718
721
id : TEST_PUB_KEY_SECP . to_owned ( ) ,
719
722
name : "some_name" . to_string ( ) ,
720
- country_of_registration : "AT" . to_string ( ) ,
721
- city_of_registration : "Vienna" . to_string ( ) ,
723
+ country_of_registration : Some ( "AT" . to_string ( ) ) ,
724
+ city_of_registration : Some ( "Vienna" . to_string ( ) ) ,
722
725
postal_address : PostalAddress :: new_empty ( ) ,
723
726
email : "[email protected] " . to_string ( ) ,
724
- registration_number : "some_number" . to_string ( ) ,
725
- registration_date : "2012-01-01" . to_string ( ) ,
727
+ registration_number : Some ( "some_number" . to_string ( ) ) ,
728
+ registration_date : Some ( "2012-01-01" . to_string ( ) ) ,
726
729
proof_of_registration_file : None ,
727
730
logo_file : None ,
728
731
signatories : vec ! [ TEST_PUB_KEY_SECP . to_string( ) ] ,
@@ -955,12 +958,12 @@ pub mod tests {
955
958
let res = service
956
959
. create_company (
957
960
"name" . to_string ( ) ,
958
- "AT" . to_string ( ) ,
959
- "Vienna" . to_string ( ) ,
961
+ Some ( "AT" . to_string ( ) ) ,
962
+ Some ( "Vienna" . to_string ( ) ) ,
960
963
PostalAddress :: new_empty ( ) ,
961
964
962
- "some_number" . to_string ( ) ,
963
- "2012-01-01" . to_string ( ) ,
965
+ Some ( "some_number" . to_string ( ) ) ,
966
+ Some ( "2012-01-01" . to_string ( ) ) ,
964
967
Some ( "some_file_id" . to_string ( ) ) ,
965
968
Some ( "some_other_file_id" . to_string ( ) ) ,
966
969
1731593928 ,
@@ -1019,12 +1022,12 @@ pub mod tests {
1019
1022
let res = service
1020
1023
. create_company (
1021
1024
"name" . to_string ( ) ,
1022
- "AT" . to_string ( ) ,
1023
- "Vienna" . to_string ( ) ,
1025
+ Some ( "AT" . to_string ( ) ) ,
1026
+ Some ( "Vienna" . to_string ( ) ) ,
1024
1027
PostalAddress :: new_empty ( ) ,
1025
1028
1026
- "some_number" . to_string ( ) ,
1027
- "2012-01-01" . to_string ( ) ,
1029
+ Some ( "some_number" . to_string ( ) ) ,
1030
+ Some ( "2012-01-01" . to_string ( ) ) ,
1028
1031
None ,
1029
1032
None ,
1030
1033
1731593928 ,
0 commit comments