Skip to content

Conversation

@codeconsole
Copy link
Contributor

@codeconsole codeconsole commented Sep 16, 2025

Slowing migrating this to how it was intended.

Services are kind of useless if they can't filter/query.

GormService was originally modeled afterRestfulController<T>, but that wasn't really necessary.

This is another step that migrates towards making the scaffold service more useful

My final version of GormService allows querying by params and counting by params. Currently I am using this as a base class that I extend with a more meaningful implementation.

Allows this

@Scaffold(domain = User)
class UserService {
    List<User> list(Map args) {
        args.firstName? User.findAllByFirstName(args.firstName, args) : User.list(args)
    }

    Long count(Map args) {
        args.firstName? User.countByFirstName(args.firstName) : User.count()
    }
} 

@Scaffold(RestfulServiceController<User>)
class UserController {}

now works and is properly paginated:
http://localhost:8080/user/index?firstName=scott

@codeconsole codeconsole merged commit 4c0d3b6 into apache:7.0.x Sep 18, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants