Git Product home page Git Product logo

fullstack-developer-task-'s Introduction

Documentation

To Test This

Type yarn to install all the required dependency

Fighters Table

CREATE TABLE fighters (
  fighter_id SERIAL PRIMARY KEY,
  first_name VARCHAR(255) NOT NULL,
  last_name VARCHAR(255) NOT NULL,
  nationality VARCHAR(255) NOT NULL,
  weight_class VARCHAR(255) NOT NULL,
  team VARCHAR(255),
  wins INTEGER DEFAULT 0,
  losses INTEGER DEFAULT 0,
  knockouts INTEGER DEFAULT 0,
  submissions INTEGER DEFAULT 0
);

Events Table

CREATE TABLE events (
  event_id SERIAL PRIMARY KEY,
  event_name VARCHAR(255) NOT NULL,
  location VARCHAR(255) NOT NULL,
  date TIMESTAMP NOT NULL
);

Fights Table

CREATE TABLE fights (
  fight_id SERIAL PRIMARY KEY,
  event_id INTEGER REFERENCES events(event_id),
  fighter1_id INTEGER REFERENCES fighters(fighter_id),
  fighter2_id INTEGER REFERENCES fighters(fighter_id),
  winner_id INTEGER REFERENCES fighters(fighter_id),
  outcome_description TEXT NOT NULL
);

Entity Relations

Fighter Entity (Table: fighters)

Attributes: fighter_id, first_name, last_name, nationality, weight_class, team, wins, losses, knockouts, submissions Relationships: One-to-Many with Fight Entity (fights_as_fighter1 and fights_as_fighter2)

Event Entity (Table: events)

Attributes: event_id, event_name, location, date Relationships: One-to-Many with Fight Entity (fights)

Fight Entity (Table: fights)

Attributes: fight_id, event_id, fighter1_id, fighter2_id, winner_id, outcome_description Relationships: Many-to-One with Event Entity (event) Many-to-One with Fighter Entity (fighter1 and fighter2) Many-to-One with Fighter Entity (winner)

Ranking Entity (Table: rankings)

Attributes: ranking_id, weight_class, fighter_id, rank Relationships: Many-to-One with Fighter Entity (fighter)

Architecture Diagram

Diagram

API Documentation

Fighters API

Get All Fighters Retrieve a list of all fighters.

Create Fighter

Create a new fighter.

Endpoint: POST /fighters

Request Body:

{
  "first_name": "John",
  "last_name": "Doe",
  "nationality": "US",
  "weight_class": "Middleweight",
  "team": "Team A",
  "wins": 10,
  "losses": 5,
  "knockouts": 3,
  "submissions": 2
}

Response:

{
  "fighter_id": 1,
  "first_name": "John",
  "last_name": "Doe",
  "nationality": "US",
  "weight_class": "Middleweight",
  "team": "Team A",
  "wins": 10,
  "losses": 5,
  "knockouts": 3,
  "submissions": 2
}

Endpoint: GET /fighters

Response:

[
  {
    "fighter_id": 1,
    "first_name": "John",
    "last_name": "Doe",
    "nationality": "US",
    "weight_class": "Middleweight",
    "team": "Team A",
    "wins": 10,
    "losses": 5,
    "knockouts": 3,
    "submissions": 2
  }
]

Get Fighter Details Retrieve details of a specific fighter.

Endpoint: GET /fighters/:id

Response:

{
  "fighter_id": 1,
  "first_name": "John",
  "last_name": "Doe",
  "nationality": "US",
  "weight_class": "Middleweight",
  "team": "Team A",
  "wins": 10,
  "losses": 5,
  "knockouts": 3,
  "submissions": 2
}
Events API Get Upcoming Events Retrieve a list of upcoming events. Endpoint: GET /events/upcoming
Response:
[
  {
    "event_id": 1,
    "event_name": "UFC Fight Night",
    "location": "Las Vegas, NV",
    "date": "2023-08-30T18:00:00.000Z"
  },
]

Create Event Create a new event.

Endpoint: POST /events

Request Body:

{
  "event_name": "UFC Fight Night",
  "location": "Las Vegas, NV",
  "date": "2023-08-30T18:00:00Z"
}

Response:

{
  "event_id": 1,
  "event_name": "UFC Fight Night",
  "location": "Las Vegas, NV",
  "date": "2023-08-30T18:00:00.000Z"
}

fullstack-developer-task-'s People

Contributors

vishnu5104 avatar

Watchers

 avatar

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.