This repository has been archived on 2020-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
e-commerce/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java

52 lines
1.1 KiB
Java

package org.hso.ecommerce.entities.shop;
import org.hso.ecommerce.entities.user.User;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@Entity
@Table(name = "customer_orders")
public class CustomerOrder {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic
public long id;
@ManyToOne(optional = false)
public User customer;
@Embedded
public Address destination;
@OneToMany(
targetEntity = CustomerOrderPosition.class,
mappedBy = "order", cascade = CascadeType.ALL
)
public List<CustomerOrderPosition> positions = new ArrayList<>();
@NotNull
public java.sql.Timestamp created;
@NotNull
public String trackingId;
@Column(nullable = true)
public java.sql.Timestamp inDeliverySince;
@Column(nullable = true)
public java.sql.Timestamp deliveredAt;
public int totalNetCent;
public int totalGrossCent;
public int totalVatCent;
public String getEstimatedArrival() {
//TODO: get estimated arrival from api
return "TODO TODO TODO";
}
}