Ignore:
Timestamp:
05/02/25 00:37:10 (2 weeks ago)
Author:
Aleksandar Panovski <apano77@…>
Branches:
main
Children:
c44c5ed
Parents:
e15e8d9
Message:

Added menu tag

succesfull testing and implemnation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/rezevirajmasa/demo/model/Menu.java

    re15e8d9 r2518b3a  
    66
    77import java.math.BigDecimal;
     8import java.util.ArrayList;
     9import java.util.List;
    810
    911@Entity
     
    1315    @Id
    1416    @GeneratedValue(strategy = GenerationType.IDENTITY)
    15     @Column(name = "MenuID")
     17    @Column(name = "menu_id")
    1618    private Long menuID;
    1719
    1820    @ManyToOne
    19     @JoinColumn(name = "RestaurantID", nullable = false)
     21    @JoinColumn(name = "restaurant_id", nullable = false)
    2022    @JsonIgnore
    2123    private Restaurant restaurant;
    2224
    23     @Column(name = "ItemName", length = 100)
     25    @Column(name = "item_name", length = 100)
    2426    private String itemName;
    2527
    26     @Column(name = "Category", length = 50)
     28    @Column(name = "category", length = 50)
    2729    private String category;
    2830
    29     @Column(name = "Price", precision = 8, scale = 2)
     31    @Column(name = "price", precision = 8, scale = 2)
    3032    private BigDecimal price;
    3133
    32     @Column(name = "Description")
     34    @Column(name = "description")
    3335    private String description;
    3436
    35     @Column(name = "DietaryInformation", columnDefinition = "JSONB")
    36     private String dietaryInformation;
     37    @OneToMany(mappedBy = "menu", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
     38    private List<MenuTag> tags = new ArrayList<>();
    3739
    3840    public Menu() {
    3941    }
    4042
    41     public Menu(Restaurant restaurant, String itemName, String category, BigDecimal price, String description, String dietaryInformation) {
     43    public Menu(Long menuID, Restaurant restaurant, String itemName, String category, BigDecimal price, String description, List<MenuTag> tags) {
     44        this.menuID = menuID;
    4245        this.restaurant = restaurant;
    4346        this.itemName = itemName;
     
    4548        this.price = price;
    4649        this.description = description;
    47         this.dietaryInformation = dietaryInformation;
     50        this.tags = tags;
    4851    }
    4952}
Note: See TracChangeset for help on using the changeset viewer.