mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
added end date to subscription model
This commit is contained in:
@@ -10,6 +10,8 @@ type Subscription struct {
|
|||||||
BaseModel
|
BaseModel
|
||||||
Description string `json:"description" pg:"description"`
|
Description string `json:"description" pg:"description"`
|
||||||
StartDate time.Time `json:"startDate" pg:"start_date"`
|
StartDate time.Time `json:"startDate" pg:"start_date"`
|
||||||
|
EndDate time.Time `json:"endDate" pg:"end_date"`
|
||||||
|
HasEnd bool `json:"hasEnd" pg:"hasEnd"`
|
||||||
SubscriptionTypeID string `json:"subscriptionTypeId" pg:"subscription_type_id"`
|
SubscriptionTypeID string `json:"subscriptionTypeId" pg:"subscription_type_id"`
|
||||||
SubscriptionType *SubscriptionType `json:"subscriptionType", pg:"rel:has-one, fk:subscription_type_id"`
|
SubscriptionType *SubscriptionType `json:"subscriptionType", pg:"rel:has-one, fk:subscription_type_id"`
|
||||||
CustomRange int `json:"customRange", pg:"custom_range"`
|
CustomRange int `json:"customRange", pg:"custom_range"`
|
||||||
@@ -27,6 +29,8 @@ type NewSubscriptionBody struct {
|
|||||||
SubscriptionTypeID string `json:"subscriptionTypeId" pg:"subscription_type_id"`
|
SubscriptionTypeID string `json:"subscriptionTypeId" pg:"subscription_type_id"`
|
||||||
CustomRange json.Number `json:"customRange", pg:"custom_range"`
|
CustomRange json.Number `json:"customRange", pg:"custom_range"`
|
||||||
StartDate time.Time `json:"startDate" pg:"start_date"`
|
StartDate time.Time `json:"startDate" pg:"start_date"`
|
||||||
|
EndDate time.Time `json:"endDate" pg:"end_date"`
|
||||||
|
HasEnd bool `json:"hasEnd" pg:"hasEnd"`
|
||||||
Description string `json:"description" form:"description"`
|
Description string `json:"description" form:"description"`
|
||||||
Amount json.Number `json:"amount" form:"amount"`
|
Amount json.Number `json:"amount" form:"amount"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ func (as *SubscriptionService) New(body *models.NewSubscriptionBody) *models.Sub
|
|||||||
tm.CustomRange = int(customRange)
|
tm.CustomRange = int(customRange)
|
||||||
tm.Description = body.Description
|
tm.Description = body.Description
|
||||||
tm.StartDate = body.StartDate
|
tm.StartDate = body.StartDate
|
||||||
|
tm.HasEnd = body.HasEnd
|
||||||
|
tm.EndDate = body.EndDate
|
||||||
tm.Amount = int(amount)
|
tm.Amount = int(amount)
|
||||||
|
|
||||||
if body.StartDate.IsZero() {
|
if body.StartDate.IsZero() {
|
||||||
|
|||||||
Reference in New Issue
Block a user