Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
42
pkg/common/subscription.go
Normal file
42
pkg/common/subscription.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"fiskerinc.com/modules/common/dbbasemodel"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Subscription struct {
|
||||
ID int64 `json:"-" pg:",pk"`
|
||||
SubscriptionTypeID uuid.UUID `json:"-" pg:"type:uuid" validate:"required"`
|
||||
CarToDriverID int64 `json:"-" validate:"required,max=256"`
|
||||
Name string `json:"name" validate:"required,max=256"`
|
||||
Destination string `json:"destination" validate:"required,max=10"`
|
||||
Expires time.Time `json:"expires"`
|
||||
dbbasemodel.DBModelBase
|
||||
}
|
||||
|
||||
type MobileSubscriptionUpdate struct {
|
||||
VIN string `json:"vin"`
|
||||
Subscriptions []Subscription `json:"subscriptions"`
|
||||
}
|
||||
|
||||
func (m *MobileSubscriptionUpdate) Clear() {
|
||||
for i := range m.Subscriptions {
|
||||
sub := &m.Subscriptions[i]
|
||||
sub.ClearDates()
|
||||
}
|
||||
}
|
||||
|
||||
type HMISubscriptionUpdate struct {
|
||||
DriverID string `json:"driver_id"`
|
||||
Subscriptions []Subscription `json:"subscriptions"`
|
||||
}
|
||||
|
||||
func (h *HMISubscriptionUpdate) Clear() {
|
||||
for i := range h.Subscriptions {
|
||||
sub := &h.Subscriptions[i]
|
||||
sub.ClearDates()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user