Skip to content
Snippets Groups Projects
Commit 46e74038 authored by David Firas's avatar David Firas
Browse files

GrandmaController, -Service added

parent fb5329e7
No related branches found
No related tags found
1 merge request!23Grandma Logic verbessert, Tipp des Tages sowie notifikation über Pflanze in...
......@@ -17,9 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
public class AuthenticationController {
private final AuthenticationService service;
@PostMapping("/register")
public ResponseEntity<AuthenticationResponse> register(
@RequestBody RegisterRequest request
) {
public ResponseEntity<AuthenticationResponse> register(@RequestBody RegisterRequest request) {
return ResponseEntity.ok(service.register(request));
}
......
package hdm.mi.growbros.controllers;
import hdm.mi.growbros.service.GrandmaService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/randomPlantInfo")
public class GrandmaController {
private final GrandmaService grandmaService;
public GrandmaController(GrandmaService grandmaService){
this.grandmaService = grandmaService;
}
@GetMapping
public ResponseEntity<String> getRandomPlantInfo() {
String randomPlantInfo = grandmaService.getRandomPlantInfo();
return ResponseEntity.ok(randomPlantInfo);
}
}
......@@ -7,9 +7,11 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.List;
......@@ -20,6 +22,7 @@ import java.util.List;
@AllArgsConstructor
@Entity
@Table(name = "_user")
@Component
public class User implements UserDetails {
@Id
@GeneratedValue
......
package hdm.mi.growbros.service;
import org.springframework.stereotype.Service;
@Service
public class GrandmaService {
public String getRandomPlantInfo() {
return "Pflanzen-Information-DesTages";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment