Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 87 additions & 6 deletions controller/BootstrapController.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ func BootstrapTeamData(w http.ResponseWriter, r *http.Request) {
w.Write(teamData)
}

func FirstBootstrapFootballData(w http.ResponseWriter, r *http.Request) {
func BootstrapLandingData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
collegeID := vars["collegeID"]
proID := vars["proID"]
data := managers.GetFirstBootstrapData(collegeID, proID)
data := managers.GetLandingBootstrap(collegeID, proID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
Expand All @@ -35,12 +35,12 @@ func FirstBootstrapFootballData(w http.ResponseWriter, r *http.Request) {
w.Write(bootstrapData)
}

func SecondBootstrapFootballData(w http.ResponseWriter, r *http.Request) {
func BootstrapTeamRosterData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
collegeID := vars["collegeID"]
proID := vars["proID"]
data := managers.GetSecondBootstrapData(collegeID, proID)
data := managers.GetTeamRosterBootstrap(collegeID, proID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
Expand All @@ -49,12 +49,93 @@ func SecondBootstrapFootballData(w http.ResponseWriter, r *http.Request) {
w.Write(bootstrapData)
}

func ThirdBootstrapFootballData(w http.ResponseWriter, r *http.Request) {
func BootstrapRecruitingData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
collegeID := vars["collegeID"]
data := managers.GetRecruitingBootstrap(collegeID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}
w.Write(bootstrapData)
}

func BootstrapFreeAgencyData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
proID := vars["proID"]
data := managers.GetFreeAgencyBootstrap(proID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}
w.Write(bootstrapData)
}

func BootstrapSchedulingData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
username := vars["username"]
collegeID := vars["collegeID"]
seasonID := vars["seasonID"]
data := managers.GetCollegePollsBootstrap(username, collegeID, seasonID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}
w.Write(bootstrapData)
}

func BootstrapDraftData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
proID := vars["proID"]
data := managers.GetDraftBootstrap(proID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}
w.Write(bootstrapData)
}

func BootstrapPortalData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
collegeID := vars["collegeID"]
data := managers.GetPortalBootstrap(collegeID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}
w.Write(bootstrapData)
}

func BootstrapGameplanData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
collegeID := vars["collegeID"]
proID := vars["proID"]
data := managers.GetGameplanBootstrap(collegeID, proID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}
w.Write(bootstrapData)
}

func BootstrapNewsData(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
collegeID := vars["collegeID"]
proID := vars["proID"]
data := managers.GetThirdBootstrapData(collegeID, proID)
data := managers.GetNewsBootstrap(collegeID, proID)
bootstrapData, err := easyjson.Marshal(data)
if err != nil {
log.Printf("Failed to encode JSON response: %v", err)
Expand Down
8 changes: 8 additions & 0 deletions controller/FaceDataController.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package controller

import (
"encoding/json"
"fmt"
"net/http"

Expand All @@ -17,3 +18,10 @@ func MigrateFaceData(w http.ResponseWriter, r *http.Request) {
fmt.Println("All Faces have been generated")
w.WriteHeader(http.StatusOK)
}

func GetAllFaces(w http.ResponseWriter, r *http.Request) {
faceData := managers.GetAllFaces()

fmt.Println("Face data retrieved")
json.NewEncoder(w).Encode(faceData)
}
2 changes: 1 addition & 1 deletion controller/NewsController.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func GetNewsLogs(w http.ResponseWriter, r *http.Request) {
}

func GetAllNewsLogsForASeason(w http.ResponseWriter, r *http.Request) {
newsLogs := managers.GetAllNewsLogs()
newsLogs := managers.GetAllCFBNewsLogs()
json.NewEncoder(w).Encode(newsLogs)
}

Expand Down
13 changes: 10 additions & 3 deletions controller/TSController.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,16 @@ func FireItUp(w http.ResponseWriter, r *http.Request) {

func CreateTSModelsFile(w http.ResponseWriter, r *http.Request) {
converter := typescriptify.New().
Add(managers.BootstrapData{}).
Add(managers.BootstrapDataTwo{}).
Add(managers.BootstrapDataThree{}).
Add(managers.BootstrapDataTeams{}).
Add(managers.BootstrapDataLanding{}).
Add(managers.BootstrapDataTeamRoster{}).
Add(managers.BootstrapDataRecruiting{}).
Add(managers.BootstrapDataFreeAgency{}).
Add(managers.BootstrapDataScheduling{}).
Add(managers.BootstrapDataDraft{}).
Add(managers.BootstrapDataPortal{}).
Add(managers.BootstrapDataGameplan{}).
Add(managers.BootstrapDataNews{}).
Add(managers.CollegeTeamProfileData{}).
Add(structs.SearchStatsResponse{}).
Add(structs.FaceDataResponse{}).
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/mailru/easyjson v0.9.0
github.com/nelkinda/health-go v0.0.1
github.com/robfig/cron/v3 v3.0.1
github.com/victorspringer/http-cache v0.0.0-20240523143319-7d9f48f8ab91
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
golang.org/x/text v0.14.0
gorm.io/driver/mysql v1.5.2
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,14 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tkrajina/go-reflector v0.5.5 h1:gwoQFNye30Kk7NrExj8zm3zFtrGPqOkzFMLuQZg1DtQ=
github.com/tkrajina/go-reflector v0.5.5/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
github.com/tkrajina/typescriptify-golang-structs v0.2.0 h1:ZedWk82egydDspGTryAatbX0/1NZDQbdiZLoCbOk4f8=
github.com/tkrajina/typescriptify-golang-structs v0.2.0/go.mod h1:sjU00nti/PMEOZb07KljFlR+lJ+RotsC0GBQMv9EKls=
github.com/victorspringer/http-cache v0.0.0-20240523143319-7d9f48f8ab91 h1:b5+IzGwYrH3TnHjjUdMdM/4BCefs1pn4JWO4n/zYmMk=
github.com/victorspringer/http-cache v0.0.0-20240523143319-7d9f48f8ab91/go.mod h1:D1AD6nlXv7HkIfTVd8ZWK1KQEiXYNy/LbLkx8H9tIQw=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE=
Expand Down
Loading