Add PostgreSQL database option and more booking flow functionalities
This commit is contained in:
@@ -16,14 +16,16 @@ type Storage interface {
|
||||
|
||||
CreateBooking(internal.Booking) error
|
||||
GetBooking(id string) (*internal.Booking, error)
|
||||
GetUserBookings(userid string) ([]internal.Booking, error)
|
||||
UpdateBookingStatus(bookingid string, status string) error
|
||||
|
||||
// Caching temporary results
|
||||
PersistedKVPut(documents []any) error
|
||||
PersistedKVGet(id string, document any) error
|
||||
StoreSearchResults([]internal.SearchResult) error
|
||||
GetSearchResult(id string) (*internal.SearchResult, error)
|
||||
// PersistedKVPut(documents []any) error
|
||||
// PersistedKVGet(id string, document any) error
|
||||
StoreRouteSchedules([]internal.PlannedRouteSchedule) error
|
||||
GetRouteSchedule(id string) (*internal.PlannedRouteSchedule, error)
|
||||
|
||||
Migrate() error
|
||||
}
|
||||
|
||||
func NewStorage(cfg *viper.Viper) (Storage, error) {
|
||||
@@ -35,6 +37,9 @@ func NewStorage(cfg *viper.Viper) (Storage, error) {
|
||||
case "mongodb":
|
||||
s, err := NewMongoDBStorage(cfg)
|
||||
return s, err
|
||||
case "psql":
|
||||
s, err := NewPostgresqlStorage(cfg)
|
||||
return s, err
|
||||
default:
|
||||
return nil, fmt.Errorf("storage type %v is not supported", storage_type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user