fixed code documentation

This commit is contained in:
Fran Jurmanović
2021-08-29 10:51:29 +02:00
parent 0682252859
commit f441f46494
35 changed files with 674 additions and 70 deletions

View File

@@ -12,6 +12,11 @@ type BaseModel struct {
DateUpdated time.Time `json:"dateUpdated" pg:"date_updated"`
}
/*
Init
Initializes base model with DateCreated, DateUpdated, and Id values.
*/
func (cm *BaseModel) Init() {
date := time.Now()
cm.Id = uuid.NewString()

View File

@@ -16,6 +16,13 @@ type UserReturnInfo struct {
Email string `json:"email"`
}
/*
Payload
Maps User object to UserReturnInfo object.
Returns:
*UserReturnInfo: mapped UserReturnInfo object
*/
func (um *User) Payload() *UserReturnInfo {
payload := new(UserReturnInfo)
payload.BaseModel = um.BaseModel

View File

@@ -49,6 +49,13 @@ type SubscriptionEnd struct {
Id string `json:"id" form:"id"`
}
/*
ToTrans
Maps Subscription object to Transaction object.
Returns:
*Transaction: mapped Transaction object
*/
func (cm *Subscription) ToTrans() *Transaction {
trans := new(Transaction)
trans.Init()
@@ -63,6 +70,13 @@ func (cm *Subscription) ToTrans() *Transaction {
return trans
}
/*
HasNew
Checks if Subscription reached new transaction interval.
Returns:
bool: Is new transaction interval reached
*/
func (cm *Subscription) HasNew() bool {
trans := cm.TransactionType
if trans != nil {