Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions generator-templates/persistence/EntityRepository.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
<#if additionalQueries>
import org.springframework.data.jpa.repository.Query;
</#if>
import org.springframework.stereotype.Repository;
import de.${app.packageName?lower_case}.persistence.entity.${entity.name}Entity;

/**
* ${entity.name} Repository class
*/
@Repository
public interface ${entity.name}Repository extends JpaRepository<${entity.name}Entity, Long> {

<#if entity.relationships??>
Expand Down
4 changes: 0 additions & 4 deletions generator-templates/persistence/EntityRepositoryTest.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;

/**
* Tests for ${entity.name}Repository
*/
@DataJpaTest
public class ${entity.name}RepositoryTest {

@Autowired
private TestEntityManager entityManager;

@Autowired
private ${entity.name}Repository repository;

Expand Down
6 changes: 3 additions & 3 deletions generator-templates/postgres/pom.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.1</version>
<version>3.1.2</version>
</parent>

<groupId>de.${app.packageName?lower_case}</groupId>
Expand All @@ -18,8 +18,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot-version>3.1.1</spring-boot-version>
<spring-version>6.0.1</spring-version>
<spring-boot-version>3.1.2</spring-boot-version>
<spring-version>6.0.8</spring-version>
<openapi-version>2.1.0</openapi-version>
<jackson-2-version>2.7.4</jackson-2-version>
</properties>
Expand Down
6 changes: 3 additions & 3 deletions generator-templates/service/Service.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class ${entity.name}Service implements ServiceInterface<${entity.name}Ent
${entity.name}Entity entityPrev = this.findById(entity.getId());
<#list (oneToManyRelations) as oneToMany>
for (${oneToMany.otherEntityName}Entity item : entityPrev.get${oneToMany.relationshipName?cap_first}()) {
${oneToMany.otherEntityName}Entity existingItem = ${oneToMany.otherEntityName?lower_case}Repository.getById(item.getId());
${oneToMany.otherEntityName}Entity existingItem = ${oneToMany.otherEntityName?lower_case}Repository.getReferenceById(item.getId());
existingItem.set${oneToMany.otherEntityRelationshipName?cap_first}(null);
this.${oneToMany.otherEntityName?lower_case}Repository.save(existingItem);
}
Expand All @@ -94,13 +94,13 @@ public class ${entity.name}Service implements ServiceInterface<${entity.name}Ent
<#list (oneToManyRelations) as oneToMany>
if (${oneToMany.relationshipName}ToSave != null && !${oneToMany.relationshipName}ToSave.isEmpty()) {
for (${oneToMany.otherEntityName}Entity item : ${oneToMany.relationshipName}ToSave) {
${oneToMany.otherEntityName}Entity newItem = ${oneToMany.otherEntityName?lower_case}Repository.getById(item.getId());
${oneToMany.otherEntityName}Entity newItem = ${oneToMany.otherEntityName?lower_case}Repository.getReferenceById(item.getId());
newItem.set${oneToMany.otherEntityRelationshipName?cap_first}(entity);
${oneToMany.otherEntityName?lower_case}Repository.save(newItem);
}
}
</#list>
return this.getRepository().getById(entity.getId());
return this.getRepository().getReferenceById(entity.getId());
}
</#if>
}
22 changes: 22 additions & 0 deletions reacthookspring/.github/dependapot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
target-branch: versionupgrade
- package-ecosystem: "npm" # See documentation for possible values
directory: "/webclient/app" # Location of package manifests
schedule:
interval: "weekly"
target-branch: versionupgrade
- package-ecosystem: "docker" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
target-branch: versionupgrade
47 changes: 27 additions & 20 deletions reacthookspring/.github/workflows/buildpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Publish

on:
pull_request:
branches: [ develop ]
branches: [ main ]
workflow_dispatch:

env:
Expand All @@ -21,6 +21,12 @@ jobs:
with:
distribution: 'zulu'
java-version: 17
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm --version
- run: node --version
- name: npm install
run: |
if [ -d "webclient/app" ]; then
Expand All @@ -36,24 +42,25 @@ jobs:
with:
name: artifact
path: application/target/application-0.0.1-SNAPSHOT.jar
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
github-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Log in to the Container registry
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# github-token: ${{ secrets.GITHUB_TOKEN }}

# - name: Build and push Docker image
# uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
# with:
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
70 changes: 0 additions & 70 deletions reacthookspring/.github/workflows/codeql-analysis.yml

This file was deleted.

20 changes: 12 additions & 8 deletions reacthookspring/.github/workflows/createRelease.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

name: Create release and tag

on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
release-type: # id of input
Expand All @@ -13,7 +10,7 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: reacthookspring
release-type: ${{ github.event.inputs.release-type }}

jobs:
Expand Down Expand Up @@ -61,14 +58,20 @@ jobs:
with:
distribution: 'zulu'
java-version: 17
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm --version
- run: node --version
- name: npm install
run: |
if [ -d "webclient/app" ]; then
cd webclient/app
npm install --legacy-peer-deps
fi
- name: Build with Maven
run: mvn -B package -P frontend --file pom.xml
run: mvn clean -B package -P frontend --file pom.xml
env:
CI: false
- name: Upload Maven build artifact
Expand All @@ -94,9 +97,10 @@ jobs:
- name: Build docker image with tag version and push to dockerhub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: starwitorg/reacthookspring
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ghcr.io/reacthookspring
tags: ${{ steps.publish_tag.outputs.tag_name }}
path: .
dockerfile: ./Dockerfile

4 changes: 4 additions & 0 deletions reacthookspring/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@ Start the database without keycloak:
cd deployment
docker-compose -f mysqllocal-docker-compose.yml up
```

### Changelog

During development, you can add commits to change log by using this syntax: https://www.conventionalcommits.org/en/v1.0.0/#examples
Loading