From 8c52d4ada1e7aa380df0f1fbc30b505369a524f0 Mon Sep 17 00:00:00 2001 From: Michael Brennan Date: Thu, 20 Jun 2024 17:25:16 -0400 Subject: [PATCH] fix ci issues --- backend/entities/clubs/base/service.go | 20 ++++++++++++++++++-- backend/entities/events/base/service.go | 18 ++++++++++++++++-- backend/search/base/transactions.go | 6 +++--- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/backend/entities/clubs/base/service.go b/backend/entities/clubs/base/service.go index 82a1c0c1..4197e2d2 100644 --- a/backend/entities/clubs/base/service.go +++ b/backend/entities/clubs/base/service.go @@ -1,6 +1,8 @@ package base import ( + "log/slog" + "github.com/GenerateNU/sac/backend/entities/clubs" "github.com/GenerateNU/sac/backend/entities/models" "github.com/GenerateNU/sac/backend/errs" @@ -46,7 +48,14 @@ func (c *ClubService) CreateClub(userID uuid.UUID, clubBody CreateClubRequestBod return nil, err } - go search.UpsertClubEmbedding(c.DB, c.Search, result) + go func() { + err := search.UpsertClubEmbedding(c.DB, c.Search, result) + + if err != nil { + slog.Error("Upsert club embedding failed") + } + }() + return result, err } @@ -83,7 +92,14 @@ func (c *ClubService) UpdateClub(id string, clubBody UpdateClubRequestBody) (*mo return nil, err } - go search.UpsertClubEmbedding(c.DB, c.Search, result) + go func() { + err := search.UpsertClubEmbedding(c.DB, c.Search, result) + + if err != nil { + slog.Error("Upsert club embedding failed") + } + }() + return UpdateClub(c.DB, *idAsUUID, *club) } diff --git a/backend/entities/events/base/service.go b/backend/entities/events/base/service.go index 9d5a3305..78e3c47a 100644 --- a/backend/entities/events/base/service.go +++ b/backend/entities/events/base/service.go @@ -2,6 +2,7 @@ package base import ( "errors" + "log/slog" "github.com/GenerateNU/sac/backend/entities/events" "github.com/GenerateNU/sac/backend/entities/models" @@ -71,7 +72,13 @@ func (e *EventService) CreateEvent(body events.CreateEventRequestBody) (*models. return nil, err } - go search.UpsertEventEmbedding(e.DB, e.Search, result) + go func() { + err := search.UpsertEventEmbedding(e.DB, e.Search, result) + + if err != nil { + slog.Error("Upsert club embedding failed") + } + }() return result, err } @@ -95,7 +102,14 @@ func (e *EventService) UpdateEvent(eventID string, eventBody events.UpdateEventR return nil, err } - go search.UpsertEventEmbedding(e.DB, e.Search, &result[0]) + go func() { + err := search.UpsertEventEmbedding(e.DB, e.Search, &result[0]) + + if err != nil { + slog.Error("Upsert club embedding failed") + } + }() + return result, err } diff --git a/backend/search/base/transactions.go b/backend/search/base/transactions.go index 2532d08f..b95eccbe 100644 --- a/backend/search/base/transactions.go +++ b/backend/search/base/transactions.go @@ -12,15 +12,15 @@ import ( "gorm.io/gorm" ) -// Use this over strings.join so elements can be single quoted if nessecary. -func joinQuoted(elems []string, seperator string) string { +// Use this over strings.join so elements can be single quoted if necessary. +func joinQuoted(elems []string, separator string) string { elemsQuoted := make([]string, len(elems)) for i, elem := range elems { elemsQuoted[i] = fmt.Sprintf("'%s'", elem) } - return strings.Join(elemsQuoted, seperator) + return strings.Join(elemsQuoted, separator) } func SearchClubs(db *gorm.DB, s *config.SearchSettings, query *types.ClubSearchRequest) (*types.SearchResult[models.Club], error) {