quest

package
v0.0.0-...-418b934 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PointHistory

type PointHistory struct {
	gorm.Model
	EntityID       uuid.UUID `gorm:"not null"`
	AmountModified int64     `gorm:"not null;default:0"`
	ModifyReason   string
	CompletedQuest *Quest
}

PointHistory entity for quest transaction

func (*PointHistory) MarshalBinary

func (p *PointHistory) MarshalBinary() ([]byte, error)

MarshalBinary for redis

func (*PointHistory) ToDTO

func (p *PointHistory) ToDTO() (*module.PointHistoryDTO, error)

ToDTO dto

func (*PointHistory) UnmarshalBinary

func (p *PointHistory) UnmarshalBinary(data []byte) error

UnmarshalBinary for redis

type Points

type Points struct {
	entity.Base
	EntityID    uuid.UUID `gorm:"not null;primary_key;unique_index"`
	TotalPoints int64     `gorm:"not null;default:0"`

	History []*PointHistory
}

Points entity for point balance for entity

func (*Points) MarshalBinary

func (p *Points) MarshalBinary() ([]byte, error)

MarshalBinary for redis

func (*Points) ToDTO

func (p *Points) ToDTO() *module.PointsDTO

ToDTO dto

func (*Points) UnmarshalBinary

func (p *Points) UnmarshalBinary(data []byte) error

UnmarshalBinary for redis

type Quest

type Quest struct {
	entity.Base
	//EntityID service ID
	EntityID uuid.UUID `gorm:"not null"`
	//BusinessID only set when IsBusinessSpecific is true
	BusinessID uuid.UUID
	//UserID only set when IsUserSpecific is true
	UserID    uuid.UUID
	Type      int32 `gorm:"not null"`
	Threshold float32
	//RewardPoints points to reward once completed
	RewardPoints   uint64 `gorm:"not null;default:0"`
	Description    string
	BannerImageURL string
	//AmountOfCompletionPerDay -1 means unlimited
	AmountOfCompletionPerDay uint32 `gorm:"not null;default:1"`

	ActiveFrom time.Time
	ActiveTo   time.Time

	IsActive           bool `gorm:"not null;default:false"`
	IsBusinessQuest    bool `gorm:"not null;default:false"`
	IsBusinessSpecific bool `gorm:"not null;default:false"`
	IsUserSpecific     bool `gorm:"not null;default:false"`
	IsOncePerEntity    bool `gorm:"not null;default:false"`
}

Quest entity

func (*Quest) MarshalBinary

func (q *Quest) MarshalBinary() ([]byte, error)

MarshalBinary for redis

func (*Quest) ToDTO

func (q *Quest) ToDTO() (*module.QuestDTO, error)

ToDTO dto

func (*Quest) UnmarshalBinary

func (q *Quest) UnmarshalBinary(data []byte) error

UnmarshalBinary for redis

type QuestProgress

type QuestProgress struct {
	entity.Base
	EntityID        uuid.UUID `gorm:"not null"`
	CurrentProgress float32   `gorm:"not null;default:0"`

	IsCancelled   bool   `gorm:"not null;default:false"`
	IsCompleted   bool   `gorm:"not null;default:false"`
	AcceptedQuest *Quest `gorm:"not null"`
}

QuestProgress entity

func (*QuestProgress) MarshalBinary

func (q *QuestProgress) MarshalBinary() ([]byte, error)

MarshalBinary for redis

func (*QuestProgress) ToDTO

func (q *QuestProgress) ToDTO() (*module.QuestProgressDTO, error)

ToDTO dto

func (*QuestProgress) UnmarshalBinary

func (q *QuestProgress) UnmarshalBinary(data []byte) error

UnmarshalBinary for redis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL