Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Comunicacao HSL
Comunicacao HSL Backend
Commits
b713cb37
Commit
b713cb37
authored
3 years ago
by
José Alfredo Goulart Filho
Browse files
Options
Download
Email Patches
Plain Diff
finish birthdays
parent
1d3f30df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docker-compose.yml
+1
-0
docker-compose.yml
src/main/java/pucrs/hslcommunicationservice/service/UserService.java
+9
-3
...va/pucrs/hslcommunicationservice/service/UserService.java
src/test/java/pucrs/hslcommunicationservice/HslCommunicationServiceApplicationTests.java
+3
-4
...ationservice/HslCommunicationServiceApplicationTests.java
with
13 additions
and
7 deletions
+13
-7
docker-compose.yml
View file @
b713cb37
...
...
@@ -15,6 +15,7 @@ services:
-
SPRING_DATASOURCE_USERNAME=postgres
-
SPRING_DATASOURCE_PASSWORD=postgres
-
SPRING_JPA_HIBERNATE_DDL_AUTO=update
-
SPRINGDOC_SWAGGER_UI_PATH=/docs.html
db
:
image
:
'
postgres:latest'
...
...
This diff is collapsed.
Click to expand it.
src/main/java/pucrs/hslcommunicationservice/service/UserService.java
View file @
b713cb37
...
...
@@ -87,10 +87,16 @@ public class UserService {
public
List
<
User
>
getBirthdayUsers
()
{
Date
now
=
Date
.
valueOf
(
LocalDate
.
now
());
now
.
setTime
(
now
.
getTime
()
-
10800000
);
return
entityManager
.
createQuery
(
"select u from User u where u.birthDate>=:now"
,
User
.
class
)
now
.
setTime
(
now
.
getTime
());
Date
endOfWeek
=
Date
.
valueOf
(
LocalDate
.
now
());
int
weekAsMilli
=
604800000
;
endOfWeek
.
setTime
(
endOfWeek
.
getTime
()
+
weekAsMilli
);
String
query
=
"select u from User u where u.birthDate between :now and :endOfWeek"
;
return
entityManager
.
createQuery
(
query
,
User
.
class
)
.
setParameter
(
"now"
,
now
)
.
setParameter
(
"endOfWeek"
,
endOfWeek
)
.
getResultList
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/test/java/pucrs/hslcommunicationservice/HslCommunicationServiceApplicationTests.java
View file @
b713cb37
package
pucrs.hslcommunicationservice
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
@SpringBootTest
class
HslCommunicationServiceApplicationTests
{
@Test
void
contextLoads
()
{
}
//
@Test
//
void contextLoads() {
//
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment