Skip to content

apklinker/FoosballAPI

Repository files navigation

Source Allies Foosball

This project is the backend meant to provide stats for the ball Players here at Source Allies!

The tech used in this project is Node, Express, GraphQL, Postgres, Jest, Sequelize, TypeGQL, Firebase Auth.

Setup

You will need NodeJS and PostgreSQL.

yarn install         # Install needed packages
yarn init:env        # Create a template for the .env file
yarn init:db-config  # Create a template for the database config file
yarn seq db:create   # Create the necessary database for development (ensure postgres is running first)
yarn start:dev       # Start the application in dev mode with live-reload

(Probably Out-of-Date) Database Schema

All types will have the following properties:

  • id: Long
  • createdAt: Long (epoch ms)
  • updatedAt: Long (epoch ms)
  • deletedAt: Long? (epoch ms)

User

  • firstName: String (255 chars)
  • lastName: String (255 chars)
  • name: Virtual String (255 chars)
  • buildingId: LongBuilding.id
  • elos: Elo[]Elo.userId
  • favoriteUsers: User[]FavoriteUser.favoriteUserId

FavoriteUser

  • userId: LongUser.id,
  • favoritedUserId: LongUser.id

Elo

  • finalRanking: Int?
  • value: Int (1000 deafult)
  • matchCount: Int
  • userId: LongUser.id
  • seasonId: LongSeason.id

Season

  • startDate: Long (epoch ms)
  • endDate: Long (epoch ms)
  • number: Int
  • elos: Elo[]Elo.seasonId
  • matches: Match[]Match.seasonId

Building

  • name: String (255 chars)
  • address: String (255 chars)
  • queueId: LongBuildingQueue.id
  • users: User[]User.buildingId
  • tables: Table[]Table.buildingId

Table

  • number: Int?
  • description: String? (255 chars)
  • inUse: boolean
  • isActive: boolean? (from sensor)
  • buildingId: LongBuilding.id
  • homeColorId: LongColor.id
  • awayColorId: LongColor.id

Match

  • startedAt: Long? (epoch ms)
  • finishedAt: Long? (epoch ms)
  • homeScore: Int?
  • awayScore: Int?
  • statusId: LongMatchStatus.id
  • typeId: LongMatchType.id
  • seasonId: LongSeason.id
  • tableId: LongTable.id
  • players: MatchPlayer[]MatchPlater.matchId

MatchPlayer

  • isHome: Boolean
  • isAway: Virtual Boolean
  • userId: LongUser.id
  • matchId: LongMatch.id

MatchStatus

  • display: 'Not Started'|'In Progress'|'Finished' (255 chars)
  • matches: Match[]Match.statusId

MatchType

  • value: 'One v One'|'Doubles' (255 chars)
  • matches: Match[]Match.typeId
  • queueGroups: QueueGroup[]queueGroup.matchTypePrefId

Color

  • hex: Int (hex to int)
  • name: String (255 chars)
  • homeTables: Table[]Table.homeColorId
  • awayTables: Table[]Table.awayColorId

BuildingQueue

  • buildingId: LongBuilding.id
  • groups: QueueGroup[]QueueGroup.queueId

QueueGroup

  • joinedAt: Long (epoch ms)
  • matchTypePrefId: LongMatchType.id
  • queueId: LongBuildingQueue.id
  • players: QueuePlayer[]QueuePlayer.groupId

QueuePlayer

  • userId: LongUser.id
  • groupId: LongQueueGroup.id

About

Api to track and schedule foosball matches

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •