Skip to content

Commit

Permalink
removed nuid + email from update struct
Browse files Browse the repository at this point in the history
  • Loading branch information
DOOduneye committed Mar 5, 2024
1 parent 5dc6027 commit d25ecdd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 6 additions & 6 deletions backend/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func CheckServerRunning(host string, port uint16) error {
return nil
}

func ExitIfError(format string, a ...interface{}) {
func Exit(format string, a ...interface{}) {
fmt.Fprintf(os.Stderr, format, a...)
os.Exit(0)
}
Expand All @@ -37,17 +37,17 @@ func main() {

config, err := config.GetConfiguration(*configPath, *useDevDotEnv)
if err != nil {
ExitIfError("Error getting configuration: %s", err.Error())
Exit("Error getting configuration: %s", err.Error())
}

err = CheckServerRunning(config.Application.Host, config.Application.Port)
if err == nil {
ExitIfError("A server is already running on %s:%d.\n", config.Application.Host, config.Application.Port)
Exit("A server is already running on %s:%d.\n", config.Application.Host, config.Application.Port)
}

db, err := database.ConfigureDB(*config)
if err != nil {
ExitIfError("Error migrating database: %s", err.Error())
Exit("Error migrating database: %s", err.Error())
}

if *onlyMigrate {
Expand All @@ -56,13 +56,13 @@ func main() {

err = database.ConnPooling(db)
if err != nil {
ExitIfError("Error with connection pooling: %s", err.Error())
Exit("Error with connection pooling: %s", err.Error())
}

app := server.Init(db, *config)

err = app.Listen(fmt.Sprintf("%s:%d", config.Application.Host, config.Application.Port))
if err != nil {
ExitIfError("Error starting server: %s", err.Error())
Exit("Error starting server: %s", err.Error())
}
}
2 changes: 0 additions & 2 deletions backend/src/models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ type CreateUserRequestBody struct {
}

type UpdateUserRequestBody struct {
NUID string `json:"nuid" validate:"omitempty,numeric,len=9"`
FirstName string `json:"first_name" validate:"omitempty,max=255"`
LastName string `json:"last_name" validate:"omitempty,max=255"`
Email string `json:"email" validate:"omitempty,email,neu_email,max=255"`
College College `json:"college" validate:"omitempty,oneof=CAMD DMSB KCCS CE BCHS SL CPS CS CSSH"`
Year Year `json:"year" validate:"omitempty,min=1,max=6"`
}
Expand Down

0 comments on commit d25ecdd

Please sign in to comment.