diff --git a/client/src/api/schema/schema.ts b/client/src/api/schema/schema.ts index 8786ebbb1e4e..fa83e184e896 100644 --- a/client/src/api/schema/schema.ts +++ b/client/src/api/schema/schema.ts @@ -5394,40 +5394,6 @@ export interface components { /** Tags */ tags?: string[] | null; }; - /** GenericNotificationCreateRequest[Annotated[int, BeforeValidator, BeforeValidator, PlainSerializer, WithJsonSchema, WithJsonSchema]] */ - GenericNotificationCreateRequest_Annotated_int__BeforeValidator__BeforeValidator__PlainSerializer__WithJsonSchema__WithJsonSchema__: { - /** - * Notification - * @description The notification to create. The structure depends on the category. - */ - notification: components["schemas"]["NotificationCreateData"]; - /** - * Recipients - * @description The recipients of the notification. Can be a combination of users, groups and roles. - */ - recipients: components["schemas"]["GenericNotificationRecipients_Annotated_int__BeforeValidator__BeforeValidator__PlainSerializer__WithJsonSchema__WithJsonSchema__"]; - }; - /** GenericNotificationRecipients[Annotated[int, BeforeValidator, BeforeValidator, PlainSerializer, WithJsonSchema, WithJsonSchema]] */ - GenericNotificationRecipients_Annotated_int__BeforeValidator__BeforeValidator__PlainSerializer__WithJsonSchema__WithJsonSchema__: { - /** - * Group IDs - * @description The list of encoded group IDs of the groups that should receive the notification. - * @default [] - */ - group_ids?: string[]; - /** - * Role IDs - * @description The list of encoded role IDs of the roles that should receive the notification. - * @default [] - */ - role_ids?: string[]; - /** - * User IDs - * @description The list of encoded user IDs of the users that should receive the notification. - * @default [] - */ - user_ids?: string[]; - }; /** * GroupCreatePayload * @description Payload schema for creating a group. @@ -9673,7 +9639,14 @@ export interface components { variant: components["schemas"]["NotificationVariant"]; }; /** NotificationCreateRequestBody */ - NotificationCreateRequestBody: components["schemas"]["GenericNotificationCreateRequest_Annotated_int__BeforeValidator__BeforeValidator__PlainSerializer__WithJsonSchema__WithJsonSchema__"]; + NotificationCreateRequestBody: { + /** + * Notification + * @description The notification to create. The structure depends on the category. + */ + notification: components["schemas"]["NotificationCreateData"]; + recipients: components["schemas"]["NotificationRecipientsPayload"]; + }; /** NotificationCreatedResponse */ NotificationCreatedResponse: { /** @@ -9687,6 +9660,27 @@ export interface components { */ total_notifications_sent: number; }; + /** NotificationRecipientsPayload */ + NotificationRecipientsPayload: { + /** + * Group IDs + * @description The list of encoded group IDs of the groups that should receive the notification. + * @default [] + */ + group_ids?: string[]; + /** + * Role IDs + * @description The list of encoded role IDs of the roles that should receive the notification. + * @default [] + */ + role_ids?: string[]; + /** + * User IDs + * @description The list of encoded user IDs of the users that should receive the notification. + * @default [] + */ + user_ids?: string[]; + }; /** * NotificationResponse * @description Basic common fields for all notification responses. diff --git a/lib/galaxy/schema/notifications.py b/lib/galaxy/schema/notifications.py index f78bc0954480..cb62d4ac92cb 100644 --- a/lib/galaxy/schema/notifications.py +++ b/lib/galaxy/schema/notifications.py @@ -303,8 +303,12 @@ class GenericNotificationCreateRequest(Model, Generic[DatabaseIdT]): NotificationRecipients = GenericNotificationRecipients[int] -class NotificationCreateRequestBody(RootModel): - root: GenericNotificationCreateRequest[DecodedDatabaseIdField] +class NotificationRecipientsPayload(GenericNotificationRecipients[DecodedDatabaseIdField]): + pass + + +class NotificationCreateRequestBody(GenericNotificationCreateRequest[DecodedDatabaseIdField]): + recipients: NotificationRecipientsPayload class BroadcastNotificationCreateRequest(NotificationCreateData): diff --git a/lib/galaxy/webapps/galaxy/services/notifications.py b/lib/galaxy/webapps/galaxy/services/notifications.py index 70d35c92ed4a..f0abdba6eef7 100644 --- a/lib/galaxy/webapps/galaxy/services/notifications.py +++ b/lib/galaxy/webapps/galaxy/services/notifications.py @@ -57,8 +57,8 @@ def send_notification( self.notification_manager.ensure_notifications_enabled() self._ensure_user_can_send_notifications(sender_context) request = NotificationCreateRequest.model_construct( - notification=payload.root.notification, - recipients=payload.root.recipients, + notification=payload.notification, + recipients=payload.recipients, ) return self.send_notification_internal(request)