mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
subscription controller, service and model
This commit is contained in:
32
pkg/models/subscriptions.go
Normal file
32
pkg/models/subscriptions.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Subscription struct {
|
||||
tableName struct{} `pg:"subscriptions,alias:subscriptions"`
|
||||
BaseModel
|
||||
Description string `json:"description" pg:"description"`
|
||||
StartDate time.Time `json:"startDate" pg:"start_date"`
|
||||
SubscriptionTypeID string `json:"subscriptionTypeId" pg:"subscription_type_id"`
|
||||
SubscriptionType *SubscriptionType `json:"subscriptionType", pg:"rel:has-one, fk:subscription_type_id"`
|
||||
CustomRange int `json:"customRange", pg:"custom_range"`
|
||||
WalletID string `json:"walletId", pg:"wallet_id"`
|
||||
Wallet *Wallet `json:"wallet" pg:"rel:has-one, fk:wallet_id"`
|
||||
TransactionTypeID string `json:"transactionTypeId", pg:"transaction_type_id"`
|
||||
TransactionType *TransactionType `json:"transactionType", pg:"rel:has-one, fk:transaction_type_id"`
|
||||
LastTransactionDate time.Time `json:"lastTransactionDate", pg:"last_transaction_date"`
|
||||
Amount int `json:"amount", pg:"amount"`
|
||||
}
|
||||
|
||||
type NewSubscriptionBody struct {
|
||||
WalletID string `json:"walletId" form:"walletId"`
|
||||
TransactionTypeID string `json:"transactionTypeId" form:"transactionTypeId"`
|
||||
SubscriptionTypeID string `json:"subscriptionTypeId" pg:"subscription_type_id"`
|
||||
CustomRange int `json:"customRange", pg:"custom_range"`
|
||||
StartDate time.Time `json:"startDate" pg:"start_date"`
|
||||
Description string `json:"description" form:"description"`
|
||||
Amount json.Number `json:"amount" form:"amount"`
|
||||
}
|
||||
Reference in New Issue
Block a user