(#22957) Pulled up the transaction to cover the v2 resources count query

Current v2/resource queries that include a count fail. The count query doesn't have a database connection.  Pulling up the with-transacted-connection similar to v3/resources.clj fixes this.