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

26 lines
650 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;
2022-05-10 05:08:45 +00:00
import dev.plex.util.adapter.ZonedDateTimeSerializer;
import java.time.ZonedDateTime;
2022-04-07 00:38:15 +00:00
import java.util.UUID;
2022-04-13 02:22:17 +00:00
import lombok.Data;
2022-04-07 00:38:15 +00:00
@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()
{
return new GsonBuilder().registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeSerializer()).create().toJson(this);
2022-04-07 00:38:15 +00:00
}
}