Skip to content

DEPRECATED: MVP Overview

zysim edited this page May 25, 2023 · 1 revision

This is deprecated. A new document will be made.

Note: Every model has an ID field that is an unsigned integer unless specified. No two models of the same type share an ID. All deletions mentioned in this doc is a soft delete unless stated otherwise.

User

Field Type Info
UUID string primary key
Name string unique
Email email unique
Password byte[] salted and hashed password
About text nullable
Admin boolean

A user's name:

  • Must be between 2 and 25 characters, inclusive
  • Must be a sequence of letters, each separated by zero or one of the following: an underscore, a hyphen, or an apostrophe
  • Will be saved with casing, but matched against existing DB entries without

A user's password:

  • Must be between 8 and 80 characters, inclusive
  • Must at least have lowercase and uppercase characters plus numbers
  • Must support Unicode

An unauthenticated user can provide a name, email, password, and password confirmation in order to sign up for a user account. This creates a user record, provided that the input is valid.

An API client can retrieve the name of a user, their about text, and their admin status by ID or by name.

An authenticated user can retrieve their own name, email, about text, and admin status.

An API client can retrieve a list of all the leaderboards that a user moderates by user ID.

An API client can retrieve all of a user's bans by user ID.

A user can update their own about text.

A user can delete their own account, and doing so will remove them from any leaderboards they moderate and delete all of their participations.

Modship

Field Type Info
UserId Guid
LeaderboardId long nullable

A modship determines if a user is a mod for a leaderboard.

A site admin can appoint a user as a moderator to a leaderboard by providing a leaderboard ID and a user ID.

A site admin can unappoint a user as a moderator of a leaderboard by providing a leaderboard ID and a user ID. This deletes the record.

The site owner can appoint a site admin by specifying a user ID and leaving the LeaderboardId field null.

Leaderboard

Field Type Info
Name string
Slug string unique
Rules text

A site admin can create a leaderboard by providing a name and a slug.

An API client can get a list or subset of all leaderboards.

An API client can get a leaderboard's fields by providing a slug or an ID.

An API client can get a list of all users who moderate a given leaderboard by providing an ID.

An API client can get a list of all categories belonging to a specific leaderboard by providing an ID.

A user who moderates a leaderboard can change the rules of that leaderboard by providing a leaderboard ID and a new set of rules.

Ban

Field Type Info
Reason text
Time timestamp auto-generated
BanningUserId user id
BannedUserId user id
Leaderboard leaderboard id nullable

A leaderboard ID of null indicates a site-wide ban.

Many users can be banned from many leaderboards.

A site admin can ban a user by providing a user ID and a reason. Doing so removes the banned user as a mod from any and all leaderboards they may moderate and rejects any and all runs that the banned user has participated in. Site admins can only give site-wide bans. Site admins cannot ban site admins.

A user who moderates a leaderboard can ban a user from that leaderboard by providing a user ID, a leaderboard ID, and a reason. Doing so rejects any and all runs belonging to said leaderboard that the banned user has participated in. Moderators who are not admins cannot give site-wide bans. Moderators cannot ban moderators. Moderators cannot ban admins.

An API client can get a list of all bans, optionally filtered by either leaderboard ID or user ID, or both.

An API client can retrieve the details of a ban by providing an ID.

A site admin can lift a site-wide ban by providing a ban ID, causing the ban to be removed.

A user who moderates a leaderboard can lift a ban on a user banned from that leaderboard by providing a ban ID, causing the ban to be removed.

Category

Field Type Info
Name string
Slug string
Rules text nullable
PlayersMin int lower bound must not be less than one
PlayersMax int upper bound must not be less than lower bound
Leaderboard leaderboard id

A category belongs to one leaderboard.

A user who moderates a leaderboard can create a category for that leaderboard by providing a name, a slug, a min and max player count, a leaderboard ID, and optionally some rules.

An API client can get a category's fields by ID.

An API client can retrieve all of a category's runs by category ID, optionally filtering by any or all of that category's variables. Such a request may give multiple possible values for any variable.

An API client can retrieve all of a category's variables by category ID.

A user who moderates a leaderboard can edit the name, slug, rules, or number of players for any category belonging to that leaderboard by providing a category ID and the info to be updated.

A user who moderates a leaderboard can delete a category belonging to that leaderboard. Doing so deletes every run in that category, and any variables that are assigned only to that category.

Run

Field Type Info
ID GUID Primary key
Played datetime
Submitted timestamp
Status string One of "CREATED", "SUBMITTED", "APPROVED", or "REJECTED"
CategoryID long Foreign key to Categories

Many runs belong to one category.

A run has a status that can be either CREATED, SUBMITTED, APPROVED, or REJECTED. A run with one or more empty participations is CREATED. Otherwise, a run's status is determined by the most recent judgement of said run that has its approved field set to TRUE, indicating APPROVED, or FALSE, indicating REJECTED. If no such judgement exists, the run's status is PENDING.

A user can create a run by providing a date played, a category, a participation for their run (see below), a list of run variables, a list of run metrics, and a list of any other users (by ID) involved in the run, who will be prompted to provide participations of their own. If there is already a run with the same metrics, variables, runners, and category, then neither the run nor the corresponding participation will be created. The number of runners listed, including the user who is submitting, must be within the players range specified by the category the run is being submitted to. If the category specified has any required variables, the corresponding run variables must be present. If the category has any required metrics, corresponding run metrics must be present. Two or more run variables cannot belong to the same variable. Two or more run metrics cannot belong to the same metric. Any and all run variables specified must belong to a variable that is assigned to the category specified. Any and all run metrics specified must belong to a metric that is assigned to the category specified. If there is already a run with the same variables, runners, and category, then the run being submitted must rank higher than the existing run in at least one metric, as specified by the sort direction of the run metric's metric's category as specified.

An API client can retrieve a run's fields and status by ID.

An API client can retrieve a run's participations by run ID.

An API client can retrieve a run's run variables by run ID.

Participation

Field Type Info
Comment text nullable
VOD url nullable
Runner user id
Run run id

Many users can participate in many runs.

Participations can only be created as part of a run submission. When a run with more than one runner is initially submitted, a participation with Comment and VOD set to null, referred to as an empty participation, is created for every runner except the submitter, who is required to provide a valid participation at the time of submission.

A user can edit an edit an empty participation that belongs to them by specifying a comment and a VOD URL.

An API client can get a participation's fields by ID.

Variable

Field Type Info
Name string
Slug string

A variable's slug must be a sequence of 2 to lowercase letters separated by zero or one underscores.

Many variables can be assigned to many categories.

A user who moderates a leaderboard can create a variable and simultaneously assign the variable to one or more categories by providing a name, a slug, two or more variable values, a set of category IDs, and for each category: both a bool specifying whether or not the variable is obsoleting and a bool specifying whether or not the variable is required for the specific category. The categories specified must all belong to the same leaderboard. The user may specify a per-category default value for the variable. This value will be applied to every run in the category specified for said value. For any and all categories for which the variable was marked as required, a per-category default variable value must be specified. Any default variable values specified must also be present in the set of values specified. Default variable values are simply used for initial assignment and are not persisted in the database.

An API Client can get a variable's name and slug by providing an ID.

A user who moderates a leaderboard can change a variable's name and/or slug by providing an ID and the new value(s) to use, provided the variable has been assigned to a category belonging to a leaderboard that said user moderates.

A user who moderates a leaderboard can assign an existing variable to a set of categories by providing a set of category IDs, a variable ID, and for each category: both a bool specifying whether or not the variable is obsoleting and a bool specifying whether or not the variable is required for the specific category. The variable specified must not already be assigned to any categories belonging to any leaderboards other than the leaderboard specified. The user may specify a per-category default value for the variable. This value will be applied to every run in the category specified for said value. For any and all categories for which the variable was marked as required, a per-category default variable value must be specified. Any default variable values specified must also be present in the set of values specified. Default variable values are simply used for initial assignment and are not persisted in the database.

A user who moderates a leaderboard can unassign a variable from a category by specifying a variable ID and one or more category IDs corresponding to categories which the variable specified has been assigned to. Doing so will unassign variable values from every run in the specified category or categories. If the variable specified is no longer assigned to any categories as a result of this operation, the variable is deleted along with its variable values.

A user who moderates a leaderboard can delete a variable by specifying a variable ID, provided the category or categories that the variable is assigned to belong to said leaderboard. Doing so will delete the corresponding variable values and any run variables corresponding to the deleted variable values. This operation is equivalent to unassigning the variable from every category that it is currently assigned to.

Variable Value

Field Type Info
Name string

A variable value belongs to a variable.

A user who moderates a leaderboard can create a new variable value by specifying a name and a variable ID, provided the variable specified is assigned to at least one category that belongs to a leaderboard that the user moderates.

An API client can get a variable value's name by providing an ID.

A user who moderates a leaderboard can edit a variable value's name by providing an ID and the new name.

A user who moderates a leaderboard can delete a variable value by providing an ID, and optionally a different variable value ID belonging to the same variable that will be assigned to any runs that were assigned the first variable value specified, provided that the variable that the first variable value specified belongs to one or more categories belonging to a leaderboard that the user moderates. If the variable that the variable value specified belongs to is marked as required on one or more categories and simultaneously there are one or more runs that have been assigned the variable value specified, the user must provide an alternative variable value that will be assigned to those runs.

Judgement

Field Type Info
Approved bool nullable
Time timestamp generated on save
Note text
Approver GUID
RunId long

Many users judge many runs.

A user who moderates a leaderboard can judge a run belonging to a category belonging to that leaderboard. They must specify a run id, and a note. They may specify a bool denoting whether the run is approved (TRUE) or rejected (FALSE). A moderator cannot judge a run in the CREATED status. A moderator cannot provide an empty note if Approved is set to FALSE or NULL.

An API client can get a judgement's fields by specifying an ID.