Allowed outfits to be retagged/updated

This commit is contained in:
Aleksei 2020-07-23 14:22:22 -04:00
parent cf698be97e
commit a53bc60f4b

View File

@ -169,6 +169,16 @@ public class OutfitController {
});
}
public static CompletableFuture<Void> update(Outfit outfit) {
return CompletableFuture.runAsync(() -> {
try {
updateExec(outfit);
} catch (SQLException e) {
throw new CompletionException(e);
}
});
}
public static CompletableFuture<Void> delete(String id) {
return CompletableFuture.runAsync(() -> {
try {
@ -333,6 +343,22 @@ public class OutfitController {
return tags;
}
private static void updateExec(Outfit outfit) throws SQLException {
FSDB.get().query("UPDATE outfits SET " +
"link = ?," +
"submitter = ?," +
"tag = ?," +
"updated = ?," +
"featured = ?," +
"display_count = ?" +
"WHERE id = ?",
outfit.getLink(),
outfit.getSubmitter(),
outfit.getTag(),
outfit.isFeatured(),
outfit.getDisplayCount());
}
private static void deleteExec(String id) throws SQLException {
FSDB.get().query("UPDATE outfits SET deleted = true WHERE id = ?", id);
}