Merge pull request 'feat: Project overview' (#10) from 3002833/Backend:main into main

Reviewed-on: Maradona/Backend#10
pull/1/head
David Hess 2024-10-30 23:13:59 +01:00
commit 6a286f61c8
14 changed files with 296 additions and 13 deletions

Binary file not shown.

View File

@ -0,0 +1,68 @@
2024-10-30 22:31:34.718525+01:00 database: wrong user or password; user: "SA"
org.h2.message.DbException: Wrong user name or password [28000-224]
at org.h2.message.DbException.get(DbException.java:223)
at org.h2.message.DbException.get(DbException.java:199)
at org.h2.message.DbException.get(DbException.java:188)
at org.h2.engine.Engine.openSession(Engine.java:154)
at org.h2.engine.Engine.openSession(Engine.java:222)
at org.h2.engine.Engine.createSession(Engine.java:201)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:125)
at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:288)
at org.h2.server.web.WebServer.getConnection(WebServer.java:811)
at org.h2.server.web.WebApp.login(WebApp.java:1039)
at org.h2.server.web.WebApp.process(WebApp.java:227)
at org.h2.server.web.WebApp.processRequest(WebApp.java:177)
at org.h2.server.web.JakartaWebServlet.doGet(JakartaWebServlet.java:129)
at org.h2.server.web.JakartaWebServlet.doPost(JakartaWebServlet.java:166)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:483)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:384)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:905)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.h2.jdbc.JdbcSQLInvalidAuthorizationSpecException: Wrong user name or password [28000-224]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:522)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
... 50 more
2024-10-30 22:42:13.870413+01:00 jdbc[13]: exception
org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "INSERT INTO PROJECT (DESCRIPTION, END_DATE, NAME, START_DATE, WORKLOAD)[*]"; expected "OVERRIDING USER VALUE, OVERRIDING SYSTEM VALUE, DIRECT, DEFAULT VALUES, VALUES, SET, WITH, (, SELECT, TABLE, VALUES"; SQL statement:
INSERT INTO PROJECT (DESCRIPTION, END_DATE, NAME, START_DATE, WORKLOAD) [42001-224]
2024-10-30 22:42:36.310831+01:00 jdbc[13]: exception
org.h2.jdbc.JdbcSQLDataException: Data conversion error converting "40 (PROJECT: ""START_DATE"" DATE)"; SQL statement:
INSERT INTO PROJECT (DESCRIPTION, END_DATE, NAME, START_DATE, WORKLOAD) VALUES ('Project A', '2024-01-01', '2024-06-30', 40, 'Development of a new software product.') [22018-224]
2024-10-30 22:43:13.608833+01:00 jdbc[13]: exception
org.h2.jdbc.JdbcSQLDataException: Data conversion error converting "40 (PROJECT: ""START_DATE"" DATE)"; SQL statement:
INSERT INTO PROJECT (DESCRIPTION, END_DATE, NAME, START_DATE, WORKLOAD) VALUES ('Project A', '2024-01-01', '2024-06-30', 40, 'Development of a new software product.') [22018-224]
2024-10-30 22:45:07.317598+01:00 jdbc[13]: exception
org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "PRO" not found; SQL statement:
SELECT * FROM PRO [42102-224]

View File

@ -1,14 +1,24 @@
package com.maradona.backend.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import com.maradona.backend.entities.Project;
import com.maradona.backend.services.ProjectService;
@Controller
public class PageController {
@Autowired
private ProjectService projectService;
@GetMapping("/")
public String home(Model model) {
public String index(Model model) {
var projects = projectService.getAllProjects();
model.addAttribute("projects", projects);
return "index";
}
}

View File

@ -29,4 +29,60 @@ public class Employee {
private LocalTime dStart;
private LocalTime dEnd;
public void setEmployeeNr(Integer employeeNr) {
this.employeeNr = employeeNr;
}
public Integer getEmployeeNr() {
return employeeNr;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getFirstName() {
return firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getLastName() {
return lastName;
}
public void setFormOfAddress(FormOfAddress formOfAddress) {
this.formOfAddress = formOfAddress;
}
public FormOfAddress getFormOfAddress() {
return formOfAddress;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getMail() {
return mail;
}
public void setDStart(LocalTime dStart) {
this.dStart = dStart;
}
public LocalTime getDStart() {
return dStart;
}
public void setDEnd(LocalTime dEnd) {
this.dEnd = dEnd;
}
public LocalTime getDEnd() {
return dEnd;
}
}

View File

@ -13,4 +13,20 @@ public class FormOfAddress {
@Column(nullable = false, length = 50)
private String description;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}

View File

@ -16,5 +16,27 @@ public class PrimarySkill {
@OneToMany(mappedBy = "primarySkill", cascade = CascadeType.ALL, orphanRemoval = true)
private List<SecondarySkill> secondarySkills;
// TODO: Getters and Setters
public void setPsid(Long psid) {
this.psid = psid;
}
public Long getPsid() {
return psid;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setSecondarySkills(List<SecondarySkill> secondarySkills) {
this.secondarySkills = secondarySkills;
}
public List<SecondarySkill> getSecondarySkills() {
return secondarySkills;
}
}

View File

@ -22,4 +22,44 @@ public class Project {
@Column(columnDefinition = "TEXT")
private String description;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getStartDate() {
return startDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setWorkload(Integer workload) {
this.workload = workload;
}
public Integer getWorkload() {
return workload;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}

View File

@ -18,4 +18,20 @@ public class ProjectAssignment {
@ManyToOne
@JoinColumn(name = "EID", nullable = false)
private Employee employee;
public void setProject(Project project) {
this.project = project;
}
public Project getProject() {
return project;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public Employee getEmployee() {
return employee;
}
}

View File

@ -16,5 +16,27 @@ public class SecondarySkill {
@JoinColumn(name = "psid", nullable = false)
private PrimarySkill primarySkill;
// Getters and Setters
public void setSsid(Long ssid) {
this.ssid = ssid;
}
public Long getSsid() {
return ssid;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setPrimarySkill(PrimarySkill primarySkill) {
this.primarySkill = primarySkill;
}
public PrimarySkill getPrimarySkill() {
return primarySkill;
}
}

View File

@ -25,4 +25,28 @@ public class SkillAssignment {
@Column(nullable = false)
@Enumerated(EnumType.ORDINAL)
private SkillLevel level;
public void setEmployee(Employee employee) {
this.employee = employee;
}
public Employee getEmployee() {
return employee;
}
public void setSecondarySkill(SecondarySkill secondarySkill) {
this.secondarySkill = secondarySkill;
}
public SecondarySkill getSecondarySkill() {
return secondarySkill;
}
public void setLevel(SkillLevel level) {
this.level = level;
}
public SkillLevel getLevel() {
return level;
}
}

View File

@ -5,7 +5,7 @@ spring:
active: dev # Set 'dev' profile as the active profile for development
datasource:
url: jdbc:h2:mem:testdb
url: jdbc:h2:file:./data/maradona/dbfile # H2 database file path
driver-class-name: org.h2.Driver
username: sa
password: password123

View File

@ -1,5 +1,5 @@
<footer>
<p>&copy INTER Versicherungsgruppe</p>
<a href="Impressumlele">Impressum</a>
<a href="Datenschutzlele">Datenschutz</a>
<a href="Impressumlelele">Impressum</a>
<a href="Datenschutzlelele">Datenschutz</a>
</footer>

View File

@ -5,24 +5,24 @@
<ul>
<li>
<a
th:href="@{/}"
th:classappend="${activePage == 'benutzer' ? 'active' : ''}"
th:href="@{/}"
th:classappend="${activePage == 'benutzer' ? 'active' : ''}"
>
Benutzer
</a>
</li>
<li>
<a
th:href="@{/notizen}"
th:classappend="${activePage == 'notizen' ? 'active' : ''}"
th:href="@{/notizen}"
th:classappend="${activePage == 'notizen' ? 'active' : ''}"
>
Notizen
</a>
</li>
<li>
<a
th:href="@{/service}"
th:classappend="${activePage == 'service' ? 'active' : ''}"
th:href="@{/service}"
th:classappend="${activePage == 'service' ? 'active' : ''}"
>
Service
</a>

View File

@ -6,7 +6,16 @@
</head>
<body>
<div th:replace="~{_header :: header(activePage=${home})}"></div>
<div>
<h2>Projects</h2>
<ul>
<li th:each="project : ${projects}">
<span th:text="${project.name}">Project Name</span> -
<span th:text="${project.startDate}">Start Date</span> to
<span th:text="${project.endDate}">End Date</span>
</li>
</ul>
</div>
<div th:replace="~{_footer :: footer}"></div>
</body>
</html>