Implemented developer database downloads

This commit is contained in:
2019-09-07 19:56:13 +09:00
parent 59b9be5992
commit 4e6aa5eef6
33 changed files with 155 additions and 46 deletions

View File

@ -4,13 +4,14 @@ import "github.com/aerogo/nano"
// Purchase represents an item purchase by a user.
type Purchase struct {
ID string `json:"id"`
UserID string `json:"userId"`
ItemID string `json:"itemId"`
Quantity int `json:"quantity"`
Price int `json:"price"`
Currency string `json:"currency"`
Date string `json:"date"`
hasID
}
// Item returns the item the user bought.
@ -28,7 +29,9 @@ func (purchase *Purchase) User() *User {
// NewPurchase creates a new Purchase object with a generated ID.
func NewPurchase(userID UserID, itemID string, quantity int, price int, currency string) *Purchase {
return &Purchase{
ID: GenerateID("Purchase"),
hasID: hasID{
ID: GenerateID("Purchase"),
},
UserID: userID,
ItemID: itemID,
Quantity: quantity,