mirror of
https://gitlab.com/etc404/software-engineering-project.git
synced 2026-05-10 20:52:58 +00:00
this thing has the database
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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; }
|
||||
}
|
||||
Reference in New Issue
Block a user