mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
* Add UI support for setting containing groups * Show containing groups in group details panel * Move tag hierarchical filter code into separate type * Add depth to scene_count and add sub_group_count * Add sub-groups tab to groups page * Add containing groups to edit groups dialog * Show containing group description in sub-group view * Show group scene number in group scenes view * Add ability to drag move grid cards * Add sub group order option * Add reorder sub-groups interface * Separate page size selector component * Add interfaces to add and remove sub-groups to a group * Separate MultiSet components * Allow setting description while setting containing groups
33 lines
732 B
Go
33 lines
732 B
Go
package group
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
)
|
|
|
|
var ErrInvalidInsertIndex = errors.New("invalid insert index")
|
|
|
|
func (s *Service) ReorderSubGroups(ctx context.Context, groupID int, subGroupIDs []int, insertPointID int, insertAfter bool) error {
|
|
// get the group
|
|
existing, err := s.Repository.Find(ctx, groupID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// ensure it exists
|
|
if existing == nil {
|
|
return models.ErrNotFound
|
|
}
|
|
|
|
// TODO - ensure the subgroups exist in the group
|
|
|
|
// ensure the insert index is valid
|
|
if insertPointID < 0 {
|
|
return ErrInvalidInsertIndex
|
|
}
|
|
|
|
// reorder the subgroups
|
|
return s.Repository.ReorderSubGroups(ctx, groupID, subGroupIDs, insertPointID, insertAfter)
|
|
}
|