Coder Social home page Coder Social logo

judge-em-api's Introduction

Hi there ๐Ÿ‘‹

My GitHub stats

judge-em-api's People

Contributors

bboysokol avatar herringthecoder avatar reszczyk avatar

Stargazers

 avatar  avatar

judge-em-api's Issues

Setting up testing

We should set up a project for testing (preferably with xUnit) and integrate it with some simple CI like Github Actions

Connecting to the game room

  • User should be able to connect to the game room using pre-generated unique code and register to the broadcast group associated with the room.
  • User should be able to add or remove items before the game has started
  • User should be notified of other players joining

Assigning users to the game

Users should be assigned to game not only by temporary membership, but also by a relationship, i.e. by intermediate "Players" table (id, nickname, user_id, game_id)

Refactoring entity-response mapping

Response models should be independent of database entities, so there need to be some intermediate classes (maybe extensions?) mapping models to responses.
Automapper would be another solution, but I have to test whether it's necessary to bring reflection-heavy mechanism here.

Authorization module

Client should be able to authorize using JWT tokens provided by API

Logging into system should be possible in two ways:

  1. Using Facebook/Google
  • On valid authorization if no associated email (provided by fb/google) was found in database, then it should be automatically registered.
  1. Using temporary Guest token
    -Maybe guest does not need to be stored in database? (TBD)

On valid authorization, the API should response with token containing encoded user data and assigned custom roles.
Example role names:

  • AuthorizedUser
  • Guest
  • Master

Note: when issuing a token, it might be useful to provide standard Role Claim using built-in ClaimTypes
https://docs.microsoft.com/en-us/dotnet/api/system.security.claims.claimtypes.role?view=netcore-3.1
It will simplify role-based authorization on Controllers and Hubs.
All necessary services should be placed in Authorization project.

Creating database schema

Database should contain following entities (with proposed field implementation):

  • User (id, email, nick, name, providerId, providerName)
  • Game (id, name, code, masterId, startedAt, finishedAt)
  • Summary (gameId, data)
  • Rating (id, score, itemid, userId, categoryId)
  • Category (id, name, weight)
  • Item (id, name, description, imageLink, gameId)

Schema should be implemented by model-first approach in Storage project using Entity Framework Core.

Game summary

  • Each game should end with generating a summary of a game.
    The summary should be cached in database and linked to a game room and pushed to the users.
    Sample idea of summary response:
{
   "room_name":"someName",
   "items":[
      {
         "name":"someItemName",
         "meanRating":"meanRatingValueForItem",
         "ratings":[
            {
               "userName1":"ratingValue1"
            },
            {
               "userName2":"ratingValue2"
            }
         ]
      }
   ]
}

Initiating project

Solution should be pushed to 'dev' branch containing at least 4 projects:

  • API (gate with hubs and controllers and configured HostBuilder)
  • Storage (storing database context, entities)
  • Core (containing business logic i.e. Services, Repositiories, Interfaces)
  • Authorization (separated library for handling authorization logic)

Note: Registering DI should be preferably self-contained (via ServiceCollectionExtension)

Nullable Datetime

By the current service logic, the DateTime fields on Games table should be nullable.

Arranging game room

  • Registered user should be able to create a game room resulting in unique code generation and him becoming current game master.
    The connection to game rooms should be WebSocket based, preferably using SignalR Hubs.

Adding Hub Filters

.NET 5.0 Hub filters can simplify Hub methods code by checking gameId and returning early errors to clients if game was not found or is not active.

Game flow

  • Game master should be able to change the current reviewed item for all players
  • Players should be able to place a vote on the currently reviewed item
  • Players should be able to see how many players have already voted

Swagger

Swagger should be implemented as api auto documentation

Adding more tests

We should:

  • Cover existing services with unit tests
  • Create SignalR Hubs integration tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.