Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4380fb1
projeto iniciado
kiluange Jun 23, 2019
66b31d2
adicionado docker compose
kiluange Jun 25, 2019
44c1a7a
adicionado versionamento de banco de dados
kiluange Jun 26, 2019
a37c707
adicionado classe de tratativa de erros
kiluange Jun 26, 2019
55d0a5a
erros customizados
kiluange Jun 26, 2019
d5cacfd
modelagem para inserção de gastos
kiluange Jun 26, 2019
4f88ede
modelagem para inserção de gastos
kiluange Jun 26, 2019
f345f72
modelagem para inserção de gastos
kiluange Jun 26, 2019
0a94449
repositorios criados
kiluange Jun 26, 2019
1b45917
criado metodo registro gastos
kiluange Jun 26, 2019
5f0d6d4
adicionado registro de gasto
kiluange Jun 28, 2019
30e9d93
adicionado formato de data utc
kiluange Jun 28, 2019
cf8e27a
adicionado metodo para busca de gastos
kiluange Jun 28, 2019
e9f3cc2
adicionado consulta ao banco de dados para busca de cartão
kiluange Jul 1, 2019
f0204d7
busca por data no formato utc
kiluange Jul 1, 2019
d578167
adicionado tratatica para usuario sem cartão
kiluange Jul 1, 2019
322c4d2
tratando error de cartão inexistente
kiluange Jul 2, 2019
0ae3302
adicionado readme
kiluange Jul 2, 2019
d2de33d
adicionado readme
kiluange Jul 2, 2019
df0bc36
adicionado readme
kiluange Jul 2, 2019
2f0bf7d
criado docker compose
kiluange Jul 2, 2019
3249604
criado versionamento do flyway
kiluange Jul 2, 2019
eda437c
adicionado cache
kiluange Jul 2, 2019
fafc744
adicionado cache com redis
kiluange Jul 2, 2019
f9218fd
adicionado cache com redis
kiluange Jul 2, 2019
3bff3fb
adicionado tempo de cache
kiluange Jul 2, 2019
8405446
readme modificado
kiluange Jul 2, 2019
825041a
adicionado projeto de classificação
kiluange Jul 8, 2019
809b7de
adicionado endpoint para datalhes de gasto
kiluange Jul 8, 2019
446c694
adicionado entidades para classificação
kiluange Jul 8, 2019
b7b5054
modificação flyway
kiluange Jul 8, 2019
c5ee265
adicionado controller de classificação
kiluange Jul 8, 2019
58e42b6
adicionado repository e service de classificação
kiluange Jul 8, 2019
c741b9a
correções flyway e domain
kiluange Jul 8, 2019
b34dbc2
correção endpoint
kiluange Jul 8, 2019
2de2c93
correção dto e criacao mapper
kiluange Jul 8, 2019
86f258c
retornando gasto
kiluange Jul 8, 2019
cbc29bf
adicionado feature de classificação
kiluange Jul 10, 2019
5109552
adicionado feature de classificação
kiluange Jul 10, 2019
7f20ee8
lixo removido
kiluange Jul 10, 2019
4e3b057
docker compose modificado
kiluange Jul 10, 2019
4d8c42f
readme modificado
kiluange Jul 10, 2019
aa0fdd5
adicionado cache ao endpoint de classificação
kiluange Jul 10, 2019
71b781e
modificado versão java
kiluange Jul 10, 2019
dabe76f
criado base para testes
kiluange Jul 10, 2019
ebaa51d
criado base para testes
kiluange Jul 10, 2019
64aa540
anotações para correção
kiluange Jul 10, 2019
0c4c065
Classe renomeada
kiluange Jul 10, 2019
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
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
32 changes: 32 additions & 0 deletions gastos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
4 changes: 4 additions & 0 deletions gastos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:8-jdk-alpine
VOLUME /tmp
COPY build/libs/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
20 changes: 20 additions & 0 deletions gastos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Gastos

App desenvolvido utilizando Spring boot, Mysql para persistência de dados e Redis para cache de requisições.

## Compilando

Dentro da pasta do projeto execute o comando

```$ ./gradlew clean build```

Será gerado um arquivo .jar dentro do diretório ```/build/libs```.

## Executando
Para executar a aplicação execute o seguinte comando:

```$ docker-compose up --build ```

## Link para docmentação API

[Santander API](https://documenter.getpostman.com/view/7191301/SVSEur2A?version=latest)
44 changes: 44 additions & 0 deletions gastos/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}

apply plugin: 'io.spring.dependency-management'

group = 'io.santander'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

ext {
orikaVersion = '1.5.2'
flywayVersion = '5.2.4'
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation "ma.glasnost.orika:orika-core:${orikaVersion}"
implementation "org.flywaydb:flyway-core:${flywayVersion}"
implementation 'org.springframework.boot:spring-boot-starter-data-redis:2.1.2.RELEASE'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
53 changes: 53 additions & 0 deletions gastos/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '3.3'

services:
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: 'gastos'
MYSQL_USER: 'gastos'
MYSQL_PASSWORD: 'gastos'
MYSQL_ROOT_PASSWORD: 'root'
networks:
- net-spents
ports:
- '3306:3306'
expose:
- '3306'
volumes:
- my-db:/var/lib/mysql

redis:
image: redis
command: redis-server --requirepass Redis2019! --protected-mode no
networks:
- net-spents
ports:
- "6379:6379"
expose:
- '6379'

santander-spents:
depends_on:
- mysql
- redis
links:
- mysql
environment:
SPRING_REDIS_HOST: redis
SPRING_DATASOURCE_URL: "jdbc:mysql://mysql:3306/gastos"
networks:
- net-spents
build:
context: .
container_name: spents-app
ports:
- "8080:8080"

volumes:
my-db:

networks:
net-spents:
driver: bridge
Binary file added gastos/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gastos/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
172 changes: 172 additions & 0 deletions gastos/gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
echo "$*"
}

die () {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
Loading