Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 2 additions & 32 deletions backend/TMSFullstackProject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,10 @@
<java.version>18</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -52,25 +32,15 @@
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package br.com.teamroxo.entra21.TMSFullstackProject.List;

import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import br.com.teamroxo.entra21.TMSFullstackProject.template.Pacotes;

@Entity
public class Localizations {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column
private String remetente;

@Column
private String destinatario;

@ManyToOne
public Pacotes pack;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getRemetente() {
return remetente;
}

public void setRemetente(String remetente) {
this.remetente = remetente;
}

public String getDestinatario() {
return destinatario;
}

public void setDestinatario(String destinatario) {
this.destinatario = destinatario;
}

public Pacotes getPack() {
return pack;
}

public void setPack(Pacotes pack) {
this.pack = pack;
}

@Override
public int hashCode() {
return Objects.hash(id);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Localizations other = (Localizations) obj;
return Objects.equals(id, other.id);
}



}
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
package br.com.teamroxo.entra21.TMSFullstackProject.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import br.com.teamroxo.entra21.TMSFullstackProject.database.PacoteDados;
import br.com.teamroxo.entra21.TMSFullstackProject.template.Pacotes;

@RestController
@RequestMapping("/tms")
public class APIController {

@Autowired
private PacoteDados pacoteDados;

@GetMapping(value = "/all")
public List<Pacotes> getAll(){
return pacoteDados.findAll();
}

@PostMapping(value = "/add")
@ResponseStatus(code = HttpStatus.CREATED)
public Pacotes post(@RequestBody Pacotes pacotes) {
return pacoteDados.save(pacotes);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import br.com.teamroxo.entra21.TMSFullstackProject.template.Package;
import br.com.teamroxo.entra21.TMSFullstackProject.template.Pacotes;

@Repository
public interface PacoteDados extends JpaRepository<Package, Long>{
public interface PacoteDados extends JpaRepository<Pacotes, Long>{

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;

import br.com.teamroxo.entra21.TMSFullstackProject.List.Localizations;

@Entity
public class Package {
public class Pacotes {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand All @@ -31,7 +33,7 @@ public class Package {
private LocalDate envio;

@Column
@OneToMany(mappedBy = "pack")
@OneToMany(mappedBy = "pack", targetEntity = Localizations.class)
private List<Localizations> enderecos;

public Long getId() {
Expand Down Expand Up @@ -95,7 +97,7 @@ public boolean equals(Object obj) {
return false;
if (getClass() != obj.getClass())
return false;
Package other = (Package) obj;
Pacotes other = (Pacotes) obj;
return Objects.equals(id, other.id);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

spring.jpa.hibernate.ddl-auto = create-drop
hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
2 changes: 1 addition & 1 deletion frontend/main/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<body [ngClass]="{'hold-transition sidebar-mini':login.succeed}">
<body class="hold-transition sidebar-mini">
<div [ngClass]="{'wrapper':login.succeed}">

<app-body [hidden]="!login.succeed"></app-body>
Expand Down