Implemented service, repository and controller for each entity

This commit is contained in:
2023-09-30 22:13:46 +03:00
parent b34c5884b1
commit f235921744
28 changed files with 379 additions and 464 deletions

View File

@@ -0,0 +1,29 @@
package com.faf223.expensetrackerfaf.controller;
import com.faf223.expensetrackerfaf.model.User;
import com.faf223.expensetrackerfaf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/users")
public class UserController {
@Autowired
private UserService userService;
@GetMapping("/{userUuid}")
public ResponseEntity<User> getUser(@PathVariable String userUuid) {
User user = userService.getUserById(userUuid);
if (user != null) {
return ResponseEntity.ok(user);
} else {
return ResponseEntity.notFound().build();
}
}
}