Skip to content

Commit 1f569c8

Browse files
committed
refactor: remove logrus error logging from event repository methods
1 parent bf33c66 commit 1f569c8

15 files changed

Lines changed: 0 additions & 30 deletions

app/events/repository/create_event.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (r repository) CreateEvent(ctx context.Context, event domain.Event) (uint, error) {
1110
err := repo.db.DB(ctx).Create(&event).Error
1211
if err != nil {
13-
logrus.Error("failed to create event")
1412
return 0, err
1513
}
1614
return event.ID, nil

app/events/repository/create_event_pay.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (r repository) CreateEventPay(ctx context.Context, event domain.EventPay) (uint, error) {
1110
err := repo.db.DB(ctx).Create(&event).Error
1211
if err != nil {
13-
logrus.Error("failed to create event")
1412
return 0, err
1513
}
1614
return event.ID, nil

app/events/repository/create_event_speaker.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (r repository) CreateEventSpeaker(ctx context.Context, data domain.EventSpeaker) (uint, error) {
1110
err := repo.db.DB(ctx).Create(&data).Error
1211
if err != nil {
13-
logrus.Error("failed to create event tag")
1412
return 0, err
1513
}
1614
return data.ID, nil

app/events/repository/create_event_tag.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (r repository) CreateEventTag(ctx context.Context, data domain.EventTag) (uint, error) {
1110
err := repo.db.DB(ctx).Create(&data).Error
1211
if err != nil {
13-
logrus.Error("failed to create event tag")
1412
return 0, err
1513
}
1614
return data.ID, nil

app/events/repository/create_registration_event.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (r repository) CreateRegistrationEvent(ctx context.Context, event domain.RegistrationEvent) (uint, error) {
1110
err := repo.db.DB(ctx).Create(&event).Error
1211
if err != nil {
13-
logrus.Error("failed to create event")
1412
return 0, err
1513
}
1614
return event.ID, nil

app/events/repository/delete_event.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (r repository) DeleteEvent(ctx context.Context, id uint) error {
1110
err := repo.db.DB(ctx).Model(&domain.Event{}).Delete("id = ?", id).Error
1211
if err != nil {
13-
logrus.Error("failed to delete event")
1412
return err
1513
}
1614
return nil

app/events/repository/get_event.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (repo *repository) GetEvent(ctx context.Context, eventID uint) (data domain.Event, err error) {
1110
db := repo.db.DB(ctx).Model(&domain.Event{})
1211

1312
err = db.Where("id = ?", eventID).Find(&data).Error
1413
if err != nil {
15-
logrus.Error("repo.GetEvents: failed to get events use generic conditions")
1614
return
1715
}
1816

app/events/repository/get_event_pay.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (repo *repository) GetEventPay(ctx context.Context, orderNo string) (data domain.EventPay, err error) {
1110
db := repo.db.DB(ctx).Model(&domain.EventPay{})
1211

1312
err = db.Where("order_no = ?", orderNo).Find(&data).Error
1413
if err != nil {
15-
logrus.Error("failed to get event pay")
1614
return
1715
}
1816

app/events/repository/get_events.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (repo *repository) GetEvents(ctx context.Context, filter domain.EventFilter) (tData int, data []domain.Event, err error) {
@@ -38,7 +37,6 @@ func (repo *repository) GetEvents(ctx context.Context, filter domain.EventFilter
3837
Offset(filter.FilterPagination.GetOffset()).
3938
Preload("Tags").Preload("Speakers").Find(&data).Error
4039
if err != nil {
41-
logrus.Error("repo.GetEvents: failed to get events use generic conditions")
4240
return
4341
}
4442

app/events/repository/get_registration_event.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import (
44
"context"
55

66
"github.com/hammer-code/lms-be/domain"
7-
"github.com/sirupsen/logrus"
87
)
98

109
func (repo *repository) GetRegistrationEvent(ctx context.Context, orderNo string) (data domain.RegistrationEvent, err error) {
1110
db := repo.db.DB(ctx).Model(&domain.RegistrationEvent{})
1211

1312
err = db.Where("order_no = ?", orderNo).Find(&data).Error
1413
if err != nil {
15-
logrus.Error("failed to get registration event use generic conditions")
1614
return
1715
}
1816

0 commit comments

Comments
 (0)