@@ -46,12 +46,12 @@ pub trait CompanyServiceApi: Send + Sync {
4646 async fn create_company (
4747 & self ,
4848 name : String ,
49- country_of_registration : String ,
50- city_of_registration : String ,
49+ country_of_registration : Option < String > ,
50+ city_of_registration : Option < String > ,
5151 postal_address : PostalAddress ,
5252 email : String ,
53- registration_number : String ,
54- registration_date : String ,
53+ registration_number : Option < String > ,
54+ registration_date : Option < String > ,
5555 proof_of_registration_file_upload_id : Option < String > ,
5656 logo_file_upload_id : Option < String > ,
5757 timestamp : u64 ,
@@ -209,12 +209,12 @@ impl CompanyServiceApi for CompanyService {
209209 async fn create_company (
210210 & self ,
211211 name : String ,
212- country_of_registration : String ,
213- city_of_registration : String ,
212+ country_of_registration : Option < String > ,
213+ city_of_registration : Option < String > ,
214214 postal_address : PostalAddress ,
215215 email : String ,
216- registration_number : String ,
217- registration_date : String ,
216+ registration_number : Option < String > ,
217+ registration_date : Option < String > ,
218218 proof_of_registration_file_upload_id : Option < String > ,
219219 logo_file_upload_id : Option < String > ,
220220 timestamp : u64 ,
@@ -385,7 +385,10 @@ impl CompanyServiceApi for CompanyService {
385385 & full_identity. key_pair . get_public_key ( ) ,
386386 )
387387 . 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+ }
389392
390393 self . store . update ( id, & company) . await ?;
391394
@@ -603,13 +606,13 @@ impl CompanyServiceApi for CompanyService {
603606pub struct CompanyToReturn {
604607 pub id : String ,
605608 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 > ,
608611 #[ serde( flatten) ]
609612 pub postal_address : PostalAddress ,
610613 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 > ,
613616 pub proof_of_registration_file : Option < File > ,
614617 pub logo_file : Option < File > ,
615618 pub signatories : Vec < String > ,
@@ -637,12 +640,12 @@ impl CompanyToReturn {
637640pub struct Company {
638641 pub id : String ,
639642 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 > ,
642645 pub postal_address : PostalAddress ,
643646 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 > ,
646649 pub proof_of_registration_file : Option < File > ,
647650 pub logo_file : Option < File > ,
648651 pub signatories : Vec < String > ,
@@ -717,12 +720,12 @@ pub mod tests {
717720 Company {
718721 id : TEST_PUB_KEY_SECP . to_owned ( ) ,
719722 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 ( ) ) ,
722725 postal_address : PostalAddress :: new_empty ( ) ,
723726 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 ( ) ) ,
726729 proof_of_registration_file : None ,
727730 logo_file : None ,
728731 signatories : vec ! [ TEST_PUB_KEY_SECP . to_string( ) ] ,
@@ -955,12 +958,12 @@ pub mod tests {
955958 let res = service
956959 . create_company (
957960 "name" . to_string ( ) ,
958- "AT" . to_string ( ) ,
959- "Vienna" . to_string ( ) ,
961+ Some ( "AT" . to_string ( ) ) ,
962+ Some ( "Vienna" . to_string ( ) ) ,
960963 PostalAddress :: new_empty ( ) ,
961964962- "some_number" . to_string ( ) ,
963- "2012-01-01" . to_string ( ) ,
965+ Some ( "some_number" . to_string ( ) ) ,
966+ Some ( "2012-01-01" . to_string ( ) ) ,
964967 Some ( "some_file_id" . to_string ( ) ) ,
965968 Some ( "some_other_file_id" . to_string ( ) ) ,
966969 1731593928 ,
@@ -1019,12 +1022,12 @@ pub mod tests {
10191022 let res = service
10201023 . create_company (
10211024 "name" . to_string ( ) ,
1022- "AT" . to_string ( ) ,
1023- "Vienna" . to_string ( ) ,
1025+ Some ( "AT" . to_string ( ) ) ,
1026+ Some ( "Vienna" . to_string ( ) ) ,
10241027 PostalAddress :: new_empty ( ) ,
102510281026- "some_number" . to_string ( ) ,
1027- "2012-01-01" . to_string ( ) ,
1029+ Some ( "some_number" . to_string ( ) ) ,
1030+ Some ( "2012-01-01" . to_string ( ) ) ,
10281031 None ,
10291032 None ,
10301033 1731593928 ,
0 commit comments