Skip to content

Releases

6.3.0

Choose a tag to compare

@rogerio-costa-monkey rogerio-costa-monkey released this 21 Oct 11:35

What's Changed

Removal of the %

  • The % at the beginning of the filter for queries using LIKE has been removed.

  • Removal of operators: CONTAINS, ENDS_WITH, DOES_NOT_CONTAIN, DOES_NOT_END_WITH.

Maven

<dependency>
    <groupId>br.com.monkey.sdk</groupId>
    <artifactId>monkey-specification-search</artifactId>
    <version>6.3.0</version>
</dependency>

Full Changelog: 6.2.0...6.3.0

6.2.0

Choose a tag to compare

@FelipeAdorno FelipeAdorno released this 26 Sep 15:35

What's Changed

Required keys

@SearchParameter agora aceita required, que obriga a busca a filtrar pelas chaves informadas (com qualquer operador). Se faltar alguma chave, ou se o parâmetro search estiver ausente, a requisição retorna BadRequestException (Search parameter must filter by: <keys>).

@SearchParameter(required = InvoiceEntries_.EXTERNAL_ID) Specification<InvoiceEntries> search

Maven

<dependency>
    <groupId>br.com.monkey.sdk</groupId>
    <artifactId>monkey-specification-search</artifactId>
    <version>6.2.0</version>
</dependency>

Full Changelog: 6.1.0...6.2.0

6.1.0

Choose a tag to compare

@FelipeAdorno FelipeAdorno released this 24 Sep 14:04
9326c73

What's Changed

  • [SPPL-2086] - Made like and notLike searches case insensitive by @FKlahn in #21
  • [SUP-2969] Update Testcontainers MySQL dependency to 1.21.4 and MySQL image to 8.4.9 by @caiomerottimk in #22
  • COR-4223 - Corrigir problemas do Codacy no backend Java by @maestro-monkey in #24

New Contributors

Full Changelog: 6.0.0...6.1.0

4.1.0

Choose a tag to compare

@rogerio-costa-monkey rogerio-costa-monkey released this 19 Aug 18:16

The % at the beginning of the filter for queries using LIKE has been removed.

Removal of operators: CONTAINS, ENDS_WITH, DOES_NOT_CONTAIN, DOES_NOT_END_WITH.

6.0.0

Choose a tag to compare

@Braullio Braullio released this 02 Jun 18:16
6a9b69e

MonkeyJpaRepository

Using MonkeyJpaRepository, the findAll method with a Specification (using groupBy) and Pageable will return a Page<T> where getTotalElements() correctly reflects the number of grouped items.

To use this feature, follow the steps below:

1. Apply MonkeyJpaRepository in Repository

When creating the repository, extend from MonkeyJpaRepository instead of JpaRepository to ensure counting is performed correctly.

interface PayableRepository extends MonkeyJpaRepository<Payable, PayableId>, JpaSpecificationExecutor<Payable> {}

2. Add a @Import in MysqlIntegrationContainerConfiguration

This is necessary to ensure that, when running tests, the custom implementation is properly loaded.

@Import({ MonkeyJpaRepositoriesAutoConfiguration.class })

5..0.0

Choose a tag to compare

@FelipeAdorno FelipeAdorno released this 03 May 22:35

IN Operator

You can now use the IN operator with monkey-specification-search.

How to use:

?search=car.field4 IN ['foo','bar'] OR field IN [1,2]

4.0.0

Choose a tag to compare

@FelipeAdorno FelipeAdorno released this 25 Aug 20:55

CustomSpecificationSearch

With CustomSpecificationSearch, you can execute specifications using a request parameter. Follow the steps below to use it:

1. Create a Custom Specification

Define a custom specification for your model. For example, to create a specification that checks if a product is in one of two specific states:

public static Specification<Product> readyToUse() {
    return (root, criteriaQuery, criteriaBuilder) -> {
        return criteriaBuilder.or(
            criteriaBuilder.equal(root.get(Product_.status), ENUM_STATUS_1),
            criteriaBuilder.equal(root.get(Product_.status), ENUM_STATUS_2)
        );
    };
}

2. Add a @Configuration Class to Your Project

Create a class annotated with @Configuration to register the custom specification in CustomSpecificationSearch:

@Configuration
class MonkeySpecificationSearchConfiguration {

	@PostConstruct
	void customSpecification() {
		CustomSpecificationSearch.getInstance().add("productReadyToUse", ProductSpecification.readyToUse());
	}

}

3. Call the API Using the Custom Predicate

You can now call your API using the customPredicate as a search parameter. For example:

GET: host/v2/products?search=customPredicate:readyToUse

3.0

3.0

Choose a tag to compare

@FelipeAdorno FelipeAdorno released this 27 May 15:42

This release was created to works alongside with spring boot 3.x.x