Skip to content

Commit

Permalink
refactor(lint): fixed lint errors
Browse files Browse the repository at this point in the history
fixed some minor grammar and magic number errors
  • Loading branch information
drewfugate committed Mar 5, 2024
1 parent 9b3a53e commit dff31d7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.22
- uses: golangci/golangci-lint-action@v3
test:
runs-on: ubuntu-latest
Expand All @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.22
- run: go test -v ./...
release:
runs-on: ubuntu-latest
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.22
- uses: go-semantic-release/action@v1
with:
hooks: goreleaser
Expand Down
16 changes: 13 additions & 3 deletions application/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ func (a *App) Start(ctx context.Context) error {
}

// Connect to the database
dbHost, dbPort, dbUser, dbPassword, dbName, dbSSLMode := os.Getenv("DB_HOST"), os.Getenv("DB_PORT"), os.Getenv("DB_USER"), os.Getenv("DB_PASSWORD"), os.Getenv("DB_NAME"), os.Getenv("DB_SSLMODE")
dbHost := os.Getenv("DB_HOST")
dbPort := os.Getenv("DB_PORT")
dbUser := os.Getenv("DB_USER")
dbPassword := os.Getenv("DB_PASSWORD")
dbName := os.Getenv("DB_NAME")
dbSSLMode := os.Getenv("DB_SSLMODE")

dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s sslmode=%s", dbHost, dbUser, dbPassword, dbName, dbSSLMode)
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
Expand All @@ -66,8 +72,12 @@ func (a *App) Start(ctx context.Context) error {
if err != nil {
log.Fatal(err)
}
if err := m.Up(); err != nil && err != migrate.ErrNoChange {
log.Fatal(err)
if err := m.Up(); err != nil {
if err.Error() == "no change" {
log.Println("No migration to run")
} else {
log.Fatal(err)
}
}

// Channel to signal server startup
Expand Down
9 changes: 5 additions & 4 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ func (c *CLI) CreateMeetingFromCLI() {
{HostName: "Host 2"},
}

meetingDuration := 60
// New Meeting to be created
newMeeting := &model.Meetings{
CandidateId: 2,
CandidateID: 2,
Calendar: "Example Calendar",
Duration: 60,
Title: "Example Session",
Description: "Discuss the future of NeverL8",
HasBotGuest: false,
StartTime: time.Now(),
EndTime: time.Now().Add(time.Minute * 60),
EndTime: time.Now().Add(time.Minute * time.Duration(meetingDuration)),
}

// Create Meeting and Hosts
Expand All @@ -54,8 +55,8 @@ func (c *CLI) GetAllMeetingsFromCLI() {
}

fmt.Println("Meetings:")
for i, meeting := range meetings {
fmt.Printf("%d. %s\n", i+1, meeting.Title)
for i := range meetings {
fmt.Printf("%d. %s\n", i+1, meetings[i].Title)
}
}

Expand Down
10 changes: 5 additions & 5 deletions controller/meeting_controller.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package meeting_controller
package meetingcontroller

import (
"github.com/rise8-us/neverl8/service"
)

type MeetingController struct {
MeetingService *service.MeetingService
type meetingController struct {
meetingService *service.MeetingService
}

func NewMeetingController(MeetingService *service.MeetingService) *MeetingController {
return &MeetingController{MeetingService}
func NewMeetingController(meetingService *service.MeetingService) *meetingController {
return &meetingController{meetingService}
}

//TODO: Add controller methods for HTTP requests
10 changes: 5 additions & 5 deletions model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

type Meetings struct {
ID uint `json:"id" gorm:"primaryKey"`
CandidateId uint `json:"candidate_id" gorm:"type:integer; not null"`
CandidateID uint `json:"candidate_id" gorm:"type:integer; not null"`
Calendar string `json:"calendar" gorm:"type:varchar(255); not null"`
Duration int `json:"duration" gorm:"type:integer; not null"`
Title string `json:"title" gorm:"type:varchar(255); not null"`
Expand All @@ -28,7 +28,7 @@ type Hosts struct {

type Candidates struct {
ID uint `json:"id" gorm:"primaryKey"`
HostId uint `json:"host_id"` //foreign key to hosts
HostID uint `json:"host_id"` // foreign key to hosts
CandidateName string `json:"candidate_name" gorm:"type:varchar(255); not null"`
Role string `json:"role" gorm:"type:varchar(255); default: unknown role"`
Email string `json:"email" gorm:"type:varchar(255); default: unknown email"`
Expand All @@ -38,14 +38,14 @@ type Candidates struct {

// Referential table connecting hosts to meetings. Hosts can have several meetings scheduled, and meetings can have several hosts.
type HostMeetings struct {
HostId uint `json:"host_id" gorm:"primaryKey; autoIncrement:false; not null"`
MeetingId uint `json:"meeting_id" gorm:"primaryKey; autoIncrement:false; not null"`
HostID uint `json:"host_id" gorm:"primaryKey; autoIncrement:false; not null"`
MeetingID uint `json:"meeting_id" gorm:"primaryKey; autoIncrement:false; not null"`
}

// Referential table connecting hosts to time preferences. Hosts can have several time preferences.
type TimePreferences struct {
ID uint `json:"id" gorm:"primaryKey"`
HostId uint `json:"host_id" gorm:"not null"` // Foreign key to hosts
HostID uint `json:"host_id" gorm:"not null"` // Foreign key to hosts
StartWindow time.Time `json:"start_window" gorm:"type: timestamp with time zone; not null"`
EndWindow time.Time `json:"end_window" gorm:"type: timestamp with time zone; not null"`
}
Binary file removed semantic-release
Binary file not shown.

0 comments on commit dff31d7

Please sign in to comment.