-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from bifrurcated/another-feature
Another feature
- Loading branch information
Showing
8 changed files
with
283 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#stage 1 | ||
#Start with a base image containing Java runtime | ||
FROM openjdk:17-slim as build | ||
WORKDIR application | ||
ARG JAR_FILE=target/${project.build.finalName}.jar | ||
COPY ${JAR_FILE} application.jar | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
#stage 2 | ||
#Same Java runtime | ||
FROM openjdk:17-slim | ||
WORKDIR application | ||
COPY --from=build application/dependencies/ ./ | ||
COPY --from=build application/spring-boot-loader/ ./ | ||
COPY --from=build application/snapshot-dependencies/ ./ | ||
COPY --from=build application/application/ ./ | ||
|
||
#execute the application | ||
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher ${SPRING_OPTS}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
src/main/java/com/bifurcated/wallet/repository/WalletRepo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.bifurcated.wallet.repository; | ||
|
||
import com.bifurcated.wallet.data.Wallet; | ||
import org.springframework.data.jdbc.repository.query.Modifying; | ||
import org.springframework.data.jdbc.repository.query.Query; | ||
import org.springframework.data.relational.core.sql.LockMode; | ||
import org.springframework.data.relational.repository.Lock; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
public interface WalletRepo extends CrudRepository<Wallet, UUID> { | ||
|
||
@Query(""" | ||
UPDATE wallet | ||
SET amount = (amount + :amount) | ||
WHERE id = :id | ||
RETURNING id, amount | ||
""") | ||
Optional<Wallet> updateAmount(UUID id, Float amount); | ||
|
||
@Query(""" | ||
UPDATE wallet | ||
SET amount = (amount - :amount) | ||
WHERE id = :id | ||
RETURNING id, amount | ||
""") | ||
Wallet updateAmountReduceReturning(UUID id, Float amount); | ||
|
||
@Query(""" | ||
UPDATE wallet | ||
SET amount = (amount - :amount) | ||
WHERE id = :id | ||
""") | ||
@Modifying | ||
void updateAmountReduce(UUID id, Float amount); | ||
|
||
@Query("SELECT w.id, w.amount FROM wallet w WHERE id = :id FOR UPDATE") | ||
Optional<Wallet> findByIdForUpdate(@Param("id") UUID id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.