Merge pull request 'chore: Update branch' (#7) from Maradona/Backend:restfull into restfull
Reviewed-on: #7pull/1/head
commit
8d66f37dc1
|
@ -35,11 +35,9 @@ public class DefaultValueLoader implements CommandLineRunner {
|
||||||
@Override
|
@Override
|
||||||
public void run(String... args) {
|
public void run(String... args) {
|
||||||
|
|
||||||
// Clear all tables
|
if (employeeRepository.count() > 0) {
|
||||||
employeeRepository.deleteAll();
|
return;
|
||||||
secondarySkillRepository.deleteAll();
|
}
|
||||||
primarySkillRepository.deleteAll();
|
|
||||||
formOfAddressRepository.deleteAll();
|
|
||||||
|
|
||||||
// Create form of addresses
|
// Create form of addresses
|
||||||
FormOfAddress formOfAddress1 = new FormOfAddress();
|
FormOfAddress formOfAddress1 = new FormOfAddress();
|
||||||
|
@ -48,9 +46,6 @@ public class DefaultValueLoader implements CommandLineRunner {
|
||||||
FormOfAddress formOfAddress2 = new FormOfAddress();
|
FormOfAddress formOfAddress2 = new FormOfAddress();
|
||||||
formOfAddress2.setDescription("Frau");
|
formOfAddress2.setDescription("Frau");
|
||||||
|
|
||||||
FormOfAddress formOfAddress3 = new FormOfAddress();
|
|
||||||
formOfAddress3.setDescription("Einkaufstüte");
|
|
||||||
|
|
||||||
formOfAddress1 = formOfAddressRepository.save(formOfAddress1);
|
formOfAddress1 = formOfAddressRepository.save(formOfAddress1);
|
||||||
formOfAddress2 = formOfAddressRepository.save(formOfAddress2);
|
formOfAddress2 = formOfAddressRepository.save(formOfAddress2);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.maradona.backend.controllers.page;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for routing to the error pages.
|
||||||
|
*
|
||||||
|
* List of endpoints:
|
||||||
|
* - GET /error/400
|
||||||
|
* - GET /error/404
|
||||||
|
* - GET /error/500
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/error")
|
||||||
|
public class ErrorPage {
|
||||||
|
/**
|
||||||
|
* Error page for 400 Bad Request.
|
||||||
|
*
|
||||||
|
* This page is displayed when the request is malformed and the server cannot
|
||||||
|
* process it.
|
||||||
|
*
|
||||||
|
* @return The 400 error page template.
|
||||||
|
*/
|
||||||
|
@GetMapping("/400")
|
||||||
|
public String error400() {
|
||||||
|
return "pages/error/400";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error page for 404 Not Found.
|
||||||
|
*
|
||||||
|
* This page is displayed when the requested resource could not be found on the
|
||||||
|
* server. This can be due to a wrong URL or a deleted resource. The user should
|
||||||
|
* be informed that the resource is not available.
|
||||||
|
*
|
||||||
|
* @return The 404 error page template.
|
||||||
|
*/
|
||||||
|
@GetMapping("/404")
|
||||||
|
public String error404() {
|
||||||
|
return "pages/error/404";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error page for 500 Internal Server Error.
|
||||||
|
*
|
||||||
|
* This page is displayed when the server encountered an unexpected condition
|
||||||
|
* that prevented it from fulfilling the request. The user should be informed
|
||||||
|
* that the server is experiencing problems and the request cannot be processed.
|
||||||
|
*
|
||||||
|
* @return The 500 error page template.
|
||||||
|
*/
|
||||||
|
@GetMapping("/500")
|
||||||
|
public String error500() {
|
||||||
|
return "pages/error/500";
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,24 +4,53 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for routing to the core pages.
|
||||||
|
*
|
||||||
|
* List of endpoints:
|
||||||
|
* - GET /
|
||||||
|
* - GET /impressum
|
||||||
|
* - GET /datenschutz
|
||||||
|
* - GET /notes
|
||||||
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class Page {
|
public class Page {
|
||||||
|
/**
|
||||||
|
* Returns the home page.
|
||||||
|
*
|
||||||
|
* @param model The model with the data to be displayed.
|
||||||
|
* @return The home page template.
|
||||||
|
*/
|
||||||
@GetMapping({ "/", "" })
|
@GetMapping({ "/", "" })
|
||||||
public String home(Model model) {
|
public String home(Model model) {
|
||||||
return "pages/core/home";
|
return "pages/core/home";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the impressum page.
|
||||||
|
*
|
||||||
|
* @return The impressum page template.
|
||||||
|
*/
|
||||||
@GetMapping("/impressum")
|
@GetMapping("/impressum")
|
||||||
public String impressum() {
|
public String impressum() {
|
||||||
return "pages/core/impressum";
|
return "pages/core/impressum";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the datenschutz page.
|
||||||
|
*
|
||||||
|
* @return The datenschutz page template.
|
||||||
|
*/
|
||||||
@GetMapping("/datenschutz")
|
@GetMapping("/datenschutz")
|
||||||
public String datenschutz() {
|
public String datenschutz() {
|
||||||
return "pages/core/datenschutz";
|
return "pages/core/datenschutz";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the notes page.
|
||||||
|
*
|
||||||
|
* @return The notes page template.
|
||||||
|
*/
|
||||||
@GetMapping("/notes")
|
@GetMapping("/notes")
|
||||||
public String notes() {
|
public String notes() {
|
||||||
return "pages/core/notes";
|
return "pages/core/notes";
|
||||||
|
|
|
@ -52,7 +52,11 @@ public class SkillsPage {
|
||||||
*/
|
*/
|
||||||
@GetMapping({ "/", "" })
|
@GetMapping({ "/", "" })
|
||||||
public String profile(Model model) {
|
public String profile(Model model) {
|
||||||
model.addAttribute("employee", employeeDetails.getEmployeeByEid(user).orElse(null));
|
var employee = employeeDetails.getEmployeeByEid(user).orElse(null);
|
||||||
|
if (employee == null) {
|
||||||
|
return "/404";
|
||||||
|
}
|
||||||
|
model.addAttribute("employee", employee);
|
||||||
model.addAttribute("skills", skillService.getUserSkills(user));
|
model.addAttribute("skills", skillService.getUserSkills(user));
|
||||||
return "/pages/skills/overview";
|
return "/pages/skills/overview";
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class Employee {
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "FID", referencedColumnName = "fid")
|
@JoinColumn(name = "fid")
|
||||||
private FormOfAddress formOfAddress;
|
private FormOfAddress formOfAddress;
|
||||||
|
|
||||||
private LocalTime dStart;
|
private LocalTime dStart;
|
||||||
|
|
Loading…
Reference in New Issue