mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
fixed pg types
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type BaseModel struct {
|
type BaseModel struct {
|
||||||
Id string `json:"id" pg:"id,pk"`
|
Id string `json:"id" pg:"id,pk,notnull"`
|
||||||
DateCreated time.Time `json:"dateCreated" pg:"date_created"`
|
DateCreated time.Time `json:"dateCreated" pg:"date_created"`
|
||||||
DateUpdated time.Time `json:"dateUpdated" pg:"date_updated"`
|
DateUpdated time.Time `json:"dateUpdated" pg:"date_updated"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ type User struct {
|
|||||||
tableName struct{} `pg:"users,alias:users"`
|
tableName struct{} `pg:"users,alias:users"`
|
||||||
BaseModel
|
BaseModel
|
||||||
IsActive bool `json:"isActive" pg:"is_active" form:"isActive"`
|
IsActive bool `json:"isActive" pg:"is_active" form:"isActive"`
|
||||||
Username string `json:"username" pg:"username" form:"username"`
|
Username string `json:"username" pg:"username,notnull" form:"username"`
|
||||||
Password string `json:"password" pg:"password" form:"password"`
|
Password string `json:"password" pg:"password,notnull" form:"password"`
|
||||||
Email string `json:"email" pg:"email" form:"email"`
|
Email string `json:"email" pg:"email,notnull" form:"email"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserReturnInfo struct {
|
type UserReturnInfo struct {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ type SubscriptionType struct {
|
|||||||
tableName struct{} `pg:"subscriptionTypes,alias:subscriptionTypes"`
|
tableName struct{} `pg:"subscriptionTypes,alias:subscriptionTypes"`
|
||||||
BaseModel
|
BaseModel
|
||||||
Name string `json:"name" pg:"name"`
|
Name string `json:"name" pg:"name"`
|
||||||
Type string `json:"type" pg:"type"`
|
Type string `json:"type" pg:"type,notnull"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewSubscriptionTypeBody struct {
|
type NewSubscriptionTypeBody struct {
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ type Subscription struct {
|
|||||||
tableName struct{} `pg:"subscriptions,alias:subscriptions"`
|
tableName struct{} `pg:"subscriptions,alias:subscriptions"`
|
||||||
BaseModel
|
BaseModel
|
||||||
Description string `json:"description" pg:"description"`
|
Description string `json:"description" pg:"description"`
|
||||||
StartDate time.Time `json:"startDate" pg:"start_date", type:timestamp`
|
StartDate time.Time `json:"startDate" pg:"start_date", type:timestamptz`
|
||||||
EndDate time.Time `json:"endDate" pg:"end_date", type:timestamp`
|
EndDate time.Time `json:"endDate" pg:"end_date", type:timestamptz`
|
||||||
HasEnd bool `json:"hasEnd" pg:"hasEnd"`
|
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,default:1"`
|
||||||
WalletID string `json:"walletId", pg:"wallet_id"`
|
WalletID string `json:"walletId", pg:"wallet_id"`
|
||||||
Wallet *Wallet `json:"wallet" pg:"rel:has-one, fk:wallet_id"`
|
Wallet *Wallet `json:"wallet" pg:"rel:has-one, fk:wallet_id"`
|
||||||
TransactionTypeID string `json:"transactionTypeId", pg:"transaction_type_id"`
|
TransactionTypeID string `json:"transactionTypeId", pg:"transaction_type_id"`
|
||||||
TransactionType *TransactionType `json:"transactionType", pg:"rel:has-one, fk:transaction_type_id"`
|
TransactionType *TransactionType `json:"transactionType", pg:"rel:has-one, fk:transaction_type_id"`
|
||||||
LastTransactionDate time.Time `json:"lastTransactionDate", pg:"last_transaction_date", type:timestamp`
|
LastTransactionDate time.Time `json:"lastTransactionDate", pg:"last_transaction_date", type:timestamptz`
|
||||||
Amount float32 `json:"amount", pg:"amount"`
|
Amount float32 `json:"amount", pg:"amount,default:0"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewSubscriptionBody struct {
|
type NewSubscriptionBody struct {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ type TransactionType struct {
|
|||||||
tableName struct{} `pg:"transactionTypes,alias:transactionTypes"`
|
tableName struct{} `pg:"transactionTypes,alias:transactionTypes"`
|
||||||
BaseModel
|
BaseModel
|
||||||
Name string `json:"name" pg:"name"`
|
Name string `json:"name" pg:"name"`
|
||||||
Type string `json:"type" pg:"type"`
|
Type string `json:"type" pg:"type,notnull"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewTransactionTypeBody struct {
|
type NewTransactionTypeBody struct {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ type Transaction struct {
|
|||||||
TransactionTypeID string `json:"transactionTypeId", pg:"transaction_type_id"`
|
TransactionTypeID string `json:"transactionTypeId", pg:"transaction_type_id"`
|
||||||
TransactionType *TransactionType `json:"transactionType", pg:"rel:has-one, fk:transaction_type_id"`
|
TransactionType *TransactionType `json:"transactionType", pg:"rel:has-one, fk:transaction_type_id"`
|
||||||
WalletID string `json:"walletId", pg:"wallet_id"`
|
WalletID string `json:"walletId", pg:"wallet_id"`
|
||||||
Amount float32 `json:"amount", pg:"amount"`
|
Amount float32 `json:"amount", pg:"amount,default:0"`
|
||||||
Wallet *Wallet `json:"wallet" pg:"rel:has-one, fk:wallet_id"`
|
Wallet *Wallet `json:"wallet" pg:"rel:has-one, fk:wallet_id"`
|
||||||
TransactionDate time.Time `json:"transactionDate" pg:"transaction_date, type:timestamp"`
|
TransactionDate time.Time `json:"transactionDate" pg:"transaction_date, type:timestamptz"`
|
||||||
SubscriptionID string `json:"subscriptionId", pg:"subscription_id"`
|
SubscriptionID string `json:"subscriptionId", pg:"subscription_id"`
|
||||||
Subscription *Subscription `json:"subscription", pg:"rel:has-one, fk:subscription_id"`
|
Subscription *Subscription `json:"subscription", pg:"rel:has-one, fk:subscription_id"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user