osu-tournament-rating / otr-api

API powering osu! Tournament Rating
https://otr.stagec.xyz/
GNU General Public License v3.0
4 stars 2 forks source link

Add screening API #220

Closed hburn7 closed 2 months ago

hburn7 commented 3 months ago

Adds the screening API as described in #211 (no tests, waiting on #219 before adding them).

Have tested locally, all seems fine. This is a relatively simple feature addition.

Example request:

curl -X 'POST' \
  'http://localhost:5075/api/v1/screening' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "ruleset": 0,
  "minRating": 500,
  "maxRating": 1200,
  "allowProvisional": false,
  "tournamentsPlayed": 3,
  "peakRating": 1600,
  "matchesPlayed": 8,
  "osuPlayerIds": [
    8191845,
    1234,
    12408961,
    7516954
  ]
}'

Example response:

[
  {
    "playerId": 440,
    "username": "Stage",
    "osuPlayerId": 8191845,
    "screeningResult": 0,
    "screeningFailReason": 0,
    "resultMessage": "Pass",
    "failReason": "None"
  },
  {
    "playerId": null,
    "username": null,
    "osuPlayerId": 1234,
    "screeningResult": 1,
    "screeningFailReason": 1,
    "resultMessage": "Fail",
    "failReason": "NoData"
  },
  {
    "playerId": 4285,
    "username": "maliszewski",
    "osuPlayerId": 12408961,
    "screeningResult": 1,
    "screeningFailReason": 36,
    "resultMessage": "Fail",
    "failReason": "MaxRating, PeakRatingTooHigh"
  },
  {
    "playerId": 4649,
    "username": "ZephyrCo",
    "osuPlayerId": 7516954,
    "screeningResult": 1,
    "screeningFailReason": 2,
    "resultMessage": "Fail",
    "failReason": "MinRating"
  }
]
hburn7 commented 3 months ago

Actually, I want to change "failReason" to "failReasonMessage" in the response.

myssto commented 3 months ago

<@146092837723832320>