@@ -19,7 +19,6 @@ pub struct Here {
1919}
2020
2121
22- /// Input to the create channel call
2322#[ derive( Debug , Serialize , Deserialize , SerializedBytes ) ]
2423#[ serde( rename_all = "camelCase" ) ]
2524pub struct AddHereInput {
@@ -29,6 +28,14 @@ pub struct AddHereInput {
2928 pub meta : BTreeMap < String , String > ,
3029}
3130
31+ /// Input to update a Here
32+ #[ derive( Debug , Serialize , Deserialize , SerializedBytes ) ]
33+ #[ serde( rename_all = "camelCase" ) ]
34+ pub struct UpdateHereInput {
35+ old_here_hh : HeaderHashB64 ,
36+ new_here : AddHereInput ,
37+ }
38+
3239#[ hdk_extern]
3340fn add_here ( input : AddHereInput ) -> ExternResult < HeaderHashB64 > {
3441 // Find session
@@ -46,6 +53,12 @@ fn add_here(input: AddHereInput) -> ExternResult<HeaderHashB64> {
4653 Ok ( link_hh. into ( ) )
4754}
4855
56+ #[ hdk_extern]
57+ fn update_here ( input : UpdateHereInput ) -> ExternResult < HeaderHashB64 > {
58+ delete_here ( input. old_here_hh ) ?;
59+ add_here ( input. new_here )
60+ }
61+
4962#[ hdk_extern]
5063fn delete_here ( link_hh : HeaderHashB64 ) -> ExternResult < ( ) > {
5164 delete_link ( link_hh. into ( ) ) ?;
0 commit comments