card lock bei tradingDeal Create
This commit is contained in:
parent
6b8f84a262
commit
3e8003ab50
@ -46,6 +46,7 @@ public class DBConnection {
|
|||||||
* @return true bei erfolg, sonst false
|
* @return true bei erfolg, sonst false
|
||||||
*/
|
*/
|
||||||
public boolean updateCardLock(String name, boolean lock){
|
public boolean updateCardLock(String name, boolean lock){
|
||||||
|
System.out.println("Update user_cards set gesperrt = " + lock + " where name = \'" + name + "\';");
|
||||||
return PostgresHelper.executeUpdate("Update user_cards set gesperrt = " + lock + " where name = \'" + name + "\';");
|
return PostgresHelper.executeUpdate("Update user_cards set gesperrt = " + lock + " where name = \'" + name + "\';");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,17 +286,13 @@ public class Response {
|
|||||||
if (tradingDeal != null) {
|
if (tradingDeal != null) {
|
||||||
String tradingJson = JsonHelper.objToJson(tradingDeal);
|
String tradingJson = JsonHelper.objToJson(tradingDeal);
|
||||||
if (tradingDeal != null) {
|
if (tradingDeal != null) {
|
||||||
//DB Trading deal add
|
|
||||||
// Lock Card for deck
|
|
||||||
//Wenn card im deck, dann del aus deck
|
|
||||||
//new DBConnection().;
|
|
||||||
ArrayList<String> deckCards = new DBConnection().getDeck(username);
|
ArrayList<String> deckCards = new DBConnection().getDeck(username);
|
||||||
if (deckCards != null) {
|
if (deckCards != null) {
|
||||||
if (deckCards.contains(cardtotrade)) {
|
if (deckCards.contains(cardtotrade)) {
|
||||||
new DBConnection().delDeck(username);
|
new DBConnection().delDeck(username);
|
||||||
}
|
}
|
||||||
if(new DBConnection().addTradingdeal(tradingDeal.getUsername(), tradingDeal.getId(), tradingDeal.getRequiredMinDamage(), tradingDeal.getRequiredCardType().name(), tradingDeal.getRequiredElementType().name(), tradingDeal.getCardToTrade().getName())){
|
if(new DBConnection().addTradingdeal(tradingDeal.getUsername(), tradingDeal.getId(), tradingDeal.getRequiredMinDamage(), tradingDeal.getRequiredCardType().name(), tradingDeal.getRequiredElementType().name(), tradingDeal.getCardToTrade().getName())){
|
||||||
if(new DBConnection().updateCardLock(tradingDeal.getUsername(), true)){
|
if(new DBConnection().updateCardLock(tradingDeal.getCardToTrade().getName(), true)){
|
||||||
sendResponse(JsonHelper.objToJson(tradingDeal), "201");
|
sendResponse(JsonHelper.objToJson(tradingDeal), "201");
|
||||||
}else{
|
}else{
|
||||||
sendError("500");
|
sendError("500");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user