Skip to content

Commit

Permalink
feat: update Subscription struct (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiemax100 authored Oct 12, 2024
1 parent 31857d7 commit 0c7a4be
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions casdoorsdk/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,35 @@ import (
"time"
)

// Subscription has the same definition as https://github.com/casdoor/casdoor/blob/master/object/subscription.go#L24
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"
)

// Subscription has the same definition as https://github.com/casdoor/casdoor/blob/master/object/subscription.go#L39
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"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
Description string `xorm:"varchar(100)" json:"description"`

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"`
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"`

State string `xorm:"varchar(100)" json:"state"`
StartTime time.Time `json:"startTime"`
EndTime time.Time `json:"endTime"`
Period string `xorm:"varchar(100)" json:"period"`
State SubscriptionState `xorm:"varchar(100)" json:"state"`
}

func (c *Client) GetSubscriptions() ([]*Subscription, error) {
Expand Down

0 comments on commit 0c7a4be

Please sign in to comment.