Skip to content

Commit

Permalink
fix: CreatorID for CrowdfundCampaign record (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
b00f authored Jan 7, 2025
1 parent a75b568 commit 285c24f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions internal/engine/command/crowdfund/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func (c *CrowdfundCmd) createHandler(
_ *entity.User,
caller *entity.User,
cmd *command.Command,
args map[string]string,
) command.CommandResult {
Expand All @@ -31,9 +31,10 @@ func (c *CrowdfundCmd) createHandler(
}

campaign := &entity.CrowdfundCampaign{
Title: title,
Desc: desc,
Packages: packages,
CreatorID: caller.ID,
Title: title,
Desc: desc,
Packages: packages,
}
err = c.db.AddCrowdfundCampaign(campaign)
if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions internal/entity/crowdfund.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ type Package struct {
type CrowdfundCampaign struct {
DBModel

Title string `gorm:"type:char(128);not null"`
Desc string `gorm:"type:text;not null"`
Packages []Package `gorm:"serializer:json"`
CreatorID uint // TODO: define foreign key here
Title string `gorm:"type:char(128);not null"`
Desc string `gorm:"type:text;not null"`
Packages []Package `gorm:"serializer:json"`
}

type CrowdfundPurchase struct {
Expand Down

0 comments on commit 285c24f

Please sign in to comment.