@@ -438,6 +438,42 @@ impl DataStore {
438
438
}
439
439
}
440
440
441
+ /// Updates the user comment of a support bundle.
442
+ ///
443
+ /// Returns:
444
+ /// - "Ok" if the bundle was updated successfully.
445
+ /// - "Err::InvalidRequest" if the comment exceeds the maximum length.
446
+ pub async fn support_bundle_update_user_comment (
447
+ & self ,
448
+ opctx : & OpContext ,
449
+ authz_bundle : & authz:: SupportBundle ,
450
+ user_comment : Option < String > ,
451
+ ) -> Result < ( ) , Error > {
452
+ opctx. authorize ( authz:: Action :: Modify , authz_bundle) . await ?;
453
+
454
+ if let Some ( ref comment) = user_comment {
455
+ if comment. len ( ) > 4096 {
456
+ return Err ( Error :: invalid_request (
457
+ "User comment cannot exceed 4096 bytes" ,
458
+ ) ) ;
459
+ }
460
+ }
461
+
462
+ use nexus_db_schema:: schema:: support_bundle:: dsl;
463
+
464
+ let id = authz_bundle. id ( ) . into_untyped_uuid ( ) ;
465
+ let conn = self . pool_connection_authorized ( opctx) . await ?;
466
+ diesel:: update ( dsl:: support_bundle)
467
+ . filter ( dsl:: id. eq ( id) )
468
+ . set ( dsl:: user_comment. eq ( user_comment) )
469
+ . execute_async ( & * conn)
470
+ . await
471
+ . map ( |_rows_modified| ( ) )
472
+ . map_err ( |e| public_error_from_diesel ( e, ErrorHandler :: Server ) ) ?;
473
+
474
+ Ok ( ( ) )
475
+ }
476
+
441
477
/// Deletes a support bundle.
442
478
///
443
479
/// This should only be invoked after all storage for the support bundle has
0 commit comments