Plex/server/src/main/java/dev/plex/punishment/extra/Note.java

27 lines
645 B
Java
Raw Normal View History

2022-04-07 00:38:15 +00:00
package dev.plex.punishment.extra;
import com.google.gson.GsonBuilder;
2022-04-07 07:37:31 +00:00
import dev.morphia.annotations.Entity;
2023-03-08 11:45:47 +00:00
import dev.plex.util.adapter.ZonedDateTimeAdapter;
2023-03-08 20:26:10 +00:00
import lombok.Data;
import java.time.ZonedDateTime;
2022-04-07 00:38:15 +00:00
import java.util.UUID;
@Data
2022-04-07 07:37:31 +00:00
@Entity
2022-04-07 00:38:15 +00:00
public class Note
{
private final UUID uuid;
private final String note;
private final UUID writtenBy;
private final ZonedDateTime timestamp;
2022-04-07 00:38:15 +00:00
2022-04-07 02:05:29 +00:00
private int id; // This will be automatically set from addNote
2022-04-07 00:38:15 +00:00
public String toJSON()
{
2023-03-08 11:45:47 +00:00
return new GsonBuilder().registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeAdapter()).create().toJson(this);
2022-04-07 00:38:15 +00:00
}
}