Compare commits
9 Commits
fe6bb33fe4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| bd6f979f76 | |||
|
|
f06a9de9c6 | ||
| 3e558576ac | |||
|
|
5cecff063d | ||
| c667bfc35a | |||
|
|
039bf13882 | ||
| f9bbe50bb7 | |||
|
|
40f71bc2df | ||
| d618858629 |
15
.gitea/workflows/build.yaml
Normal file
15
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: Build e Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main", "master" ]
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Chamar Webhook do Coolify
|
||||||
|
run: |
|
||||||
|
curl -X GET "${{ secrets.DUCK_WEBHOOK }}" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}"
|
||||||
96
pom.xml
96
pom.xml
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>br.com.stackpanel</groupId>
|
<groupId>br.com.stackpanel</groupId>
|
||||||
<artifactId>duck-api</artifactId>
|
<artifactId>duck-api</artifactId>
|
||||||
<version>0.2.0-BETA</version>
|
<version>0.3.3-BETA</version>
|
||||||
<name/>
|
<name/>
|
||||||
<description/>
|
<description/>
|
||||||
<url/>
|
<url/>
|
||||||
@@ -28,9 +28,7 @@
|
|||||||
</scm>
|
</scm>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
<kotlin.version>2.3.10</kotlin.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
@@ -93,17 +91,6 @@
|
|||||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
|
||||||
<version>${kotlin.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>kotlin-test</artifactId>
|
|
||||||
<version>${kotlin.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -112,85 +99,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>kotlin-maven-plugin</artifactId>
|
|
||||||
<version>${kotlin.version}</version>
|
|
||||||
<extensions>true</extensions>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>compile</id>
|
|
||||||
<phase>compile</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>compile</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration/>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>test-compile</id>
|
|
||||||
<phase>test-compile</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>test-compile</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>kotlin-maven-noarg</artifactId>
|
|
||||||
<version>${kotlin.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>kotlin-maven-allopen</artifactId>
|
|
||||||
<version>${kotlin.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<configuration>
|
|
||||||
<jvmTarget>1.8</jvmTarget>
|
|
||||||
<compilerPlugins>
|
|
||||||
<plugin>jpa</plugin>
|
|
||||||
<plugin>all-open</plugin>
|
|
||||||
<plugin>spring</plugin>
|
|
||||||
</compilerPlugins>
|
|
||||||
<pluginOptions>
|
|
||||||
<option>all-open:annotation=javax.persistence.Entity</option>
|
|
||||||
<option>all-open:annotation=javax.persistence.Embeddable</option>
|
|
||||||
<option>all-open:annotation=javax.persistence.MappedSuperclass</option>
|
|
||||||
<option>all-open:annotation=jakarta.persistence.Entity</option>
|
|
||||||
<option>all-open:annotation=jakarta.persistence.Embeddable</option>
|
|
||||||
<option>all-open:annotation=jakarta.persistence.MappedSuperclass</option>
|
|
||||||
</pluginOptions>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>default-compile</id>
|
|
||||||
<phase>none</phase>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>default-testCompile</id>
|
|
||||||
<phase>none</phase>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>compile</id>
|
|
||||||
<phase>compile</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>compile</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>testCompile</id>
|
|
||||||
<phase>test-compile</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>testCompile</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|||||||
@@ -35,10 +35,13 @@ public class Product {
|
|||||||
@Column(name = "nomplt")
|
@Column(name = "nomplt")
|
||||||
private String nomePlataforma;
|
private String nomePlataforma;
|
||||||
|
|
||||||
|
@Column(name = "lnkprd")
|
||||||
|
private String linkProduto;
|
||||||
|
|
||||||
public Product() {
|
public Product() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Product(Long codigoProduto, String nomeProduto, String descricaoProdutos, BigDecimal precoProdutoAtualizado, BigDecimal precoProdutoPrecoAnterior, LocalDateTime ultimaDataConsultaProduto, LocalDateTime dataEnvioProduto, String nomePlataforma) {
|
public Product(Long codigoProduto, String nomeProduto, String descricaoProdutos, BigDecimal precoProdutoAtualizado, BigDecimal precoProdutoPrecoAnterior, LocalDateTime ultimaDataConsultaProduto, LocalDateTime dataEnvioProduto, String nomePlataforma, String linkProduto) {
|
||||||
this.codigoProduto = codigoProduto;
|
this.codigoProduto = codigoProduto;
|
||||||
this.nomeProduto = nomeProduto;
|
this.nomeProduto = nomeProduto;
|
||||||
this.descricaoProdutos = descricaoProdutos;
|
this.descricaoProdutos = descricaoProdutos;
|
||||||
@@ -47,6 +50,15 @@ public class Product {
|
|||||||
this.ultimaDataConsultaProduto = ultimaDataConsultaProduto;
|
this.ultimaDataConsultaProduto = ultimaDataConsultaProduto;
|
||||||
this.dataEnvioProduto = dataEnvioProduto;
|
this.dataEnvioProduto = dataEnvioProduto;
|
||||||
this.nomePlataforma = nomePlataforma;
|
this.nomePlataforma = nomePlataforma;
|
||||||
|
this.linkProduto = linkProduto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkProduto() {
|
||||||
|
return linkProduto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkProduto(String linkProduto) {
|
||||||
|
this.linkProduto = linkProduto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescricaoProdutos() {
|
public String getDescricaoProdutos() {
|
||||||
|
|||||||
@@ -26,10 +26,12 @@ public class ProductDTO {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private String nomePlataforma;
|
private String nomePlataforma;
|
||||||
|
|
||||||
|
private String linkProduto;
|
||||||
|
|
||||||
public ProductDTO() {
|
public ProductDTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProductDTO(Long codigoProduto, String nomeProduto, String descricaoProduto, BigDecimal precoProdutoAtualizado, BigDecimal precoProdutoPrecoAnterior, LocalDateTime ultimaDataConsultaProduto, LocalDateTime dataEnvioProduto, String nomePlataforma) {
|
public ProductDTO(Long codigoProduto, String nomeProduto, String descricaoProduto, BigDecimal precoProdutoAtualizado, BigDecimal precoProdutoPrecoAnterior, LocalDateTime ultimaDataConsultaProduto, LocalDateTime dataEnvioProduto, String nomePlataforma, String linkProduto) {
|
||||||
this.codigoProduto = codigoProduto;
|
this.codigoProduto = codigoProduto;
|
||||||
this.nomeProduto = nomeProduto;
|
this.nomeProduto = nomeProduto;
|
||||||
this.descricaoProduto = descricaoProduto;
|
this.descricaoProduto = descricaoProduto;
|
||||||
@@ -38,6 +40,15 @@ public class ProductDTO {
|
|||||||
this.ultimaDataConsultaProduto = ultimaDataConsultaProduto;
|
this.ultimaDataConsultaProduto = ultimaDataConsultaProduto;
|
||||||
this.dataEnvioProduto = dataEnvioProduto;
|
this.dataEnvioProduto = dataEnvioProduto;
|
||||||
this.nomePlataforma = nomePlataforma;
|
this.nomePlataforma = nomePlataforma;
|
||||||
|
this.linkProduto = linkProduto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkProduto() {
|
||||||
|
return linkProduto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkProduto(String linkProduto) {
|
||||||
|
this.linkProduto = linkProduto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescricaoProduto() {
|
public String getDescricaoProduto() {
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ public class ProductMapper {
|
|||||||
product.getPrecoProdutoPrecoAnterior(),
|
product.getPrecoProdutoPrecoAnterior(),
|
||||||
product.getUltimaDataConsultaProduto(),
|
product.getUltimaDataConsultaProduto(),
|
||||||
product.getDataEnvioProduto(),
|
product.getDataEnvioProduto(),
|
||||||
product.getNomePlataforma()
|
product.getNomePlataforma(),
|
||||||
|
product.getLinkProduto()
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -39,7 +40,8 @@ public class ProductMapper {
|
|||||||
dto.getPrecoProdutoPrecoAnterior(),
|
dto.getPrecoProdutoPrecoAnterior(),
|
||||||
dto.getUltimaDataConsultaProduto(),
|
dto.getUltimaDataConsultaProduto(),
|
||||||
dto.getDataEnvioProduto(),
|
dto.getDataEnvioProduto(),
|
||||||
dto.getNomePlataforma()
|
dto.getNomePlataforma(),
|
||||||
|
dto.getLinkProduto()
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
return productMapper.toProductDTO(produtoExistente);
|
return productMapper.toProductDTO(produtoExistente);
|
||||||
|
|
||||||
} else if (precoNovo.compareTo(precoAtual) < 0) {
|
} else if (precoNovo.compareTo(precoAtual) < 0) {
|
||||||
// precoNovo < precoAtual → atualiza (ficou mais barato)
|
|
||||||
log.info("Produto '{}' ID: '{}' teve preco atualizado: {} -> {}",
|
log.info("Produto '{}' ID: '{}' teve preco atualizado: {} -> {}",
|
||||||
dto.getNomeProduto(), produtoExistente.getCodigoProduto(),precoAtual, precoNovo);
|
dto.getNomeProduto(), produtoExistente.getCodigoProduto(),precoAtual, precoNovo);
|
||||||
|
|
||||||
@@ -78,7 +77,6 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
produto = productRepository.save(productMapper.toProductEntity(dto));
|
produto = productRepository.save(productMapper.toProductEntity(dto));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// precoNovo > precoAtual → nao atualiza
|
|
||||||
log.info("Produto '{}' ID: '{}' ja existe com preco menor. Nenhuma alteracao feita.", dto.getNomeProduto(), produtoExistente.getCodigoProduto());
|
log.info("Produto '{}' ID: '{}' ja existe com preco menor. Nenhuma alteracao feita.", dto.getNomeProduto(), produtoExistente.getCodigoProduto());
|
||||||
return productMapper.toProductDTO(produtoExistente);
|
return productMapper.toProductDTO(produtoExistente);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user