fantasyfootballapi

module
v0.0.0-...-69d31cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0

README

FantasyFootballApi

License

Go API implementation for Fantasy Football Tournament. It use sqlite or postgreSQL to store data, thanks to GORM.

General purpose

The purpose of this REST API is to manage a tournament, its participants, and associated matches.

The previous solution looked like this:

graph LR;
    users([Users])-->front[User Application v1 - JavaScript + Angular]
    front-->api[REST API v1 - PHP + Symfony3]
    orga([Organizer])-->admin[Admin Web Application v1 - PHP + Symfony3]
    api-->db[(Database - MariaDB)]
    admin-->db

The goal is to create a more modular and easily installable solution that looks like this:

graph LR;
    users([Users])-->front[User Application v2- JavaScript + ?]
    front-->api[REST API v2 - Go + gorilla/mux]
    orga([Organizer])-->admin[Admin Web Application v2 - JavaScript + ?]
    admin-->api
    api-->db[(Database - Sqlite or PostgreSQL)]

Repository structure

The project is organized with the aim of managing both web applications and the REST API within a single repository. The structure follows:

  • api: Contains the documentation of the target API, the current API in development, and the list of endpoints utilized by the user application v1.
  • cmd: Includes the command-line application code for initiating the REST API.
  • cover: An empty directory designated for housing test coverage files generated by continuous integration.
  • fridge: Holds the initial implementation's source code, slated for removal.
  • internal: Encompasses internal Go packages utilized by the application:
    • api: Manages the API endpoints.
    • appinfo: Handles the display of the application version.
    • auth: Manages authentication and JWT token issuance.
    • core: Oversees business objects, currently Edition, Coach, and Game.
    • logger: Manages log functionalities.
    • storage: Handles database storage.
  • tools: Contains the script for calculating coverage.

Inspiration for this structure was drawn from the Standard Go Project Layout. Eventually, the web application sources are intended to reside within the web directory.

Packages dependencies

graph TD;
api-->appinfo
api--> logger
api -->storage
api -->mux(gorilla/mux - Library to handle Request and Response HTTP)
api --> core
cmd --> api
cmd -->appinfo
auth-->jwt(drijalva/jwt-go - Library to handle JWT tokens)
storage --> core
storage -->gorm(gorm - ORM)

Status

For now, we have started with REST API and we have implemented

  • editions operations: add, get, get all, get current, update, delete;
  • coachs operations: add, get, get all of edition, update, delete;
  • games operations: add, get, update, delete, get all by edition, round and state (played or not), get all by coach, get all by squad;
  • squads operations: add, get, update, delete, get all by edition ;
  • coach rankings get td, casualties, defense, completions, fouls, main and comeback ;
  • squad rankings get td, casualties, defense, completions and fouls
  • deprecated squad rankings get main and comeback ;
  • squad rankings get main and comeback.

We have tested on previous edition of our tournament.

Opponent points for coach and squad are missing. We need to review current API and target API is in Target API.

Directories

Path Synopsis
FantasyFootballApi Copyright (C) 2019-2020 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
FantasyFootballApi Copyright (C) 2019-2020 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
FantasyFootballApi Copyright (C) 2019-2020 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
FantasyFootballApi Copyright (C) 2019-2020 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
internal
api
FantasyFootballApi Copyright (C) 2019-2023 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
FantasyFootballApi Copyright (C) 2019-2023 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
appinfo
FantasyFootballApi Copyright (C) 2019-2020 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
FantasyFootballApi Copyright (C) 2019-2020 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
core
Package core FantasyFootballApi Copyright (C) 2019-2024 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
Package core FantasyFootballApi Copyright (C) 2019-2024 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
logger
FantasyFootballApi Copyright (C) 2019-2020 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
FantasyFootballApi Copyright (C) 2019-2020 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
storage
Package storage defines storage structures for FantasyFootballApi Copyright (C) 2019-2023 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");
Package storage defines storage structures for FantasyFootballApi Copyright (C) 2019-2023 Bertrand Madet Licensed under the Apache License, Version 2.0 (the "License");

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL