casdoor / casdoor-go-sdk

Go client SDK for Casdoor
https://github.com/casdoor/casdoor
Apache License 2.0
87 stars 72 forks source link

Subscription struct is not up to date with casdoor #137

Closed xiemax100 closed 2 hours ago

xiemax100 commented 3 hours ago

current go sdk Subscription struct def:

// Subscription has the same definition as https://github.com/casdoor/casdoor/blob/master/object/subscription.go#L24
type Subscription struct {
    Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
    Name        string `xorm:"varchar(100) notnull pk" json:"name"`
    CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
    DisplayName string `xorm:"varchar(100)" json:"displayName"`

    StartDate   time.Time `json:"startDate"`
    EndDate     time.Time `json:"endDate"`
    Duration    int       `json:"duration"`
    Description string    `xorm:"varchar(100)" json:"description"`

    User string `xorm:"mediumtext" json:"user"`
    Plan string `xorm:"varchar(100)" json:"plan"`

    IsEnabled   bool   `json:"isEnabled"`
    Submitter   string `xorm:"varchar(100)" json:"submitter"`
    Approver    string `xorm:"varchar(100)" json:"approver"`
    ApproveTime string `xorm:"varchar(100)" json:"approveTime"`

    State string `xorm:"varchar(100)" json:"state"`
}

while Casdoor has newer def:

type SubscriptionState string

const (
    SubStatePending   SubscriptionState = "Pending"
    SubStateError     SubscriptionState = "Error"
    SubStateSuspended SubscriptionState = "Suspended" // suspended by the admin

    SubStateActive   SubscriptionState = "Active"
    SubStateUpcoming SubscriptionState = "Upcoming"
    SubStateExpired  SubscriptionState = "Expired"
)

type Subscription struct {
    Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
    Name        string `xorm:"varchar(100) notnull pk" json:"name"`
    DisplayName string `xorm:"varchar(100)" json:"displayName"`
    CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
    Description string `xorm:"varchar(100)" json:"description"`

    User    string `xorm:"varchar(100)" json:"user"`
    Pricing string `xorm:"varchar(100)" json:"pricing"`
    Plan    string `xorm:"varchar(100)" json:"plan"`
    Payment string `xorm:"varchar(100)" json:"payment"`

    StartTime time.Time         `json:"startTime"`
    EndTime   time.Time         `json:"endTime"`
    Period    string            `xorm:"varchar(100)" json:"period"`
    State     SubscriptionState `xorm:"varchar(100)" json:"state"`
}
casbin-bot commented 3 hours ago

@tangyang9464 @JalinWang @imp2002