feat: final request finally works. This commit message is unprofessional. But this whole project is unprofessional so kinda whatever. Gimme 3 pls
This commit is contained in:
parent
1896f2582c
commit
2f7dbbc788
@ -0,0 +1,27 @@
|
||||
package com.example.prapro2spring.controller;
|
||||
|
||||
import com.example.prapro2spring.model.HumanLogs;
|
||||
import com.example.prapro2spring.service.HumanLogsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/humanlogs")
|
||||
public class HumanLogsController {
|
||||
|
||||
@Autowired
|
||||
private HumanLogsService HumanLogsService;
|
||||
|
||||
|
||||
@GetMapping("/")
|
||||
public List<HumanLogs> getAllPeopleValues() {
|
||||
return HumanLogsService.findAll();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public HumanLogs HumanLogsService(@PathVariable Integer id){
|
||||
return HumanLogsService.findById(id);
|
||||
}
|
||||
}
|
@ -14,10 +14,10 @@ public class ActivityLogDTO {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "activityId")
|
||||
@Column(name = "activity_id")
|
||||
private Integer activityId;
|
||||
|
||||
@Column(name = "humanId")
|
||||
@Column(name = "human_id")
|
||||
private Integer personId;
|
||||
|
||||
@Column(name = "start_timestamp")
|
||||
|
@ -14,10 +14,10 @@ public class OccupationLogDTO {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "occupationId")
|
||||
@Column(name = "occupation_id")
|
||||
private Integer occupationId;
|
||||
|
||||
@Column(name = "humanId")
|
||||
@Column(name = "human_id")
|
||||
private Integer personId;
|
||||
|
||||
@Column(name = "start_timestamp")
|
||||
|
@ -13,11 +13,11 @@ public class ActivityLog {
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "activityId")
|
||||
@JoinColumn(name = "activity_id")
|
||||
private Activity activity;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "humanId")
|
||||
@JoinColumn(name = "human_id")
|
||||
private Person person;
|
||||
|
||||
@Column(name = "start_timestamp")
|
||||
|
@ -1,69 +0,0 @@
|
||||
package com.example.prapro2spring.model;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class FullPerson {
|
||||
private Integer id;
|
||||
private Person parent1;
|
||||
private Person parent2;
|
||||
private java.time.LocalDateTime birthTimestamp;
|
||||
private ActivityLog[] activityLog;
|
||||
private OccupationLog[] occupationLog;
|
||||
|
||||
public FullPerson(Integer id, Person parent1, Person parent2, java.time.LocalDateTime birthTimestamp, ActivityLog[] activityLog, OccupationLog[] occupationLog) {
|
||||
this.id = id;
|
||||
this.parent1 = parent1;
|
||||
this.parent2 = parent2;
|
||||
this.birthTimestamp = birthTimestamp;
|
||||
this.activityLog = activityLog;
|
||||
this.occupationLog = occupationLog;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Person getParent1() {
|
||||
return parent1;
|
||||
}
|
||||
|
||||
public void setParent1(Person parent1) {
|
||||
this.parent1 = parent1;
|
||||
}
|
||||
|
||||
public Person getParent2() {
|
||||
return parent2;
|
||||
}
|
||||
|
||||
public void setParent2(Person parent2) {
|
||||
this.parent2 = parent2;
|
||||
}
|
||||
|
||||
public LocalDateTime getBirthTimestamp() {
|
||||
return birthTimestamp;
|
||||
}
|
||||
|
||||
public void setBirthTimestamp(LocalDateTime birthTimestamp) {
|
||||
this.birthTimestamp = birthTimestamp;
|
||||
}
|
||||
|
||||
public ActivityLog[] getActivityLog() {
|
||||
return activityLog;
|
||||
}
|
||||
|
||||
public void setActivityLog(ActivityLog[] activityLog) {
|
||||
this.activityLog = activityLog;
|
||||
}
|
||||
|
||||
public OccupationLog[] getOccupationLog() {
|
||||
return occupationLog;
|
||||
}
|
||||
|
||||
public void setOccupationLog(OccupationLog[] occupationLog) {
|
||||
this.occupationLog = occupationLog;
|
||||
}
|
||||
}
|
51
src/main/java/com/example/prapro2spring/model/HumanLogs.java
Normal file
51
src/main/java/com/example/prapro2spring/model/HumanLogs.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.example.prapro2spring.model;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "human_logs")
|
||||
public class HumanLogs {
|
||||
@Id
|
||||
private Integer humanid;
|
||||
@Column(name = "activity_log")
|
||||
private String activityLog;
|
||||
@Column(name = "occupation_log")
|
||||
private String occupationLog;
|
||||
|
||||
public HumanLogs(Integer id, String activityLog, String occupationLog) {
|
||||
this.humanid = id;
|
||||
this.activityLog = activityLog;
|
||||
this.occupationLog = occupationLog;
|
||||
}
|
||||
|
||||
public HumanLogs() {
|
||||
|
||||
}
|
||||
|
||||
public Integer getHumanid() {
|
||||
return humanid;
|
||||
}
|
||||
|
||||
public void setHumanid(Integer id) {
|
||||
this.humanid = id;
|
||||
}
|
||||
|
||||
public String getActivityLog() {
|
||||
return activityLog;
|
||||
}
|
||||
|
||||
public void setActivityLog(String activityLog) {
|
||||
this.activityLog = activityLog;
|
||||
}
|
||||
|
||||
public String getOccupationLog() {
|
||||
return occupationLog;
|
||||
}
|
||||
|
||||
public void setOccupationLog(String occupationLog) {
|
||||
this.occupationLog = occupationLog;
|
||||
}
|
||||
}
|
@ -13,11 +13,11 @@ public class OccupationLog {
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "occupationId")
|
||||
@JoinColumn(name = "occupation_id")
|
||||
private Occupation occupation;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "humanId")
|
||||
@JoinColumn(name = "human_id")
|
||||
private Person person;
|
||||
|
||||
@Column(name = "start_timestamp")
|
||||
|
@ -0,0 +1,7 @@
|
||||
package com.example.prapro2spring.repository;
|
||||
|
||||
import com.example.prapro2spring.model.HumanLogs;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface HumanLogsRepository extends JpaRepository<HumanLogs, Integer> {
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.example.prapro2spring.service;
|
||||
|
||||
import com.example.prapro2spring.model.HumanLogs;
|
||||
import com.example.prapro2spring.repository.HumanLogsRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class HumanLogsService {
|
||||
@Autowired
|
||||
HumanLogsRepository humanLogsRepository;
|
||||
|
||||
public List<HumanLogs>
|
||||
findAll(){
|
||||
return humanLogsRepository.findAll();
|
||||
}
|
||||
|
||||
public HumanLogs findById(Integer id){
|
||||
return humanLogsRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user