Skip to content

Commit

Permalink
[ID-90] Handle location processing on WebTools import (#95)
Browse files Browse the repository at this point in the history
* Update CHANGELOG.md

* Do not process empty locations

* Introduce geo adapter - in progress

* Prepare more raw code

* Geo adapter is in progress

* Google communication - in progress

* in progress

* in progress

* in progress

* in progress

* preprocess and process LocationLegacy

* change the name of the env

* resolve comments

* fix the duration

* Add appropriate comment as the images one.

* We care only locations which are not empty string

* Correct function name

* Arh..

* Move to defined locations

* Init all defined locations on startup

* Get locations for processing

* Get not processed lcoations

* Process locations - in progress

* Process locations - in progress

* Search in google

* Prepare search key

* Fix lint issues

* Revert timer

---------

Co-authored-by: Petyo Stoyanov <[email protected]>
Co-authored-by: Stefan Vitanov <[email protected]>
  • Loading branch information
3 people authored May 16, 2024
1 parent 99ec5fd commit 92afa64
Show file tree
Hide file tree
Showing 11 changed files with 480 additions and 122 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Handle location processing on WebTools import [#90](https://github.com/rokwire/gateway-building-block/issues/90)

[2.9.0] - 2024-05-07
### Changed
Expand Down
4 changes: 3 additions & 1 deletion core/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Application struct {

eventsBBAdapter EventsBBAdapter
imageAdapter ImageAdapter
geoBBAdapter GeoAdapter

//events logic
eventsLogic eventsLogic
Expand Down Expand Up @@ -94,6 +95,7 @@ func NewApplication(version string, build string,
storage Storage,
eventsBBAdapter EventsBBAdapter,
imageAdapter ImageAdapter,
geoBBAdapter GeoAdapter,
appntAdapters map[string]Appointments,
logger *logs.Logger) *Application {
application := Application{version: version, build: build, storage: storage, eventsBBAdapter: eventsBBAdapter, imageAdapter: imageAdapter, logger: logger, AppointmentAdapters: appntAdapters}
Expand All @@ -106,7 +108,7 @@ func NewApplication(version string, build string,
application.TPS = newAppTPS(&application)
application.System = newAppSystem(&application)
application.shared = newAppShared(&application)
application.eventsLogic = newAppEventsLogic(&application, eventsBBAdapter, *logger)
application.eventsLogic = newAppEventsLogic(&application, eventsBBAdapter, geoBBAdapter, *logger)

return &application
}
19 changes: 13 additions & 6 deletions core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ type EventsBBAdapter interface {
LoadAllLegacyEvents() ([]model.LegacyEvent, error)
}

// GeoAdapter is used by core to get geo services
type GeoAdapter interface {
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
type Storage interface {
RegisterStorageListener(listener storage.Listener)
Expand All @@ -122,7 +132,6 @@ type Storage interface {
FindCalendars(id string) (*[]model.UnitCalendar, error)

InitializeLegacyLocations() error
//not used
FindLegacyLocations() (model.LegacyLocationsListType, error)

FindLegacyEventItems(context storage.TransactionContext) ([]model.LegacyEventItem, error)
Expand All @@ -139,6 +148,9 @@ type Storage interface {

FindImageItems() ([]model.ContentImagesURL, error)
InsertImageItem(items model.ContentImagesURL) error

FindLegacyLocationItems() ([]model.LegacyLocation, error)
InsertLegacyLocationItem(items model.LegacyLocation) error
}

// StorageListener represents storage listener
Expand Down Expand Up @@ -190,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)
}
Loading

0 comments on commit 92afa64

Please sign in to comment.