Add LiteFullJson interface
This commit is contained in:
parent
dccbca98bb
commit
58704fa890
12
src/main/java/net/frozenorb/apiv3/LiteFullJson.java
Normal file
12
src/main/java/net/frozenorb/apiv3/LiteFullJson.java
Normal file
@ -0,0 +1,12 @@
|
||||
package net.frozenorb.apiv3;
|
||||
|
||||
import io.vertx.core.json.JsonObject;
|
||||
|
||||
public interface LiteFullJson {
|
||||
|
||||
JsonObject toLiteJson();
|
||||
default JsonObject toFullJson() {
|
||||
return toLiteJson();
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class AuditLog {
|
||||
public final class AuditLog implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "auditLog";
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class EmailTemplate {
|
||||
public final class EmailTemplate implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "emailTemplate";
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class Grant {
|
||||
public final class Grant implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "grant";
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class IPBan {
|
||||
public final class IPBan implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "ipBan";
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class IPLog {
|
||||
public final class IPLog implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "ipLog";
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class MaxMindCache {
|
||||
public final class MaxMindCache implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "maxMindCache";
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class NotificationLog {
|
||||
public final class NotificationLog implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "notificationLog";
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class Punishment {
|
||||
public final class Punishment implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "punishment";
|
||||
|
||||
|
@ -7,13 +7,14 @@ import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.APIv3;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
@ToString(exclude={ "secret" })
|
||||
public final class Server {
|
||||
public final class Server implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "server";
|
||||
|
||||
@ -55,11 +56,6 @@ public final class Server {
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
this.lastUpdate = Instant.now();
|
||||
APIv3.getMongoClient().update(COLLECTION_NAME, new JsonObject().put("_id", id), MongoUtils.set(new JsonObject().put("lastUpdate", lastUpdate)), res -> {});
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class ServerGroup {
|
||||
public final class ServerGroup implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "serverGroup";
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
|
||||
@ToString
|
||||
public final class User {
|
||||
public final class User implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "user";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user