Skip to content

Commit

Permalink
Merge pull request #409 from AllieJonsson/fix/user-activity
Browse files Browse the repository at this point in the history
add schema for user activity
  • Loading branch information
ornicar authored Jan 15, 2025
2 parents ed04b2d + 4ed9992 commit 652549e
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 3 deletions.
203 changes: 203 additions & 0 deletions doc/specs/schemas/UserActivity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
type: object

properties:
interval:
type: object
required:
- start
- end
properties:
start:
type: number
end:
type: number
games:
type: object
properties:
chess960:
$ref: './UserActivityScore.yaml'
atomic:
$ref: './UserActivityScore.yaml'
racingKings:
$ref: './UserActivityScore.yaml'
ultraBullet:
$ref: './UserActivityScore.yaml'
blitz:
$ref: './UserActivityScore.yaml'
kingOfTheHill:
$ref: './UserActivityScore.yaml'
bullet:
$ref: './UserActivityScore.yaml'
correspondence:
$ref: './UserActivityScore.yaml'
horde:
$ref: './UserActivityScore.yaml'
puzzle:
$ref: './UserActivityScore.yaml'
classical:
$ref: './UserActivityScore.yaml'
rapid:
$ref: './UserActivityScore.yaml'

puzzles:
type: object
properties:
score:
$ref: './UserActivityScore.yaml'

storm:
type: object
properties:
runs:
type: number
score:
type: number
racer:
type: object
properties:
runs:
type: number
score:
type: number
streak:
type: object
properties:
runs:
type: number
score:
type: number
tournaments:
type: object
properties:
nb:
type: number
best:
type: array
items:
type: object
required:
- tournament
- nbGames
- score
- rank
- rankPercent
properties:
tournament:
type: object
required:
- id
- name
properties:
id:
type: string
name:
type: string
nbGames:
type: number
score:
type: number
rank:
type: number
rankPercent:
type: number
practice:
type: array
items:
type: object
required:
- url
- name
- nbPositions
properties:
url:
type: string
name:
type: string
nbPositions:
type: number
simuls:
type: array
items:
type: string
correspondenceMoves:
type: object
required:
- nb
- games
properties:
nb:
type: number
games:
type: array
items:
$ref: './UserActivityCorrespondenceGame.yaml'
correspondenceEnds:
type: object
required:
- score
- games
properties:
score:
$ref: './UserActivityScore.yaml'
games:
type: array
items:
$ref: './UserActivityCorrespondenceGame.yaml'
follows:
type: object
properties:
in:
$ref: './UserActivityFollowList.yaml'
out:
$ref: './UserActivityFollowList.yaml'
studies:
type: object
teams:
type: array
items:
type: object
required:
- url
- name
properties:
url:
type: string
name:
type: string
posts:
type: array
items:
type: object
required:
- topicUrl
- topicName
- posts
properties:
topicUrl:
type: string
topicName:
type: string
posts:
type: array
items:
type: object
required:
- url
- text
properties:
url:
type: string
text:
type: string
patron:
type: object
required:
- months
properties:
months:
type: number
stream:
type: boolean

required:
- interval
40 changes: 40 additions & 0 deletions doc/specs/schemas/UserActivityCorrespondenceGame.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
type: object

properties:
id:
type: string
color:
type: string
enum: ['white', 'black']
url:
type: string
variant:
$ref: './VariantKey.yaml'
speed:
type: string
const: correspondence
perf:
type: string
const: correspondence
rated:
type: boolean
opponent:
type: object
required:
- user
- rating
properties:
user:
type: string
rating:
type: number

required:
- id
- color
- url
- variant
- speed
- perf
- rated
- opponent
12 changes: 12 additions & 0 deletions doc/specs/schemas/UserActivityFollowList.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: object

properties:
ids:
type: array
items:
type: string
nb:
type: number

required:
- ids
22 changes: 22 additions & 0 deletions doc/specs/schemas/UserActivityScore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
type: object

properties:
win:
type: number
loss:
type: number
draw:
type: number
rp:
type: object
properties:
before:
type: number
after:
type: number

required:
- win
- loss
- draw
- rp
7 changes: 4 additions & 3 deletions doc/specs/tags/users/api-user-username-activity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ get:
type: string
required: true
responses:
"200":
'200':
description: The activity feed of the user.
headers:
Access-Control-Allow-Origin:
Expand All @@ -22,5 +22,6 @@ get:
default: "'*'"
content:
application/json:
example:
https://gist.github.com/ornicar/0ee2d2427cb74ed1a35e86f5ba09fabc
schema:
$ref: '../../schemas/UserActivity.yaml'
example: 'https://gist.github.com/ornicar/0ee2d2427cb74ed1a35e86f5ba09fabc'

0 comments on commit 652549e

Please sign in to comment.