Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 726be3f613 | |||
| 936140e76f | |||
| 15792bad28 | |||
| 814b2221c8 | |||
| 011bb03d3f | |||
| 5e0311971d | |||
| 31566d1bd8 | |||
| b669855a56 | |||
| 3830449377 | |||
| 3db2806a04 | |||
| d26a9bffc5 |
@@ -2,8 +2,8 @@ name: Build and Deploy Versioned Spring Boot Server
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: # Match all tags
|
tags:
|
||||||
- "*"
|
- "*" # Match all tags
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -43,20 +43,42 @@ jobs:
|
|||||||
- name: Extract Tag Version
|
- name: Extract Tag Version
|
||||||
id: extract_version
|
id: extract_version
|
||||||
run: |
|
run: |
|
||||||
TAG_VERSION=${GITEA_REF#refs/tags/}
|
TAG_VERSION=$(echo "${GITHUB_REF}" | sed 's#refs/tags/##')
|
||||||
|
if [ -z "$TAG_VERSION" ]; then
|
||||||
|
echo "Error: TAG_VERSION is empty."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
|
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Extract major and minor versions
|
||||||
|
MAJOR_VERSION=$(echo "${TAG_VERSION}" | cut -d. -f1)
|
||||||
|
MINOR_VERSION=$(echo "${TAG_VERSION}" | cut -d. -f1,2)
|
||||||
|
echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
|
||||||
|
echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
# 7. Build the Docker image with the tag
|
# 7. Build the Docker image with the tag
|
||||||
- name: Build and Package Docker Image
|
- name: Build and Package Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build -t tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} .
|
docker build -t tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} .
|
||||||
|
|
||||||
# 8. Docker login
|
# 8. Tag the image with Major Version (e.g., 0)
|
||||||
|
- name: Tag with Major Version
|
||||||
|
run: |
|
||||||
|
docker tag tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} tea.zendric.de/cedric/xpensely-server:${{ env.MAJOR_VERSION }}
|
||||||
|
|
||||||
|
# 9. Tag the image with Minor Version (e.g., 0.1)
|
||||||
|
- name: Tag with Minor Version
|
||||||
|
run: |
|
||||||
|
docker tag tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} tea.zendric.de/cedric/xpensely-server:${{ env.MINOR_VERSION }}
|
||||||
|
|
||||||
|
# 10. Docker login
|
||||||
- name: Login to Docker Registry
|
- name: Login to Docker Registry
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.TEAPASSWORD }}" | docker login tea.zendric.de -u ${{ secrets.TEAUSER }} --password-stdin
|
echo "${{ secrets.TEAPASSWORD }}" | docker login tea.zendric.de -u ${{ secrets.TEAUSER }} --password-stdin
|
||||||
|
|
||||||
# 9. Push the Docker image with the tag
|
# 11. Push the Docker images with the tags
|
||||||
- name: Push the Docker Image to registry
|
- name: Push the Docker Image to registry
|
||||||
run: |
|
run: |
|
||||||
docker push tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }}
|
docker push tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }}
|
||||||
|
docker push tea.zendric.de/cedric/xpensely-server:${{ env.MAJOR_VERSION }}
|
||||||
|
docker push tea.zendric.de/cedric/xpensely-server:${{ env.MINOR_VERSION }}
|
||||||
|
|||||||
7
README.md
Normal file
7
README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Run it locally:
|
||||||
|
|
||||||
|
1. build the current state:
|
||||||
|
mvn clean install or mvn clean install -DskipTests
|
||||||
|
|
||||||
|
2. docker it up and run it
|
||||||
|
docker-compose -f dev-docker-compose.yml up --build
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<mxfile host="65bd71144e">
|
<mxfile host="65bd71144e">
|
||||||
<diagram id="TZX9Tq6sZIlTxQ58HocZ" name="Page-1">
|
<diagram id="TZX9Tq6sZIlTxQ58HocZ" name="Page-1">
|
||||||
<mxGraphModel dx="826" dy="472" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
|
<mxGraphModel dx="989" dy="570" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
|
||||||
<root>
|
<root>
|
||||||
<mxCell id="0"/>
|
<mxCell id="0"/>
|
||||||
<mxCell id="1" parent="0"/>
|
<mxCell id="1" parent="0"/>
|
||||||
@@ -193,6 +193,90 @@
|
|||||||
<mxCell id="73" value="<span style="font-size: 8px;">24.12.24 ; Expense ; 24,12 €</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#76608a;fontColor=#ffffff;strokeColor=#432D57;" parent="1" vertex="1">
|
<mxCell id="73" value="<span style="font-size: 8px;">24.12.24 ; Expense ; 24,12 €</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#76608a;fontColor=#ffffff;strokeColor=#432D57;" parent="1" vertex="1">
|
||||||
<mxGeometry x="1399" y="226" width="120" height="20" as="geometry"/>
|
<mxGeometry x="1399" y="226" width="120" height="20" as="geometry"/>
|
||||||
</mxCell>
|
</mxCell>
|
||||||
|
<mxCell id="86" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="74" target="79">
|
||||||
|
<mxGeometry relative="1" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="74" value="List" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1880" y="160" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="75" value="DB-Structure for Categories" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1930" y="35" width="100" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="78" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="76" target="77">
|
||||||
|
<mxGeometry relative="1" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="76" value="List Entry" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1920" y="220" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="79" value="Available Categories" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="2160" y="150" width="120" height="80" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="83" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="81" target="79">
|
||||||
|
<mxGeometry relative="1" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="81" value="Standard Categories" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="2060" y="35" width="120" height="80" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="84" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="82" target="79">
|
||||||
|
<mxGeometry relative="1" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="82" value="Custom Categories" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="2270" y="35" width="120" height="80" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="91" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="87" target="90">
|
||||||
|
<mxGeometry relative="1" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="87" value="List Entry" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1920" y="280" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="92" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="88" target="89">
|
||||||
|
<mxGeometry relative="1" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="88" value="List Entry" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1920" y="340" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="89" value="Category" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="2150" y="370" width="120" height="80" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="90" value="Category" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="2150" y="315" width="120" height="80" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="94" value="<h1 style="font-size: 18px;">- list id</h1><div>- List &lt;String&gt;</div>" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;fontSize=18;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="2410" y="50" width="130" height="70" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="77" value="Category" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="2150" y="260" width="120" height="80" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="97" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1730" y="510" width="200" height="320" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="98" value="ExpenseList" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1770" y="520" width="120" height="20" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="100" value="+" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1880" y="790" width="30" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="101" value="Categorie" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1770" y="480" width="120" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="102" value="<span style="font-size: 8px;">Amount : 24,12 €<br>Title: Expense<br>Date: 24.12.24<br>From: Jessi<br>Deviation: 0 €</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#76608a;fontColor=#ffffff;strokeColor=#432D57;align=left;spacingLeft=12;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1745" y="550" width="170" height="170" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="105" value="<span style="font-size: 8px;">Essen</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#1ba1e2;fontColor=#ffffff;strokeColor=#006EAF;align=left;spacingLeft=12;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1760" y="680" width="40" height="10" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="106" value="<span style="font-size: 8px;">Trinken</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#a20025;fontColor=#ffffff;strokeColor=#6F0000;align=left;spacingLeft=12;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1800" y="680" width="40" height="10" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="107" value="<span style="font-size: 8px;">Auto</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d80073;fontColor=#ffffff;strokeColor=#A50040;align=left;spacingLeft=12;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1840" y="680" width="40" height="10" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="111" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=18;" edge="1" parent="1" source="108" target="74">
|
||||||
|
<mxGeometry relative="1" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="108" value="Actor" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;fontSize=18;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="1715" y="150" width="30" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
|
|||||||
52
dev-docker-compose.yml
Normal file
52
dev-docker-compose.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
xpensely-server:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: xpensely-server:local
|
||||||
|
labels:
|
||||||
|
net.unraid.docker.icon: https://tea.zendric.de/Cedric/XpenselyServer/raw/branch/main/src/main/resources/static/xpensely_icon_white.png
|
||||||
|
container_name: xpensely-server
|
||||||
|
ports:
|
||||||
|
- 3636:8080
|
||||||
|
environment:
|
||||||
|
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
|
||||||
|
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
|
||||||
|
DB_PORT: 5432
|
||||||
|
DB_P_NAME: xpensely
|
||||||
|
DB_USERNAME: ${DB_USERNAME}
|
||||||
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
SPRING_PROFILES_ACTIVE: test
|
||||||
|
depends_on:
|
||||||
|
postgresdb:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- xpensely-network
|
||||||
|
postgresdb:
|
||||||
|
labels:
|
||||||
|
net.unraid.docker.icon: https://raw.githubusercontent.com/docker-library/docs/01c12653951b2fe592c1f93a13b4e289ada0e3a1/postgres/logo.png
|
||||||
|
image: postgres:14
|
||||||
|
container_name: postgresdb
|
||||||
|
ports:
|
||||||
|
- 5435:5432
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: xpensely
|
||||||
|
POSTGRES_USER: ${DB_USERNAME}
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
|
networks:
|
||||||
|
- xpensely-network
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
- CMD-SHELL
|
||||||
|
- pg_isready -U ${DB_USERNAME} -d xpensely
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
volumes:
|
||||||
|
db_data: null
|
||||||
|
networks:
|
||||||
|
xpensely-network: null
|
||||||
@@ -1,15 +1,17 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
services:
|
services:
|
||||||
xpensely-server:
|
xpensely-server:
|
||||||
image: tea.zendric.de/cedric/xpensely-server:latest
|
image: tea.zendric.de/cedric/xpensely-server:0
|
||||||
|
labels:
|
||||||
|
net.unraid.docker.icon: https://tea.zendric.de/Cedric/XpenselyServer/raw/branch/main/src/main/resources/static/xpensely_icon_white.png
|
||||||
container_name: xpensely-server
|
container_name: xpensely-server
|
||||||
ports:
|
ports:
|
||||||
- 3636:8080
|
- 3636:8080
|
||||||
environment:
|
environment:
|
||||||
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
|
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
|
||||||
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
|
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
|
||||||
DB_PORT: 5434
|
DB_PORT: 5432
|
||||||
DB_NAME: ${DB_P_NAME}
|
DB_P_NAME: xpensely
|
||||||
DB_USERNAME: ${DB_USERNAME}
|
DB_USERNAME: ${DB_USERNAME}
|
||||||
DB_PASSWORD: ${DB_PASSWORD}
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -18,21 +20,26 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- xpensely-network
|
- xpensely-network
|
||||||
postgresdb:
|
postgresdb:
|
||||||
|
labels:
|
||||||
|
net.unraid.docker.icon: https://raw.githubusercontent.com/docker-library/docs/01c12653951b2fe592c1f93a13b4e289ada0e3a1/postgres/logo.png
|
||||||
image: postgres:14
|
image: postgres:14
|
||||||
container_name: postgresdb
|
container_name: postgresdb
|
||||||
ports:
|
ports:
|
||||||
- 5434:5432
|
- 5435:5432
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: ${DB_P_NAME}
|
POSTGRES_DB: xpensely
|
||||||
POSTGRES_USER: ${DB_USERNAME}
|
POSTGRES_USER: ${DB_USERNAME}
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
networks:
|
networks:
|
||||||
- xpensely-network
|
- xpensely-network
|
||||||
volumes:
|
volumes:
|
||||||
- db_data:/var/lib/postgresql/data
|
- db_data:/var/lib/postgresql/data
|
||||||
|
- /mnt/user/appdata/xpensely_backups:/backups
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME}"]
|
test:
|
||||||
|
- CMD-SHELL
|
||||||
|
- pg_isready -U ${DB_USERNAME} -d xpensely
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ COPY ./target/*.jar app.jar
|
|||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
ENTRYPOINT ["java","-jar", "app.jar"]
|
||||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import de.zendric.app.xpensely_server.model.AppUser;
|
import de.zendric.app.xpensely_server.model.AppUser;
|
||||||
import de.zendric.app.xpensely_server.model.AppUserCreateRequest;
|
import de.zendric.app.xpensely_server.model.AppUserCreateRequest;
|
||||||
import de.zendric.app.xpensely_server.model.UsernameAlreadyExistsException;
|
import de.zendric.app.xpensely_server.model.Exception.UsernameAlreadyExistsException;
|
||||||
import de.zendric.app.xpensely_server.services.UserService;
|
import de.zendric.app.xpensely_server.services.UserService;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import de.zendric.app.xpensely_server.model.ExpenseChangeRequest;
|
|||||||
import de.zendric.app.xpensely_server.model.ExpenseInput;
|
import de.zendric.app.xpensely_server.model.ExpenseInput;
|
||||||
import de.zendric.app.xpensely_server.model.ExpenseList;
|
import de.zendric.app.xpensely_server.model.ExpenseList;
|
||||||
import de.zendric.app.xpensely_server.model.InviteRequest;
|
import de.zendric.app.xpensely_server.model.InviteRequest;
|
||||||
|
import de.zendric.app.xpensely_server.model.XpenselyStandardCategories;
|
||||||
|
import de.zendric.app.xpensely_server.services.CategoryService;
|
||||||
import de.zendric.app.xpensely_server.services.ExpenseListService;
|
import de.zendric.app.xpensely_server.services.ExpenseListService;
|
||||||
import de.zendric.app.xpensely_server.services.UserService;
|
import de.zendric.app.xpensely_server.services.UserService;
|
||||||
|
|
||||||
@@ -33,11 +35,14 @@ class ExpenseListController {
|
|||||||
|
|
||||||
private ExpenseListService expenseListService;
|
private ExpenseListService expenseListService;
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
private CategoryService categoryService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ExpenseListController(ExpenseListService expenseListService, UserService userService) {
|
public ExpenseListController(ExpenseListService expenseListService, UserService userService,
|
||||||
|
CategoryService categoryService) {
|
||||||
this.expenseListService = expenseListService;
|
this.expenseListService = expenseListService;
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
|
this.categoryService = categoryService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
@@ -96,6 +101,7 @@ class ExpenseListController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
|
// TODO add handling of categories by using DTO
|
||||||
public ResponseEntity<ExpenseList> create(@RequestBody ExpenseList expenseList) {
|
public ResponseEntity<ExpenseList> create(@RequestBody ExpenseList expenseList) {
|
||||||
try {
|
try {
|
||||||
if (expenseList.getOwner() != null) {
|
if (expenseList.getOwner() != null) {
|
||||||
@@ -104,6 +110,8 @@ class ExpenseListController {
|
|||||||
throw new IllegalArgumentException("Owner does not exist.");
|
throw new IllegalArgumentException("Owner does not exist.");
|
||||||
}
|
}
|
||||||
expenseList.setOwner(existingOwner);
|
expenseList.setOwner(existingOwner);
|
||||||
|
XpenselyStandardCategories standardCategories = categoryService.getDefaultCategories();
|
||||||
|
expenseList.setXpenselyStandardCategories(standardCategories);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Owner is required.");
|
throw new IllegalArgumentException("Owner is required.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package de.zendric.app.xpensely_server.model.DTO;
|
||||||
|
|
||||||
|
public class ExpenseListDTO {
|
||||||
|
|
||||||
|
// TODO should combine the two categories to one;
|
||||||
|
|
||||||
|
// private List<CategoryDTO> availableCategories;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package de.zendric.app.xpensely_server.model;
|
package de.zendric.app.xpensely_server.model.Exception;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
@@ -34,7 +34,7 @@ public class Expense {
|
|||||||
private Double amount;
|
private Double amount;
|
||||||
private Double personalUseAmount;
|
private Double personalUseAmount;
|
||||||
private Double otherPersonAmount;
|
private Double otherPersonAmount;
|
||||||
|
private String category;
|
||||||
private LocalDate date;
|
private LocalDate date;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class ExpenseChangeRequest {
|
|||||||
private Double personalUseAmount;
|
private Double personalUseAmount;
|
||||||
private Double otherPersonAmount;
|
private Double otherPersonAmount;
|
||||||
private LocalDate date;
|
private LocalDate date;
|
||||||
|
private String category;
|
||||||
|
|
||||||
public Expense convertToExpense(Long userId, ExpenseList expenseList) {
|
public Expense convertToExpense(Long userId, ExpenseList expenseList) {
|
||||||
AppUser appUser = new AppUser();
|
AppUser appUser = new AppUser();
|
||||||
@@ -33,6 +34,7 @@ public class ExpenseChangeRequest {
|
|||||||
expense.setId(id);
|
expense.setId(id);
|
||||||
expense.setOwner(appUser);
|
expense.setOwner(appUser);
|
||||||
expense.setTitle(title);
|
expense.setTitle(title);
|
||||||
|
expense.setCategory(category);
|
||||||
|
|
||||||
return expense;
|
return expense;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class ExpenseInput {
|
|||||||
private Double otherPersonAmount;
|
private Double otherPersonAmount;
|
||||||
|
|
||||||
private LocalDate date;
|
private LocalDate date;
|
||||||
|
private String category;
|
||||||
|
|
||||||
private ExpenseList expenseList;
|
private ExpenseList expenseList;
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ public class ExpenseInput {
|
|||||||
expense.setId(id);
|
expense.setId(id);
|
||||||
expense.setOwner(appUser);
|
expense.setOwner(appUser);
|
||||||
expense.setTitle(title);
|
expense.setTitle(title);
|
||||||
|
expense.setCategory(category);
|
||||||
|
|
||||||
return expense;
|
return expense;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonManagedReference;
|
|||||||
|
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
@@ -40,6 +41,14 @@ public class ExpenseList {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
private AppUser sharedWith;
|
private AppUser sharedWith;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
|
private XpenselyStandardCategories xpenselyStandardCategories;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "expenseList", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
|
@JsonManagedReference
|
||||||
|
@jakarta.persistence.OrderBy("name ASC")
|
||||||
|
private List<XpenselyCustomCategory> customCategories;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "expenseList", cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(mappedBy = "expenseList", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
@JsonManagedReference
|
@JsonManagedReference
|
||||||
@jakarta.persistence.OrderBy("date ASC, id ASC")
|
@jakarta.persistence.OrderBy("date ASC, id ASC")
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package de.zendric.app.xpensely_server.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class XpenselyCustomCategory {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(name = "color_code", length = 7, nullable = false)
|
||||||
|
private String colorCode;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "expense_list_id", nullable = false)
|
||||||
|
@JsonBackReference
|
||||||
|
private ExpenseList expenseList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package de.zendric.app.xpensely_server.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class XpenselyStandardCategories {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||||
|
@JoinColumn(name = "global_categories_id")
|
||||||
|
private List<XpenselyStandardCategory> categories;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package de.zendric.app.xpensely_server.model;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class XpenselyStandardCategory {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(name = "color_code", length = 7, nullable = false)
|
||||||
|
private String colorCode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package de.zendric.app.xpensely_server.preparation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import de.zendric.app.xpensely_server.model.XpenselyStandardCategories;
|
||||||
|
import de.zendric.app.xpensely_server.model.XpenselyStandardCategory;
|
||||||
|
import de.zendric.app.xpensely_server.repo.XpenselyStandardCategoriesRepository;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DataInitializer implements CommandLineRunner {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private XpenselyStandardCategoriesRepository globalRepo;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
Optional<XpenselyStandardCategories> optional = globalRepo.findById(1L);
|
||||||
|
|
||||||
|
XpenselyStandardCategories global = optional.orElseGet(() -> {
|
||||||
|
XpenselyStandardCategories g = new XpenselyStandardCategories();
|
||||||
|
g.setId(1L);
|
||||||
|
return g;
|
||||||
|
});
|
||||||
|
|
||||||
|
List<XpenselyStandardCategory> categories = List.of(
|
||||||
|
new XpenselyStandardCategory(null, "Food", "#FF5733"),
|
||||||
|
new XpenselyStandardCategory(null, "Transportation", "#33C3FF"),
|
||||||
|
new XpenselyStandardCategory(null, "Entertainment", "#33FF57"),
|
||||||
|
new XpenselyStandardCategory(null, "Shopping", "#FF33A8"),
|
||||||
|
new XpenselyStandardCategory(null, "Household", "#FFC733"),
|
||||||
|
new XpenselyStandardCategory(null, "Other", "#9D33FF"));
|
||||||
|
global.setCategories(categories);
|
||||||
|
globalRepo.save(global);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package de.zendric.app.xpensely_server.repo;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import de.zendric.app.xpensely_server.model.XpenselyCustomCategory;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface XpenselyCustomCategoryRepository extends JpaRepository<XpenselyCustomCategory, Long> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package de.zendric.app.xpensely_server.repo;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import de.zendric.app.xpensely_server.model.XpenselyStandardCategories;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface XpenselyStandardCategoriesRepository extends JpaRepository<XpenselyStandardCategories, Long> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package de.zendric.app.xpensely_server.security;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.security.config.Customizer;
|
import org.springframework.security.config.Customizer;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
@@ -10,17 +11,19 @@ import org.springframework.security.web.SecurityFilterChain;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
public class SecurityConfig {
|
public class SecurityConfig {
|
||||||
// @Bean
|
@Bean
|
||||||
// public SecurityFilterChain securityFilterChain(HttpSecurity http) throws
|
@Profile("test") // Only enable this for testing
|
||||||
// Exception {
|
public SecurityFilterChain testSecurityFilterChain(HttpSecurity http) throws Exception {
|
||||||
// http.authorizeHttpRequests(auth -> auth
|
http
|
||||||
// .anyRequest().permitAll()).csrf().disable();
|
.authorizeHttpRequests(auth -> auth
|
||||||
// ;
|
.anyRequest().permitAll())
|
||||||
|
.csrf().disable();
|
||||||
|
|
||||||
// return http.build();
|
return http.build();
|
||||||
// }
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@Profile("!test")
|
||||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||||
http
|
http
|
||||||
.authorizeHttpRequests(auth -> auth
|
.authorizeHttpRequests(auth -> auth
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package de.zendric.app.xpensely_server.services;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import de.zendric.app.xpensely_server.model.XpenselyStandardCategories;
|
||||||
|
import de.zendric.app.xpensely_server.repo.XpenselyStandardCategoriesRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CategoryService {
|
||||||
|
|
||||||
|
private final XpenselyStandardCategoriesRepository standardCategoriesRepo;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public CategoryService(XpenselyStandardCategoriesRepository standardCategoriesRepo) {
|
||||||
|
this.standardCategoriesRepo = standardCategoriesRepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XpenselyStandardCategories getDefaultCategories() {
|
||||||
|
return standardCategoriesRepo.findById(1L)
|
||||||
|
.orElseThrow(() -> new IllegalStateException("Standard categories not found"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,8 +14,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import de.zendric.app.xpensely_server.model.AppUser;
|
import de.zendric.app.xpensely_server.model.AppUser;
|
||||||
import de.zendric.app.xpensely_server.model.Expense;
|
import de.zendric.app.xpensely_server.model.Expense;
|
||||||
import de.zendric.app.xpensely_server.model.ExpenseList;
|
import de.zendric.app.xpensely_server.model.ExpenseList;
|
||||||
|
import de.zendric.app.xpensely_server.model.XpenselyCustomCategory;
|
||||||
import de.zendric.app.xpensely_server.repo.ExpenseListRepository;
|
import de.zendric.app.xpensely_server.repo.ExpenseListRepository;
|
||||||
import de.zendric.app.xpensely_server.repo.ExpenseRepository;
|
import de.zendric.app.xpensely_server.repo.ExpenseRepository;
|
||||||
|
import de.zendric.app.xpensely_server.repo.XpenselyCustomCategoryRepository;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -24,14 +26,17 @@ public class ExpenseListService {
|
|||||||
|
|
||||||
private ExpenseListRepository repository;
|
private ExpenseListRepository repository;
|
||||||
private final ExpenseRepository expenseRepository;
|
private final ExpenseRepository expenseRepository;
|
||||||
|
private XpenselyCustomCategoryRepository customCategoryRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ExpenseListService(ExpenseListRepository repository, ExpenseRepository expenseRepository) {
|
public ExpenseListService(ExpenseListRepository repository, ExpenseRepository expenseRepository,
|
||||||
|
XpenselyCustomCategoryRepository customCategoryRepository) {
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.expenseRepository = expenseRepository;
|
this.expenseRepository = expenseRepository;
|
||||||
|
this.customCategoryRepository = customCategoryRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ExpenseList> getAllLists() {
|
public List<ExpenseList> getAllLists() {
|
||||||
@@ -178,7 +183,28 @@ public class ExpenseListService {
|
|||||||
existingExpense.setOtherPersonAmount(updatedExpense.getOtherPersonAmount());
|
existingExpense.setOtherPersonAmount(updatedExpense.getOtherPersonAmount());
|
||||||
existingExpense.setDate(updatedExpense.getDate());
|
existingExpense.setDate(updatedExpense.getDate());
|
||||||
existingExpense.setOwner(updatedExpense.getOwner());
|
existingExpense.setOwner(updatedExpense.getOwner());
|
||||||
|
existingExpense.setCategory(updatedExpense.getCategory());
|
||||||
|
|
||||||
return expenseRepository.save(existingExpense);
|
return expenseRepository.save(existingExpense);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO implement API for this
|
||||||
|
public XpenselyCustomCategory addCustomCategory(Long expenseListId, XpenselyCustomCategory customCategory) {
|
||||||
|
ExpenseList expenseList = repository.findById(expenseListId)
|
||||||
|
.orElseThrow(() -> new RuntimeException("Expense List not found"));
|
||||||
|
customCategory.setExpenseList(expenseList);
|
||||||
|
|
||||||
|
return customCategoryRepository.save(customCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO implement API for this
|
||||||
|
public void deleteCustomCategory(Long expenseListId, Long categoryId) {
|
||||||
|
XpenselyCustomCategory category = customCategoryRepository.findById(categoryId)
|
||||||
|
.orElseThrow(() -> new RuntimeException("Custom Category not found"));
|
||||||
|
if (!category.getExpenseList().getId().equals(expenseListId)) {
|
||||||
|
throw new RuntimeException("Category does not belong to the specified Expense List");
|
||||||
|
}
|
||||||
|
customCategoryRepository.delete(category);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ import java.util.Optional;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.zendric.app.xpensely_server.model.AppUser;
|
import de.zendric.app.xpensely_server.model.AppUser;
|
||||||
import de.zendric.app.xpensely_server.model.UsernameAlreadyExistsException;
|
import de.zendric.app.xpensely_server.model.Exception.UsernameAlreadyExistsException;
|
||||||
import de.zendric.app.xpensely_server.repo.UserRepository;
|
import de.zendric.app.xpensely_server.repo.UserRepository;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|||||||
BIN
src/main/resources/static/xpensely_icon_white.png
Normal file
BIN
src/main/resources/static/xpensely_icon_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,26 @@
|
|||||||
|
package de.zendric.app.xpensely_Server;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||||
|
|
||||||
|
import de.zendric.app.xpensely_server.model.ExpenseList;
|
||||||
|
import de.zendric.app.xpensely_server.repo.ExpenseListRepository;
|
||||||
|
|
||||||
|
@DataJpaTest
|
||||||
|
class ExpenseListRepositoryTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExpenseListRepository expenseListRepository;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testFindExpenseListById() {
|
||||||
|
// Assuming an ExpenseList with id = 1 exists in your test DB.
|
||||||
|
Optional<ExpenseList> optionalExpenseList = expenseListRepository.findById(1L);
|
||||||
|
|
||||||
|
ExpenseList expenseList = optionalExpenseList.get();
|
||||||
|
System.out.println("ExpenseList name: " + expenseList.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package de.zendric.app.xpensely_Server;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
class XpenselyServerApplicationTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void contextLoads() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user