Skip to content

Commit

Permalink
Process locations - in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
petyos committed May 16, 2024
1 parent 54753df commit 57ccf54
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
12 changes: 6 additions & 6 deletions core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ type EventsBBAdapter interface {

// GeoAdapter is used by core to get geo services
type GeoAdapter interface {
ProcessLocation(eventID, calendarName, sponsor, location string) (*model.LegacyLocation, error)
FindLocation(location string) (*model.LegacyLocation, error)
}

// ImageAdapter is used to precess images
type ImageAdapter interface {
ProcessImage(item model.WebToolsEvent) (*model.ContentImagesURL, error)
}

// Storage is used by core to storage data - DB storage adapter, file storage adapter etc
Expand Down Expand Up @@ -197,8 +202,3 @@ type SuccessTeam interface {
GetPrimaryCareProvider(uin string, accesstoken string, conf *model.EnvConfigData) (*[]model.SuccessTeamMember, int, error)
GetAcademicAdvisors(uin string, calendars *[]model.UnitCalendar, accesstoken string, conf *model.EnvConfigData) (*[]model.SuccessTeamMember, int, error)
}

// ImageAdapter is used to precess images
type ImageAdapter interface {
ProcessImage(item model.WebToolsEvent) (*model.ContentImagesURL, error)
}
34 changes: 17 additions & 17 deletions core/logic_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,27 +827,27 @@ func (e eventsLogic) getNotProcessedLocations(locationsForProcessing []string) (

func (e eventsLogic) applyProcessLocations(locations []string) error {
i := 0
for _, w := range locations {
for _, loc := range locations {

log.Println(w)
/* //process image
res, err := e.app.imageAdapter.ProcessImage(w)
if err != nil {
return err
}
//process the location
founded, err := e.geoBBAdapter.FindLocation(loc)
if err != nil {
return err
}

if res == nil {
continue
}
if founded == nil {
e.logger.Infof("%d - %s NOT found", i, loc)
continue
}

//mark as processed
err = e.app.storage.InsertImageItem(*res)
if err != nil {
return err
}
//mark as processed
err = e.app.storage.InsertLegacyLocationItem(*founded)
if err != nil {
return err
}

e.logger.Infof("%d - %s WAS found", i, loc)

e.logger.Infof("%d - %s image was processed: %s", i, res.ID, res.ImageURL)
*/
i++
}
return nil
Expand Down
6 changes: 6 additions & 0 deletions driven/geo/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ type Adapter struct {
log logs.Log
}

// FindLocation finds the location the location
func (l Adapter) FindLocation(location string) (*model.LegacyLocation, error) {
//TODO
return nil, nil
}

// ProcessLocation process the location
func (l Adapter) ProcessLocation(eventID, calendarName, sponsor, location string) (*model.LegacyLocation, error) {
/*
Expand Down

0 comments on commit 57ccf54

Please sign in to comment.