package transformers import ( "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" "git.coopgo.io/coopgo-platform/solidarity-transport/types" "github.com/paulmach/orb/geojson" ) func DriverRegularAvailabilityProtoToType(a *gen.DriverRegularAvailability) *types.DriverRegularAvailability { address, _ := geojson.UnmarshalFeature([]byte(a.Address.Serialized)) return &types.DriverRegularAvailability{ ID: a.Id, DriverId: a.DriverId, Day: int(a.Day), StartTime: a.StartTime, EndTime: a.EndTime, Address: address, } } func DriverRegularAvailabilityTypeToProto(a *types.DriverRegularAvailability) *gen.DriverRegularAvailability { address := []byte("") if a.Address != nil { address, _ = a.Address.MarshalJSON() } return &gen.DriverRegularAvailability{ Id: a.ID, Day: int32(a.Day), DriverId: a.DriverId, StartTime: a.StartTime, EndTime: a.EndTime, Address: &gen.GeoJsonFeature{Serialized: string(address)}, } }