Add skeleton implementation to all models
This commit is contained in:
parent
f5f311ca7b
commit
e317e33245
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class AuditLog implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "auditLog";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<AuditLog>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), AuditLog::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<AuditLog>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), AuditLog::new, callback);
|
||||
}
|
||||
|
||||
private AuditLog(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class EmailTemplate implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "emailTemplate";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<EmailTemplate>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), EmailTemplate::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<EmailTemplate>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), EmailTemplate::new, callback);
|
||||
}
|
||||
|
||||
private EmailTemplate(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class Grant implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "grant";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<Grant>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), Grant::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<Grant>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), Grant::new, callback);
|
||||
}
|
||||
|
||||
private Grant(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class IPBan implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "ipBan";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<IPBan>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), IPBan::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<IPBan>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), IPBan::new, callback);
|
||||
}
|
||||
|
||||
private IPBan(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class IPLog implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "ipLog";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<IPLog>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), IPLog::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<IPLog>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), IPLog::new, callback);
|
||||
}
|
||||
|
||||
private IPLog(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class MaxMindCache implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "maxMindCache";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<MaxMindCache>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), MaxMindCache::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<MaxMindCache>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), MaxMindCache::new, callback);
|
||||
}
|
||||
|
||||
private MaxMindCache(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class NotificationLog implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "notificationLog";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<NotificationLog>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), NotificationLog::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<NotificationLog>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), NotificationLog::new, callback);
|
||||
}
|
||||
|
||||
private NotificationLog(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class Punishment implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "punishment";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<Punishment>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), Punishment::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<Punishment>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), Punishment::new, callback);
|
||||
}
|
||||
|
||||
private Punishment(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -6,12 +6,13 @@ import io.vertx.core.json.JsonArray;
|
||||
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.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@ToString(exclude={ "secret" })
|
||||
public final class Server implements LiteFullJson {
|
||||
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class ServerGroup implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "serverGroup";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<ServerGroup>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), ServerGroup::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<ServerGroup>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), ServerGroup::new, callback);
|
||||
}
|
||||
|
||||
private ServerGroup(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,48 @@
|
||||
package net.frozenorb.apiv3.collections;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.frozenorb.apiv3.LiteFullJson;
|
||||
import net.frozenorb.apiv3.utils.MongoUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ToString
|
||||
public final class User implements LiteFullJson {
|
||||
|
||||
public static final String COLLECTION_NAME = "user";
|
||||
|
||||
@Getter private String id;
|
||||
|
||||
public static void findAll(Handler<AsyncResult<List<User>>> callback) {
|
||||
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), User::new, callback);
|
||||
}
|
||||
|
||||
public static void findById(String id, Handler<AsyncResult<User>> callback) {
|
||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), User::new, callback);
|
||||
}
|
||||
|
||||
private User(JsonObject json) {
|
||||
this.id = json.getString("_id");
|
||||
}
|
||||
|
||||
public JsonObject toLiteJson() {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
json.put("_id", id);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public JsonObject toFullJson() {
|
||||
JsonObject json = toLiteJson();
|
||||
|
||||
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user