Skip to content

Commit

Permalink
Merge pull request #132 from Kerosene-Labs/BIL-4-create-fixed
Browse files Browse the repository at this point in the history
Fixing package issues
  • Loading branch information
hlafaille authored Dec 28, 2024
2 parents bbdbba0 + 3d616ae commit e52cc3d
Show file tree
Hide file tree
Showing 38 changed files with 349 additions and 189 deletions.
25 changes: 0 additions & 25 deletions .github/ISSUE_TEMPLATE/bug.md

This file was deleted.

14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE/feature.md

This file was deleted.

14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE/general.md

This file was deleted.

4 changes: 3 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ What does this PR do? Summarize your changes.
Link to any related issues (e.g., `Fixes #123`).

**Changes Made**

- [ ] Key change #1
- [ ] Key change #2
- [ ] Key change #3
Expand All @@ -13,10 +14,11 @@ Link to any related issues (e.g., `Fixes #123`).
How can reviewers test your changes? Include steps, commands, or screenshots.

**Checklist**

- [ ] Code is well-documented.
- [ ] Tests have been added or updated.
- [ ] All checks pass (CI/CD, linting, etc.).
- [ ] Changes have been reviewed and approved by peers.

**Additional Context**
Any other information or screenshots? Add them here.
Any other information or screenshots? Add them here.
10 changes: 5 additions & 5 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Develop
ikoname: Develop
on:
push:
branches:
Expand All @@ -21,11 +21,11 @@ jobs:
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
java-version: "21"
distribution: "corretto"
server-id: github
settings-path: ${{ github.workspace }}
cache: 'maven'
cache: "maven"

- name: Cache Maven dependencies
uses: actions/cache@v3
Expand Down Expand Up @@ -147,4 +147,4 @@ jobs:
run: scp -o "StrictHostKeyChecking no" -A -r -J ${{secrets.BASTION_SSH_USER}}@${{secrets.BASTION_HOST}}:2222 $PWD/* ${{secrets.DEPLOYMENT_SSH_USER}}@${{secrets.DEPLOYMENT_HOST}}:/home/infra/billtracker/frontend_content

- name: Update Backend
run: ssh -o "StrictHostKeyChecking no" -A -J ${{secrets.BASTION_SSH_USER}}@${{secrets.BASTION_HOST}}:2222 ${{secrets.DEPLOYMENT_SSH_USER}}@${{secrets.DEPLOYMENT_HOST}} "bash -c \"cd billtracker && echo "export BILLTRACKER_VERSION=${{ github.sha }}" >> version.env && source version.env && docker compose pull backend && docker compose up -d backend\""
run: ssh -o "StrictHostKeyChecking no" -A -J ${{secrets.BASTION_SSH_USER}}@${{secrets.BASTION_HOST}}:2222 ${{secrets.DEPLOYMENT_SSH_USER}}@${{secrets.DEPLOYMENT_HOST}} "bash -c \"cd billtracker && echo "export BILLTRACKER_VERSION=${{ github.sha }}" >> version.env && source version.env && docker compose pull backend && docker compose up -d backend\""
8 changes: 4 additions & 4 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
java-version: "21"
distribution: "corretto"
server-id: github
settings-path: ${{ github.workspace }}
cache: 'maven'
cache: "maven"

- name: Cache Maven dependencies
uses: actions/cache@v3
Expand Down Expand Up @@ -147,4 +147,4 @@ jobs:
run: scp -o "StrictHostKeyChecking no" -A -r -J ${{secrets.BASTION_SSH_USER}}@${{secrets.BASTION_HOST}}:2222 $PWD/* ${{secrets.DEPLOYMENT_SSH_USER}}@${{secrets.DEPLOYMENT_HOST}}:/home/infra/billtracker/frontend_content

- name: Update Backend
run: ssh -o "StrictHostKeyChecking no" -A -J ${{secrets.BASTION_SSH_USER}}@${{secrets.BASTION_HOST}}:2222 ${{secrets.DEPLOYMENT_SSH_USER}}@${{secrets.DEPLOYMENT_HOST}} "bash -c \"cd billtracker && echo "export BILLTRACKER_VERSION=${{ github.ref_name }}" >> version.env && source version.env && docker compose pull backend && docker compose up -d backend\""
run: ssh -o "StrictHostKeyChecking no" -A -J ${{secrets.BASTION_SSH_USER}}@${{secrets.BASTION_HOST}}:2222 ${{secrets.DEPLOYMENT_SSH_USER}}@${{secrets.DEPLOYMENT_HOST}} "bash -c \"cd billtracker && echo "export BILLTRACKER_VERSION=${{ github.ref_name }}" >> version.env && source version.env && docker compose pull backend && docker compose up -d backend\""
34 changes: 16 additions & 18 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"preLaunchTask": "Tailwind Watch",
"type": "java",
"name": "BilltrackerApplication",
"request": "launch",
"mainClass": "com.kerosenelabs.billtracker.BilltrackerApplication",
"projectName": "billtracker",
"args": [
"--spring.profiles.active=local"
]
}
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"preLaunchTask": "Tailwind Watch",
"type": "java",
"name": "BilltrackerApplication",
"request": "launch",
"mainClass": "com.kerosenelabs.billtracker.BilltrackerApplication",
"projectName": "billtracker",
"args": ["--spring.profiles.active=local"]
}
]
}
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic"
}
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic"
}
26 changes: 13 additions & 13 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"isBackground": true,
"label": "Tailwind Watch",
"type": "shell",
"command": "cd src/main/frontend && npm run watch",
"problemMatcher": [],
}
]
}
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"isBackground": true,
"label": "Tailwind Watch",
"type": "shell",
"command": "cd src/main/frontend && npm run watch",
"problemMatcher": []
}
]
}
1 change: 0 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Copyright 2024 Kerosene Labs LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ An open source, transparent, independently auditable personal expense and income

1. [Features](#features)
2. [Installation](#installation)
4. [Contributing](#contributing)
5. [License](#license)
6. [Contact](#contact)
3. [Contributing](#contributing)
4. [License](#license)
5. [Contact](#contact)

## Features

Expand Down Expand Up @@ -37,4 +37,4 @@ Please see [LICENSE.md](LICENSE.md).

## Contact

Follow the proper channels on [our website](https://kerosenelabs.com).
Follow the proper channels on [our website](https://kerosenelabs.com).
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ services:
volumes:
- db_data:/var/lib/postgresql/data
volumes:
db_data:
db_data:
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
</dependencies>

<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
Expand Down Expand Up @@ -200,7 +201,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.kerosenelabs.billtracker.BilltrackerApplicationKt</mainClass>
<mainClass>com.kerosenelabs.billtracker.BillTrackerApplicationKt</mainClass>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import org.springframework.web.bind.annotation.CrossOrigin
)
@CrossOrigin
@SpringBootApplication
open class BilltrackerApplication
open class BillTrackerApplication

fun main(args: Array<String>) {
runApplication<BilltrackerApplication>(*args)
runApplication<BillTrackerApplication>(*args)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.kerosenelabs.billtracker.entity.UserEntity
import com.kerosenelabs.billtracker.model.request.CreateOneOffExpenseRequest
import com.kerosenelabs.billtracker.model.request.CreateRecurringExpenseCreatorRequest
import com.kerosenelabs.billtracker.model.response.GetExpenseEventsResponse
import com.kerosenelabs.billtracker.model.response.GetRecurringExpenseEventCreatorsResponse
import com.kerosenelabs.billtracker.service.ExpenseService
import io.swagger.v3.oas.annotations.Parameter
import io.swagger.v3.oas.annotations.tags.Tag
Expand All @@ -18,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@Tag(name = "Expenses", description = "Personal expenses")
class ExpensesController(private val expenseService: ExpenseService) {
@PostMapping("/expenses/oneOff")
@PostMapping("/expenses/oneOffs")
@ResponseStatus(HttpStatus.NO_CONTENT)
fun createOneOff(
@Parameter(hidden = true) user: UserEntity,
Expand All @@ -27,7 +28,7 @@ class ExpensesController(private val expenseService: ExpenseService) {
expenseService.createOneOffExpense(request.amount, user, request.date, request.description)
}

@PostMapping("/expenses/recurringCreator")
@PostMapping("/expenses/recurringCreators")
@ResponseStatus(HttpStatus.NO_CONTENT)
fun createRecurringExpenseCreator(
@Parameter(hidden = true) user: UserEntity,
Expand All @@ -36,7 +37,7 @@ class ExpensesController(private val expenseService: ExpenseService) {
expenseService.createRecurringExpenseEventCreator(
request.amount,
user,
request.recursEveryDays,
request.recursEveryCalendarDay,
request.description
)
}
Expand All @@ -51,4 +52,15 @@ class ExpensesController(private val expenseService: ExpenseService) {
.toList()
)
}

// @GetMapping("/expenses/recurringCreators")
// @ResponseStatus(HttpStatus.OK)
// fun getExpenses(@Parameter(hidden = true) user: UserEntity): GetRecurringExpenseEventCreatorsResponse {
// return GetExpenseEventsResponse(
// expenseService.(user)
// .stream()
// .map { entity -> expenseService.mapExpenseEventEntityToExpenseEvent(entity) }
// .toList()
// )
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.util.UUID
@Table(name = "recurring_expense_event_creator", schema = "public")
class RecurringExpenseEventCreatorEntity(
@Id @GeneratedValue(strategy = GenerationType.AUTO) var id: UUID? = null,
@Column(nullable = false) var recursEveryDays: Int = 0,
@Column(nullable = false) var recursEveryCalendarDay: Int = 0,
@Column(nullable = false) var amount: BigDecimal = BigDecimal.ZERO,

@ManyToOne
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.kerosenelabs.billtracker.model.expense

import java.math.BigDecimal
import java.util.UUID

data class RecurringExpenseEventCreator(
var id: UUID,
var recursEveryCalendarDay: Int,
var amount: BigDecimal,
var description: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import jakarta.validation.constraints.Positive
import java.math.BigDecimal

data class CreateRecurringExpenseCreatorRequest(
@field:Min(1) @field:Max(28) val recursEveryDays: Int,
@field:Min(1) @field:Max(28) val recursEveryCalendarDay: Int,
@field:Positive val amount: BigDecimal,
@field:NotBlank val description: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kerosenelabs.billtracker.model.response

import com.kerosenelabs.billtracker.model.expense.RecurringExpenseEventCreator

data class GetRecurringExpenseEventCreatorsResponse(
val recurringExpenseEventCreators: List<RecurringExpenseEventCreator>
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import java.util.*

@Repository
interface ExpenseEventRepository : JpaRepository<ExpenseEventEntity, UUID> {
fun findExpenseEventEntitiesByUser(user: UserEntity): List<ExpenseEventEntity>
fun findAllByUser(user: UserEntity): List<ExpenseEventEntity>
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.kerosenelabs.billtracker.repository

import com.kerosenelabs.billtracker.entity.RecurringExpenseEventCreatorEntity
import com.kerosenelabs.billtracker.entity.UserEntity
import org.springframework.data.jpa.repository.JpaRepository
import java.util.*

interface RecurringExpenseEventCreatorRepository : JpaRepository<RecurringExpenseEventCreatorEntity, UUID>{
fun findAllByUser(user: UserEntity): List<RecurringExpenseEventCreatorEntity>
}
Loading

0 comments on commit e52cc3d

Please sign in to comment.