Merge pull request #1 from lumijiez/dimas
Added main controller and user entity
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,13 +1,21 @@
|
|||||||
package com.faf223.expensetrackerfaf.controllers;
|
package com.faf223.expensetrackerfaf.controllers;
|
||||||
|
|
||||||
|
import entities.User;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
class GetHelloWorld {
|
public class MainController {
|
||||||
|
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public String helloWorld() {
|
public String helloWorld() {
|
||||||
return "Hello, World!";
|
return "Hello, World!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/users/{id}")
|
||||||
|
public User getUser(@PathVariable int id) {
|
||||||
|
return new User(id, "Test");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
7
src/main/java/entities/Role.java
Normal file
7
src/main/java/entities/Role.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package entities;
|
||||||
|
|
||||||
|
public enum Role {
|
||||||
|
|
||||||
|
UNREGISTERED, REGISTERED, ADMIN;
|
||||||
|
|
||||||
|
}
|
||||||
32
src/main/java/entities/User.java
Normal file
32
src/main/java/entities/User.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package entities;
|
||||||
|
|
||||||
|
public class User {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String name;
|
||||||
|
private String email;
|
||||||
|
private String login;
|
||||||
|
private String password;
|
||||||
|
private Role role;
|
||||||
|
|
||||||
|
public User(long id, String name) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user