Giter Site home page Giter Site logo

hvzcasebackend's Introduction

HvZCase Backend

This repository handles the backend for a game called "Human vs Zombies", which is a more involved version of Tag, in which zombies try to catch humans and humans do their best to survive. Players are able to create squads together and chat together.

How to run

To run this locally, you need to have SSMS installed, you need to have a Pusher account and Channel created and you need to have a keycloak service running locally or online. There needs to be two Realm Roles set to access everything, "user" and "admin. Set the connection string to be your local SSMS connection string, and add the Pusher secrets "PUSHER_APP_ID", "PUSHER_APP_KEY", "PUSHER_APP_SECRET" to your local secrets manager. In visual studio 2022, this would be done using the commands cd ./HvZAPI/ dotnet user-secrets "PUSHER_APP_ID" --project "HvZAPI.csproj" dotnet user-secrets "PUSHER_APP_KEY" --project "HvZAPI.csproj" dotnet user-secrets "PUSHER_APP_SECRET" --project "HvZAPI.csproj"

You will also need to set the secrets for your keycloak URIs with dotnet user-secrets "ISSUER_URI" --project "HvZAPI.csproj" dotnet user-secrets "KEY_URI" --project "HvZAPI.csproj"

Once this is done, you can now enter "add-migration Initial" and then "update-database" into the PM console to create the initial database with some seeded data.

How to deploy on Azure.

To deploy on Azure, you will need to create a SQLDatabase on Azure and allow access from Web Apps, for sake of ease also add your own local client as allowed. Once this has been created, you can get the connection string to your database, and replace the local one in the appsettings.json file with said link. Run the migration commands above again, making sure that your migration folder is currently empty, and then remove your connection string from the appsettings.json file so that it can not be seen in any source control. Make sure to keep the "SERVER_CONNECTION" option in the appsettings.json file, but you can just have it point to an empty string (or to your local Db for testing purposes).

Once this is done, you will need to create a Docker image for your app. Once you've have the docker image, push it to the hub and then you can create a Web App on Azure, picking to build from docker hub image. Link the one you have created, and let it create the Web App. Once you've created the Web App, you'll need to set up the secrets in a similar way as we did locally, but instead of running the commands locally, you'll enter them into your Web App configuration. Enter the connection string under the "Connection Strings" and the other secrets under "Application Settings".

Once this is done, you should have your API up and running. You can check if it works by going to your "/api/v1/game" to see if it returns anything.

Made with

The backend was made using ASP.NET, SSMS, Docker and Azure. Documentation is handled with Swagger.

Made by

Mattias Smedman

Danielle Hamrin

Keman Nguyen

hvzcasebackend's People

Contributors

nirase avatar kemannguyen avatar

Watchers

 avatar

hvzcasebackend's Issues

Squad Repository

Definition of done

Squads can be created, updated and deleted

TODO

  • User can create a squad
  • User can join a squad
  • Squad can be edited [ADMIN ONLY]
  • Squad can be deleted [ADMIN ONLY]

Kill Full CRUD

TODO

  • Update kill [ADMIN ONLY]
  • Delete kill [ADMIN ONLY]
  • Get all kills by game

Add date to game

Definition of done

Game table now contains date

TODO

  • Add date to game table
  • Seed date data

Authorization

TODO

  • Game Authorization
  • Mission Authorization
  • Kill Autorization

Mission Model

Definition of done

Defines a model for a mission object.

TODO

  • mission_id (PK)
  • visible_to_humans
  • visible_to_zombies
  • start_date
  • game_id (FK)
  • end_date
  • location

Player Repository

Definition of done

User can create, update and delete a player.

TODO

  • Create player
  • Update existing player [ADMIN ONLY]
  • Delete existing player [ADMIN ONLY]

Game Repository

Definition of done

User can create, update and delete games

TODO

  • Fetch all games
  • Fetch one specific game [USER ONLY]
  • Create game [ADMIN ONLY]
  • Update existing game [ADMIN ONLY]
  • Delete existing game [ADMIN ONLY]

User Repository

Definition of done

User can be created, updated or deleted.

TODO

  • Create User
  • Update existing user [ADMIN ONLY]
  • Delete existing user [ADMIN ONLY]

Make Kill a subsection of Game

TODO

  • Kill url is instead of format "api/v1/game/<game_id>/kill"
  • Get all kills only fetches from the current game
  • Get kill only fetches from the current game

Models

Definition of done

Models for every MVP table exists.

TODO

  • User
    • user_id (pk)
    • first_name
    • last_name
  • Game
    • game_id (pk)
    • name
    • game_state
  • Player
    • player_id (pk)
    • user_id (fk)
    • game_id (fk)
    • is_patient_zero
    • is_human
    • bite_code
  • Kill
    • kill_id (pk)
    • game_id (fk)
    • killer_id (fk)
    • victim_id (fk)
    • time_of_death

Chat Model

Definition of done

Defines a model for a chat.

TODO

  • Channel (PK)
  • List of messages

Chat Message Repository

Definition of done

Defines a model for a message

TODO

  • message_id (PK)
  • List of messages
  • sender_id (FK)
  • time_of_message

Mission Repository

Definition of done

Missions can be created, updated and deleted

TODO

  • Create mission [ADMIN ONLY]
  • Update mission [ADMIN ONLY]
  • Delete mission [ADMIN ONLY]

Repositories

Definition of done

Repositories with CRUD implemented to interact with all the base database tables exists.

TODO

Database Seeding

Definition of done

Database is created and seeded through C#.

TODO

  • Define database context
  • Seed data into database

Squad Model

Definition of done

Defines a model for a squad object

TODO

  • squad_id
  • squad_name
  • List of members

Chat Repository

Definition of done

Chats can be created, updated or deleted.

TODO

  • Create chat
  • Update chat [ADMIN ONLY]
  • Delete chat [ADMIN ONLY]

Kill Repository

Definition of done

User can add, update or delete kills.

TODO

  • Create kill [ADMIN AND ZOMBIES ONLY]
  • Get all kills
  • Get specific kill

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.