-
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.
- Loading branch information
1 parent
0709ef2
commit 118cbc1
Showing
5 changed files
with
81 additions
and
2 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
11 changes: 11 additions & 0 deletions
11
generated/Demo/src/main/java/com/example/demo/repository/tweetRepository.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,11 @@ | ||
package com.example.demo.repository; | ||
|
||
import com.example.demo.domain.Tweet; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.repository.query.Param; | ||
import java.util.List; | ||
public interface tweetRepository extends JpaRepository<Tweet, Long> { | ||
|
||
// Query methods | ||
void newTweet(@Param("content") String content, @Param("tags") String tags); | ||
} |
28 changes: 28 additions & 0 deletions
28
generated/Demo/src/main/java/com/example/demo/service/impl/tweetServiceImpl.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,28 @@ | ||
package com.example.demo.service.impl; | ||
|
||
import com.example.demo.domain.Tweet; | ||
import com.example.demo.repository.tweetRepository; | ||
import com.example.demo.service.service.tweetService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
import lombok.extern.slf4j.Slf4j; | ||
import java.util.List; | ||
|
||
@Service | ||
public class tweetServiceImpl implements tweetService { | ||
|
||
@Autowired | ||
private final tweetRepository tweetrepository; | ||
|
||
@Autowired | ||
public tweetServiceImpl(tweetRepository tweetrepository) { | ||
this.tweetrepository = tweetrepository; | ||
} | ||
|
||
@Override | ||
public void newTweet(String content, String tags) { | ||
log.info("Inside newTweet {}", content,tags); | ||
|
||
tweetrepository.newTweet(content, tags); | ||
}; | ||
} |
9 changes: 9 additions & 0 deletions
9
generated/Demo/src/main/java/com/example/demo/service/service/tweetService.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,9 @@ | ||
package com.example.demo.service.service; | ||
|
||
import com.example.demo.domain.Tweet; | ||
import java.util.List; | ||
public interface tweetService { | ||
|
||
// Service methods | ||
public void newTweet(String content, String tags); | ||
} |
31 changes: 31 additions & 0 deletions
31
generated/Demo/src/main/java/com/example/demo/web/rest/tweetController.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,31 @@ | ||
package com.example.demo.web.rest; | ||
|
||
import com.example.demo.domain.Tweet; | ||
import com.example.demo.service.service.tweetService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
import java.util.List; | ||
import lombok.extern.slf4j.Slf4j; | ||
@Slf4j | ||
@RestController | ||
@RequestMapping(path = "/tweet") | ||
public class tweetController { | ||
|
||
@Autowired | ||
private final tweetService tweetservice; | ||
|
||
@Autowired | ||
public tweetController(tweetService tweetservice) { | ||
this.tweetservice = tweetservice; | ||
} | ||
|
||
// Controller routes | ||
|
||
@POST | ||
@RequestMapping(path = "/get", method = RequestMethod.POST) | ||
public voidnewTweet(@RequestBody String content, @RequestBody String tags) { | ||
// Implement your logic here | ||
tweetservice.newTweet(content, tags); | ||
} | ||
|
||
} |