NetrunnerDB / netrunnerdb-api-server

API Server for NetrunnerDB
Apache License 2.0
5 stars 5 forks source link

Reviews Endpoint Initial Scaffold #296

Closed talha-ahsan closed 4 months ago

talha-ahsan commented 4 months ago

General usage: GET /api/v3/public/reviews?filter[card_id]=419_amoral_scammer

Main features here:

  1. Migrations and Tables / Models for reviews, review comments, and review votes.
  2. A rake task that migrates reviews from NRDBc to the API
  3. Automatic conversion of reviews and comments to utilize markdown instead of HTML (this may require some more work on symbols, but it's a start while we figure out stuff related to reviews)

Things to still work on:

General expected output using 419:

{
  "data": [
    {
      "id": "2598",
      "type": "reviews",
      "attributes": {
        "username": "tiedyedvortex",
        "body": "So, first off, the flavor on this card is killer. The alias used by this runner is a reference to one of the oldest and most pervasive cons in the history of the Internet...the [Nigerian Prince scam.](https://en.wikipedia.org/wiki/Advance-fee\\_scam) That's right. We have a Nigerian criminal hacker who is, in essence, calling himself \\*the\\* Nigerian prince. Sick. Mechanically, the base of his card is pretty boring. 45/15 deck limits, nothing fancy. He gets 1 to start with, which makes it easier to use cloud breakers or [Security Nexus](/en/card/09047), if that is what you want. Nothing interesting to talk about. So let's move on to his ability. The first time each turn the Corp installs something each turn, they have a choice; pay 1, or expose it to you. Now, historically, pure expose effects haven't seen much play. [Infiltration](/en/card/01049) managed to survive the core set revision, which is strange, given how rarely it was used. No one ever uses the expose option on [Deuces Wild](/en/card/11008). [Lemuria Codecracker](/en/card/01023) was a joke. But this is a little disappointing because, in the game of bluffs and calls that Netrunner should be, knowing the difference between a [Wall of Static](/en/card/01113) and a [Neural Katana](/en/card/01077) is a big deal. Early game, when you don't have icebreakers, ramming a Wall is a cheap way to cost the corp some credits...but hitting a Katana without a killer means, at best, losing tempo to redraw the lost cards, and at worst you lose a key rig piece or die outright. There was also a consistency issue. Late game, expose effects are not greatly useful; the board state is well established, you have your breakers. It's mostly only useful in giving you a way to dodge a [Project Junebug](/en/card/01069) bluff in their scoring remote, which many corp decks don't even use. So you don't want to put in too many expose cards. But putting in only a couple expose cards means not having them reliably when you need them early on. But, 419 changes that. Now, expose isn't a thing you have to add to your deck. It's something you get by default, the whole game, at no cost, repeatedly. That is a terrifying amount of information. Knowing every trap the corp has laid down, knowing every ICE the corp has played, lets you make the perfect move every time. So the Corp is going to want to stop you. And they can do this in two ways. First, they can install multiple cards in a turn. This is only somewhat effective, though; spending an entire turn to install only gives them 2 \"invisible\" cards and wreaks havoc on a lot of gameplans. The other way is for them to spend 1. That doesn't seem that bad, does it? Here's the thing though. Doing that every turn absolutely kills a corp's economy. Remember the old [HB core identity](/en/card/01054)? It was easily the strongest ID in the faction because it generated so much freaking cash. So, inversely, losing 1 credit each turn you install makes a corp broke...which is exactly where Criminals want corps to be. So, your corp can't just give out free information every turn, and they also can't afford to pay up every turn. So you need to prioritize. Give out some information, and keep the important stuff secret. Oh, but then you've just told 419 what stuff is important. After all, you wouldn't pay to prevent exposing a simple [PAD Campaign](/en/card/01109) or a [Pop-up Window](/en/card/02056). So if you're hiding it, it must be valuable...or dangerous. So far, though, I've just been describing a vanilla Criminal deck run in 419 instead of, say, [Silhouette](/en/card/05030) or [Nero Severn](/en/card/10040). Where this gets bonkers is in the combos and support they added. [Aumakua](/en/card/12104) becomes an insane AI breaker--with the amount of exposing you do, and the opportunity to bounce off un-iced remote assets, you can quickly get it to 3 or 4 strength, and cruise through low-strength ice until they purge. [Falsified Credentials](/en/card/21064) becomes another three [Sure Gamble](/en/card/01050)s that can be played from 1 credit. [Blackguard](/en/card/04085) is okay, but is not as good as 419's own console [Zamba](/en/card/21003), which is a respectable 4 for 2...and makes it so the corp has to choose between paying, and letting you get paid AND see their stuff AND buff Aumakua. But you'll notice that while these abilities are all really strong, the combo pieces are all very simple, and there aren't that many of them. 419 has so much room to build his deck. He's strong, but versatile. Hail to the Prince.\n\n",
        "card": "419: Amoral Scammer",
        "card_id": "419_amoral_scammer",
        "created_at": "2018-06-14T18:51:54+00:00",
        "updated_at": "2024-04-23T01:25:09+00:00",
        "votes": 13,
        "comments": [
          {
            "id": 6458,
            "body": "I used to think that the devs always kept the power level of Expose weak so that the bluffing element of the game would remain intact. Then 419 got printed... Of course there are still bluffs but the credit drain is brutal. I would make a big note of Corporate Grant which doubles down on the credit denial that 419 loves so much.\n\n",
            "user": "BlackCherries",
            "created_at": "2018-06-14T19:17:37.000Z",
            "updated_at": "2018-06-14T19:17:37.000Z"
          },
          {
            "id": 6459,
            "body": "Blackguard is, unfortunately, rotated.\n\n",
            "user": "psi_lifeup",
            "created_at": "2018-06-19T01:32:42.000Z",
            "updated_at": "2018-06-19T01:32:42.000Z"
          },
          {
            "id": 6460,
            "body": "VERY good catch there.\n\n",
            "user": "H0tl1ne",
            "created_at": "2018-06-25T05:12:54.000Z",
            "updated_at": "2018-06-25T05:12:54.000Z"
          },
          {
            "id": 6461,
            "body": "And then the flavor text... Good God, I gotta revisit my former opinion regarding this cycle.\n\n",
            "user": "H0tl1ne",
            "created_at": "2018-06-25T05:13:41.000Z",
            "updated_at": "2018-06-25T05:13:41.000Z"
          },
          {
            "id": 6462,
            "body": "Counterplay to this guy:\n\n",
            "user": "HolyMackerel",
            "created_at": "2018-07-03T14:21:39.000Z",
            "updated_at": "2018-07-03T14:21:39.000Z"
          },
          {
            "id": 6463,
            "body": "Psychic Field & It's a Trap! with the former being very splashable at 1 inf.\n\n",
            "user": "BlackCherries",
            "created_at": "2018-07-03T14:36:41.000Z",
            "updated_at": "2018-07-03T14:36:41.000Z"
          },
          {
            "id": 6464,
            "body": "Even besides random tech, the Corp controls which order their card gets exposed. If they don't have their Zamba out, let an upgrade or an asset be exposed that you were going to rez right away anyways. Otherwise, don't cheap out against 419.\n\n",
            "user": "BlackCherries",
            "created_at": "2018-07-03T14:39:22.000Z",
            "updated_at": "2018-07-03T14:39:22.000Z"
          },
          {
            "id": 6465,
            "body": "Psychic Field. Decline to pay 1, force the Expose, psi game for their whole hand.\n\n",
            "user": "HolyMackerel",
            "created_at": "2018-07-03T14:44:33.000Z",
            "updated_at": "2018-07-03T14:44:33.000Z"
          },
          {
            "id": 6466,
            "body": "With [Psychic Field](/en/card/05010) and [It's a Trap!](/en/card/08090) gone, what are we left with to fight 419?\n\n",
            "user": "Davidmc7",
            "created_at": "2021-05-03T02:23:21.000Z",
            "updated_at": "2021-05-03T02:23:21.000Z"
          },
          {
            "id": 6467,
            "body": "@Davidmc7: 419 normally doesn't run [Zamba](/en/card/21003) nowadays, so virus hate works pretty well; if you can shut down the [Aumakua](/en/card/12104) then you can normally just let 419 expose things (and rez your assets early to play around [Falsified Credentials](/en/card/21064)). So 419 is generally beatable without specific tech cards other than virus hate (which also hates on a number of other IDs), as long as you're capable of beating Criminal in general. Nonetheless, he's definitely one of the better Criminals, though.\n\n",
            "user": "callforjudgement",
            "created_at": "2021-05-03T05:53:00.000Z",
            "updated_at": "2021-05-03T05:53:00.000Z"
          }
        ]
      },
      "relationships": {
        "card": {
          "links": {
            "related": "http://localhost:3000/api/v3/public/cards/419_amoral_scammer"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/v3/public/reviews/2598"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/v3/public/reviews?filter%5Bcard_id%5D=419_amoral_scammer&page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://localhost:3000/api/v3/public/reviews?filter%5Bcard_id%5D=419_amoral_scammer&page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "last": "http://localhost:3000/api/v3/public/reviews?filter%5Bcard_id%5D=419_amoral_scammer&page%5Bnumber%5D=1&page%5Bsize%5D=20"
  },
  "meta": {}
}
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.21%. Comparing base (48c2b76) to head (662b565). Report is 6 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #296 +/- ## ========================================== + Coverage 98.16% 98.21% +0.05% ========================================== Files 74 79 +5 Lines 1256 1292 +36 Branches 159 159 ========================================== + Hits 1233 1269 +36 Misses 23 23 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.