diff --git a/lambda/lambda/neonbranch.py b/lambda/lambda/neonbranch.py index ccaaf00..ee6e08b 100644 --- a/lambda/lambda/neonbranch.py +++ b/lambda/lambda/neonbranch.py @@ -36,6 +36,7 @@ def handle(event: dict, context): } winner = row[2] + description = row[3] return { "statusCode": 200, @@ -46,5 +47,6 @@ def handle(event: dict, context): "player_1": player_1, "player_2": player_2, "winner": winner, + "description": description, }), } diff --git a/migrations/src/main/sql/descriptions.down.sql b/migrations/src/main/sql/descriptions.down.sql new file mode 100644 index 0000000..58ecc18 --- /dev/null +++ b/migrations/src/main/sql/descriptions.down.sql @@ -0,0 +1,2 @@ +ALTER TABLE rules +DROP COLUMN description; diff --git a/migrations/src/main/sql/descriptions.up.sql b/migrations/src/main/sql/descriptions.up.sql new file mode 100644 index 0000000..a223882 --- /dev/null +++ b/migrations/src/main/sql/descriptions.up.sql @@ -0,0 +1,30 @@ +ALTER TABLE rules +ADD COLUMN description VARCHAR(32); + +UPDATE rules +SET description = 'It''s a tie' +WHERE player1 = 'rock' AND player2 = 'rock'; +UPDATE rules +SET description = 'Paper covers rock' +WHERE player1 = 'rock' AND player2 = 'paper'; +UPDATE rules +SET description = 'Rock crushes scissors' +WHERE player1 = 'rock' AND player2 = 'scissors'; +UPDATE rules +SET description = 'Paper covers rock' +WHERE player1 = 'paper' AND player2 = 'rock'; +UPDATE rules +SET description = 'It''s a tie' +WHERE player1 = 'paper' AND player2 = 'paper'; +UPDATE rules +SET description = 'Scissors cuts paper' +WHERE player1 = 'paper' AND player2 = 'scissors'; +UPDATE rules +SET description = 'Rock crushes scissors' +WHERE player1 = 'scissors' AND player2 = 'rock'; +UPDATE rules +SET description = 'Scissors cuts paper' +WHERE player1 = 'scissors' AND player2 = 'paper'; +UPDATE rules +SET description = 'It''s a tie' +WHERE player1 = 'scissors' AND player2 = 'scissors';