Skip to content

Commit

Permalink
Improve email REST API.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaeqs committed Mar 28, 2022
1 parent 0de3221 commit 45edd9a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-mustache'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.mindrot:jbcrypt:0.4'
implementation 'mysql:mysql-connector-java'

implementation group: 'com.sun.mail', name: 'javax.mail', version: '1.6.2'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class EmailController {

public record EmailRequest(String to, String subject, String body) {
}

@Autowired
EmailService emailService;

@PostMapping("/followMessage")
public void sendFollowMessage(@RequestBody List<String> messageData) {
Mail mail = new Mail(messageData.get(0), messageData.get(1), messageData.get(2));
emailService.sendTestMessage(mail);
public void sendFollowMessage(@RequestBody EmailRequest request) {
emailService.sendTestMessage(new Mail(request.to, request.subject, request.body));
}

}
7 changes: 1 addition & 6 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
spring.mustache.suffix=.html
spring.h2.console.enabled=true

spring.jpa.properties.hibernate.format_sql=true
##logging.level.org.hibernate.SQL=DEBUG
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

spring.jpa.hibernate.ddl-auto=update
server.port=3000

0 comments on commit 45edd9a

Please sign in to comment.