@@ -367,34 +367,14 @@ async fn delete_group(
367
367
368
368
let conn = & mut db_pool. get ( ) . await ?;
369
369
370
- conn. transaction ( |conn| {
371
- Box :: pin ( async move {
372
- // Check that the group exists
373
- let work_schedule_group =
374
- WorkScheduleGroup :: retrieve_or_fail ( & mut conn. clone ( ) , group_id, || {
375
- WorkScheduleError :: WorkScheduleGroupNotFound { id : group_id }
376
- } )
377
- . await ?;
378
-
379
- // List work schedules to be deleted
380
- let selection_setting = SelectionSettings :: new ( )
381
- . filter ( move || WorkSchedule :: WORK_SCHEDULE_GROUP_ID . eq ( group_id) ) ;
382
- let work_schedule_ids = WorkSchedule :: list ( & mut conn. clone ( ) , selection_setting)
383
- . await ?
384
- . into_iter ( )
385
- . map ( |work_schedule| work_schedule. id ) ;
386
-
387
- // Delete them
388
- let conn = & mut db_pool. get ( ) . await ?;
389
- WorkSchedule :: delete_batch ( conn, work_schedule_ids) . await ?;
390
-
391
- // Delete the group itself
392
- WorkScheduleGroup :: delete ( & work_schedule_group, conn) . await ?;
393
-
394
- Ok ( axum:: http:: StatusCode :: NO_CONTENT )
370
+ let work_schedule_group =
371
+ WorkScheduleGroup :: retrieve_or_fail ( & mut conn. clone ( ) , group_id, || {
372
+ WorkScheduleError :: WorkScheduleGroupNotFound { id : group_id }
395
373
} )
396
- } )
397
- . await
374
+ . await ?;
375
+ WorkScheduleGroup :: delete ( & work_schedule_group, conn) . await ?;
376
+
377
+ Ok ( axum:: http:: StatusCode :: NO_CONTENT )
398
378
}
399
379
400
380
#[ utoipa:: path(
@@ -518,8 +498,7 @@ async fn get_group(
518
498
519
499
let ordering = ordering_params. ordering ;
520
500
let settings = pagination_params
521
- . validate ( 1000 ) ?
522
- . warn_page_size ( 100 )
501
+ . validate ( 100 ) ?
523
502
. into_selection_settings ( )
524
503
. filter ( move || WorkSchedule :: WORK_SCHEDULE_GROUP_ID . eq ( group_id) )
525
504
. order_by ( move || ordering. as_work_schedule_ordering ( ) ) ;
0 commit comments