Skip to content

Commit

Permalink
Push grammar changes
Browse files Browse the repository at this point in the history
  • Loading branch information
YassineOuhadi committed Jan 7, 2024
1 parent 0709ef2 commit 118cbc1
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public class Tweet {

// Relationships

@OneToMany(mappedBy = "tweet", cascade = CascadeType.ALL)
private List<User> users;
@ManyToOne(fetch = FetchType.LAZY)
private User user;

// Add getters and setters here
}
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);
}
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);
};
}
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);
}
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);
}

}

0 comments on commit 118cbc1

Please sign in to comment.