carpool-service/storage/trips.go

38 lines
1.7 KiB
Go

package storage
import (
"github.com/paulmach/orb"
"github.com/paulmach/orb/geojson"
)
type RegularTrip struct {
Id string `bson:"_id"`
GroupId string `bson:"group_id"` // Identifier to group trips together (for example "outward and return", or "driver and passenger" trips) : trips created in a same "CreateTrips" function will have the same group_id
User User `bson:"user"`
Departure *geojson.Feature `bson:"departure"` // GeoJSON feature of the departure (geometry must be of type "Point")
Arrival *geojson.Feature `bson:"arrival"` // GeoJSON feature of the destination (geometry must be of type "Point")
EncodedPolyline string `bson:"encoded_polyline"` // Polyline encoded (Google Polyline Algorithm) string (should be 5 digits representation)
DecodedPolyline orb.LineString `bson:"decoded_polyline"` // geometry of the linestring/polyline describing the trip route
Schedules []Schedule `bson:"schedules"`
Properties map[string]any `bson:"properties"` // Properties map for flexible parameters to be set by the application implementing this service
Removed bool // Trip was removed, do not consider it
}
type Schedule struct {
Day string `bson:"day"`
TimeOfDay string `bson:"time_of_day"`
}
type User struct {
Id string `bson:"_id"`
Alias string `bson:"alias"`
FirsName *string `bson:"first_name,omitempty"`
LastName *string `bson:"last_name,omitempty"`
Grade *int64 `bson:"grade,omitempty"`
Picture *string `bson:"picture,omitempty"`
Gender *string `bson:"gender,omitempty"`
VerifiedIdentity *bool `bson:"verified_identity,omitempty"`
}