mirror of
https://github.com/nprasad2077/NBA_Go.git
synced 2026-09-22 05:55:13 +00:00
go lint
This commit is contained in:
+3
-3
@@ -1,11 +1,11 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
"github.com/nprasad2077/NBA_Go/models"
|
||||
"github.com/nprasad2077/NBA_Go/utils/metrics"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
)
|
||||
|
||||
func InitDB(shouldMigrate bool) *gorm.DB {
|
||||
|
||||
@@ -47,14 +47,14 @@ func ScrapePlayerAdvancedStats(db *gorm.DB) fiber.Handler {
|
||||
return func(c *fiber.Ctx) error {
|
||||
season := c.QueryInt("season", 0)
|
||||
if season == 0 {
|
||||
return c.Status(400).JSON(fiber.Map{"error":"season is required"})
|
||||
return c.Status(400).JSON(fiber.Map{"error": "season is required"})
|
||||
}
|
||||
isPlayoff := c.QueryBool("isPlayoff", false)
|
||||
|
||||
if err := services.FetchAndStorePlayerAdvancedScrapedStats(db, season, isPlayoff); err != nil {
|
||||
return c.Status(500).JSON(fiber.Map{"error": err.Error()})
|
||||
}
|
||||
return c.JSON(fiber.Map{"message":"scrape+store complete"})
|
||||
return c.JSON(fiber.Map{"message": "scrape+store complete"})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,9 @@ import (
|
||||
// ScrapePlayerShotChart godoc
|
||||
// @Summary Scrape a player's shot-chart from BR website
|
||||
// @Description Scrapes seasons [startSeason…endSeason] for the given playerId
|
||||
//
|
||||
// (playerName is auto-detected).
|
||||
//
|
||||
// @Tags PlayerShotChart
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
|
||||
@@ -14,9 +14,9 @@ package controllers
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/nprasad2077/NBA_Go/models"
|
||||
"github.com/nprasad2077/NBA_Go/services"
|
||||
"gorm.io/gorm"
|
||||
"github.com/nprasad2077/NBA_Go/models"
|
||||
)
|
||||
|
||||
// func FetchPlayerTotalStats(db *gorm.DB) fiber.Handler {
|
||||
@@ -45,18 +45,17 @@ func ScrapePlayerTotalStats(db *gorm.DB) fiber.Handler {
|
||||
return func(c *fiber.Ctx) error {
|
||||
season := c.QueryInt("season", 0)
|
||||
if season == 0 {
|
||||
return c.Status(400).JSON(fiber.Map{"error":"season is required"})
|
||||
return c.Status(400).JSON(fiber.Map{"error": "season is required"})
|
||||
}
|
||||
isPlayoff := c.QueryBool("isPlayoff", false)
|
||||
|
||||
if err := services.FetchAndStorePlayerTotalScrapedStats(db, season, isPlayoff); err != nil {
|
||||
return c.Status(500).JSON(fiber.Map{"error": err.Error()})
|
||||
}
|
||||
return c.JSON(fiber.Map{"message":"scrapestore complete"})
|
||||
return c.JSON(fiber.Map{"message": "scrapestore complete"})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GetPlayerTotalStats godoc
|
||||
// @Security ApiKeyAuth
|
||||
// @Summary Get player total stats
|
||||
|
||||
Reference in New Issue
Block a user