Finish linked ip ban integration

This commit is contained in:
Colin McDonald 2016-06-17 01:13:03 -04:00
parent 26e84251b6
commit dff1e16283

View File

@ -60,6 +60,10 @@ public final class Punishment {
return SyncUtils.blockOne(punishmentsCollection.find(new Document("_id", id))); return SyncUtils.blockOne(punishmentsCollection.find(new Document("_id", id)));
} }
public static Punishment findByLinkedIpBanIdSync(String id) {
return SyncUtils.blockOne(punishmentsCollection.find(new Document("linkedIpBanId", id)));
}
public static List<Punishment> findByUserSync(User user) { public static List<Punishment> findByUserSync(User user) {
return findByUserSync(user.getId()); return findByUserSync(user.getId());
} }
@ -94,6 +98,10 @@ public final class Punishment {
punishmentsCollection.find(new Document("_id", id)).first(callback); punishmentsCollection.find(new Document("_id", id)).first(callback);
} }
public static void findByLinkedIpBanId(String id, SingleResultCallback<Punishment> callback) {
punishmentsCollection.find(new Document("linkedIpBanId", id)).first(callback);
}
public static void findByUser(User user, SingleResultCallback<List<Punishment>> callback) { public static void findByUser(User user, SingleResultCallback<List<Punishment>> callback) {
findByUser(user.getId(), callback); findByUser(user.getId(), callback);
} }
@ -182,7 +190,7 @@ public final class Punishment {
} }
public void linkIpBan(IpBan ipBan) { public void linkIpBan(IpBan ipBan) {
this.linkedIpBanId = ipBan.getId();
} }
public void insert() { public void insert() {