diff --git a/src/Client/src/main/java/greenify/client/rest/ActivityService.java b/src/Client/src/main/java/greenify/client/rest/ActivityService.java new file mode 100644 index 0000000..fe69b90 --- /dev/null +++ b/src/Client/src/main/java/greenify/client/rest/ActivityService.java @@ -0,0 +1,25 @@ +package greenify.client.rest; + +import greenify.common.ActivityDTO; +import greenify.common.ApplicationException; +import greenify.common.UserDTO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +public class ActivityService { + + Logger logger = LoggerFactory.getLogger(greenify.server.service.ActivityService.class); + @Autowired + UserRepository userRepository; + + /** + * Adds the activity to the history of the user and adds the score. + * @param name the name of the activity + * @return a activityDTO of activity. + */ + public ActivityDTO addActivity(String name) { + + } + +} diff --git a/src/Common/src/main/java/greenify/common/ActivityDTO.java b/src/Common/src/main/java/greenify/common/ActivityDTO.java index 6ed2fbc..a564f1e 100644 --- a/src/Common/src/main/java/greenify/common/ActivityDTO.java +++ b/src/Common/src/main/java/greenify/common/ActivityDTO.java @@ -12,7 +12,7 @@ public class ActivityDTO { public ActivityDTO(Long id, String name, String description, int score) { this.id = id; this.name = name; - this.description=description; + this.description = description; this.score= score; } diff --git a/src/Server/src/main/java/greenify/server/rest/ActivityController.java b/src/Server/src/main/java/greenify/server/rest/ActivityController.java new file mode 100644 index 0000000..e2f9f2d --- /dev/null +++ b/src/Server/src/main/java/greenify/server/rest/ActivityController.java @@ -0,0 +1,26 @@ +package greenify.server.rest; + +import greenify.common.UserDTO; +import greenify.server.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class ActivityController { + @Autowired + UserService userService; + + @RequestMapping("/addActivity") + public UserDTO registerUser(@RequestParam(value = "name") String name, + @RequestParam(value = "password") String password) { + return userService.registerUser(name, password); + } + + @RequestMapping("/login") + public UserDTO login(@RequestParam(value = "name") String name, + @RequestParam(value = "password") String password) { + return userService.login(name, password); + } +} \ No newline at end of file diff --git a/src/Server/src/main/java/greenify/server/service/ActivityService.java b/src/Server/src/main/java/greenify/server/service/ActivityService.java new file mode 100644 index 0000000..a9c2bbc --- /dev/null +++ b/src/Server/src/main/java/greenify/server/service/ActivityService.java @@ -0,0 +1,6 @@ +package greenify.server.service; + +public class ActivityService { + + +}