Skip to content

Architecture

James Pretorius edited this page Oct 22, 2023 · 53 revisions

Libraries and Frameworks

  • Frontend
    • React for the frontend framework.
    • Vite for building.
    • npm for package management package management.
  • Backend
    • ASP.NET as the backend framework.
      • NuGet for package management.
      • Database libraries:
        • Microsoft.EntityFrameworkCore.Design
        • Npgsql.EntityFrameworkCore.PostgreSQL
        • Microsoft.EntityFrameworkCore
        • Microsoft.EntityFrameworkCore.Tools
      • Authentication libraries:
        • Microsoft.AspNetCore.Authentication.JwtBearer
        • Microsoft.AspNetCore.Identity.EntityFrameworkCore
        • Microsoft.AspNetCore.Identity
      • Microsoft.AspNetCore.SignalR for chatting with websockets.
    • PostgreSQL for the database.
    • xUnit test for backend unit and end to end testing (after POC).

Deployment

  • The frontend and backend will be deployed to an Azure app service. The Azure app service automatically pulls the latest git commit, builds, and starts the .NET project.
  • Deploying the database will be done by Azure Database for PostgreSQL.

Backend API Endpoints

All are prefixed with /api

/posts

POST /posts

Create a Post.

Request Content:

  • game: GameID
  • scheduledFor: string (dateandtime ISO 8601)
  • description: String
  • tags: [list of Tag IDs]
  • maxPlayers: Number

GET /posts/{id}

Get a Post

Response Body:

  • post: ID
  • creator: UserID
  • game: GameID
  • scheduledFor: string (dateandtime ISO 8601)
  • description: String
  • tags: [list of Tag IDs]
  • users: [list of UserID]
  • maxPlayers: Number
  • chat: ID

DELETE /posts/{id}

Delete a Post

POST /posts/users/

Add a user to a post

Request:

  • User: id

DELETE /posts/users/{id}

Remove a user from a post

/tags

Note: Deleting be done (automatically) by the server, not the client.

POST /tags

Create a Tag

Request Content:

  • name: string

Response Content:

  • id: string
  • name: string

GET /tags/{id}

Get a tag

Response Content:

  • id: string
  • name: string

GET /tags

Query for a tag

Params:

  • query: string (the beggining of a tag, e.g. mi will match mic) Response Content: Response Body:
  • [list of tags]

/games

POST /games

Create a game

Request Content:

  • name: string

Response Content:

  • id: string
  • name: string

GET /games/{id}

Get a game

Response Content:

  • id: string
  • name: string

GET /games

Query for a game

Params:

  • query: string (the beggining of a games, e.g. CS will match CS:GO) Response Body:
  • [list of games]

/user

GET /user/{id}

Get user info

Response Content:

  • username: string
  • age: number
  • bio: string
  • tags: [tags]
  • games: [games]
  • friends: [users]
  • posts: [posts]
  • groups: [groups]

PATCH /user/{id}

Set user info

Requries authentication.

Possible Request Content:

  • age: number
  • bio: string
  • tags: [tags]
  • games: [games]

/accounts

Manage accounts

GET /accounts/auth

Authenticate

Request:

  • username: string
  • password: string

Response:

  • token: string

POST /accounts

Create an account

Request:

  • username: string
  • password: string

Response:

  • id: string
  • username: string

GET /accounts/{id}

Get user account info

Response:

  • id: string
  • username: string

POST /accounts/{id}

Update user account info

Request:

  • password: string

/groups

POST /groups

Create a Group.

Request Content:

  • creator: UserID
  • description: String
  • tags: [list of Tag IDs]

GET /groups/{id}

Get a Group

Response Body:

  • group: ID
  • creator: UserID
  • description: String
  • tags: [list of Tag IDs]
  • users: [list of UserID]
  • chat: ID

DELETE /groups/{id}

Delete a Group

POST /groups/users/

Add a user to a group

Request:

  • user: id

DELETE /groups/users/{id}

Remove a user from a group

/chats

Note: Chat creation done when posts, groups, and players are connected, the client shouldn't be the creator. Similarly, Chat deletion is handled by the server.

POST /chats/{id}/messages

Post a chat message

Request:

  • message: string

GET /chats/{id}/messages

Get a chat messages

Params:

  • limit: int The maximum number of results to return (for pagination)
  • offset: int The index of the first returned result (for pagination)

Response:

  • list of messages with:
    • createdAt: string (dateAndTime)
    • user: ID
    • content: string

/search

For searching posts, users, and groups

/search/posts

Params:

  • (optional) games: comma seperated string E.g. CS:GO,Dota 2
  • (optional) after: string with ISO time
  • (optional) requiredPlayers: num
  • (optional) tags: comma seperated string
  • (optional) text: string
  • sort: comma deliniated string with asc/desc E.g. "time:asc,players:desc"
  • limit: int The maximum number of results to return (for pagination)
  • offset: int The index of the first returned result (for pagination)

Response:

/search/users

Params:

  • (optional) username: string
  • (optional) olderThan: num age
  • (optional) games: comma seperated string E.g. CS:GO,Dota 2
  • (optional) tags: comma seperated string
  • (optional) text: string text in bio
  • sort: comma deliniated string with asc/desc E.g. "time:asc,players:desc"
  • limit: int The maximum number of results to return (for pagination)
  • offset: int The index of the first returned result (for pagination)

Response:

/search/groups

Params:

  • (optional) name: string
  • (optional) games: comma seperated string E.g. CS:GO,Dota 2
  • (optional) minPlayers: num the minimum amount of players in the group
  • (optional) tags: comma seperated string
  • (optional) text: string text in bio
  • sort: comma deliniated string with asc/desc E.g. "time:asc,players:desc"
  • limit: int The maximum number of results to return (for pagination)
  • offset: int The index of the first returned result (for pagination)

Response:

Database

TODO

Frontend

  • The website will be a SPA.
  • TODO views, pages, and urls.
  • TODO need to create profile settings and acc management design to link to URL.

URLS

Views

Design#Create-Page

  • Navigation-bar: Allows user to navigate sections of the website through the clicking of links.
  • Home button: Allows the user to travel to the home page of the website.
  • Discover button: Allows the user to travel to the discover page of the website.
  • Social button: Allows the user to travel to the discover page of the website.
  • Create button: Allows the user to travel to the create page of the website.
  • Create Post button: Allows the user to navigate to the create post section of the create page to create a post.
  • Create Post button label: Informs the user of the purpose of the button.
  • Game (Post Title) Down-Arrow: Allows the user to hide and unhide the Game (Post Title) section.
  • Game (Post Title) label: Used to inform the user of the purpose of the Game (Post Title) textbox.
  • Game (Post Title) textbox: Used to set the title of the post, which is also the game the user wishes to gather people to play. It can also be used to search pre-existing games.
  • Game (Post Title) checkbox: Used to display the selected game to the user, so they can change the chosen game, if necessary.
  • Time Down-Arrow: Allows the user to hide and unhide the Time section.
  • Time label: Used to inform the user of the purpose of the Time radius buttons and Time entry textboxes.
  • Time radius button (Any): Used to display to the user that they wish to play at any unspecified time.
  • Time radius button (Between): Allows the user to select options between two specified times that they desire to play a game.
  • Time checkbox 1: Used to select the start time that the user wishes to begin playing the game.
  • Time 'And' label: Used to assist the user in understanding the start and end times.
  • Time checkbox 2: Used to select the end time that the user wishes to finish playing the game.
  • Communication Down-Arrow: Allows the user to hide and unhide the Communication section.
  • Communication label: Used to inform the user of the purpose of the Communication radius buttons.
  • Communication radius button (Any): Allows the user to select the communication type (Any) required to join the user's Post.
  • Communication radius button (Mic): Allows the user to select the communication type (Mic) required to join the user's Post.
  • Communication radius button (No Mic): Allows the user to select the communication type (No Mic) required to join the user's Post.
  • Hashtags Down-Arrow: Allows the user to hide and unhide the Hashtag section.
  • Hashtags label: Used to inform the user of the purpose of the hashtag section.
  • Hashtags textbox: Allows the user to type in the desired hashtags for their post.
  • Hashtags checkboxes: Allows the user to see the previously selected hashtags for their post.
  • Hashtags Down-Arrow: Allows the user to hide and unhide the Hashtag section.
  • Number of Players Needed Down-Arrow: Allows the user to hide and unhide the Number of Players Needed section.
  • Number of Players Needed label: Used to inform the user of the purpose of the Number of Players Needed section.
  • Number of Players Needed Radius button (Any): Used to display to the user they wish to play with (Any) number of players.
  • Number of Players Needed Radius button (Between): Used to display to the user they wish to play with a number of players (Between) a lowest and highest number of players allowed.
  • Number of Players Needed Textbox 1: Used to select the Lowest number of players that the user wishes to begin playing the game.
  • Number of Players Needed 'And' label: Used to assist the user in understanding the lowest and highest number of players textboxes.
  • Number of Players Needed Textbox 2: Used to select the Highest number of players that the user wishes to begin playing the game.
  • Description Down-Arrow: Allows the user to hide and unhide the Description section.
  • Description label: Used to inform the user of the purpose of the Description section.
  • Description textbox: Allows the user to describe the purpose of the post to other players.
  • Create Button label: Informs the user of the purpose of the button.
  • Create Button: With the specified choices, allows the user to create a post.
  • Clear Button label: Informs the user of the purpose of the button.
  • Clear Button: Sets the choices of the create post section back to default values.

Team Member Roles

TODO

Clone this wiki locally