Skip to content

Commit

Permalink
fixed issue with build
Browse files Browse the repository at this point in the history
  • Loading branch information
joshghent committed Oct 8, 2024
1 parent 16a0a35 commit 32e14dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ test:
.PHONY: loadtest
loadtest:
go run loadtest/main.go

.PHONY: build
build:
go build -o main .
15 changes: 15 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"encoding/csv"
"fmt"
"log"
"net/http"
Expand Down Expand Up @@ -213,3 +214,17 @@ func uploadCodesHandler(c *gin.Context) {

c.JSON(200, gin.H{"message": "Codes uploaded successfully"})
}

// Used to check if the CSV contains the required columns
func containsColumns(headers []string, requiredColumns []string) bool {
headerSet := make(map[string]bool)
for _, h := range headers {
headerSet[h] = true
}
for _, rc := range requiredColumns {
if !headerSet[rc] {
return false
}
}
return true
}

0 comments on commit 32e14dc

Please sign in to comment.