mirror of
https://gitlab.com/etc404/software-engineering-project.git
synced 2026-05-10 20:52:58 +00:00
29 lines
733 B
Java
29 lines
733 B
Java
package com.example.database;
|
|
|
|
import jakarta.persistence.*;
|
|
import java.time.LocalDateTime;
|
|
|
|
@Entity
|
|
@Table(name = "favorites")
|
|
public class Favorite {
|
|
|
|
@EmbeddedId
|
|
private FavoriteId id;
|
|
|
|
@Column(name = "created_at")
|
|
private LocalDateTime createdAt;
|
|
|
|
public Favorite() {}
|
|
|
|
public Favorite(Integer userId, Integer recipeId) {
|
|
this.id = new FavoriteId(userId, recipeId);
|
|
this.createdAt = LocalDateTime.now();
|
|
}
|
|
|
|
// Getters and setters
|
|
public FavoriteId getId() { return id; }
|
|
public void setId(FavoriteId id) { this.id = id; }
|
|
|
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
|
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
|
} |