Skip to content

Commit

Permalink
fix: create uuid before creating a ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi-bams committed Dec 1, 2024
1 parent a7233aa commit 01ada44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ const (
)

type Tickets struct {
UUID uuid.UUID `gorm:"primaryKey;type:uuid;default:gen_random_uuid()"`
UUID uuid.UUID `gorm:"primaryKey;type:uuid"`
FeatureUUID string `gorm:"type:uuid;index:composite_index" json:"feature_uuid"`
Features WorkspaceFeatures `gorm:"foreignKey:FeatureUUID;references:Uuid"`
PhaseUUID string `gorm:"type:uuid;index:phase_index" json:"phase_uuid"`
Expand Down
2 changes: 2 additions & 0 deletions db/tickets.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func (db database) CreateOrEditTicket(ticket *Tickets) (Tickets, error) {
ticket.Status = DraftTicket
}

ticket.UUID = uuid.New()

if err := db.db.Create(&ticket).Error; err != nil {
return Tickets{}, fmt.Errorf("failed to create ticket: %w", err)
}
Expand Down

0 comments on commit 01ada44

Please sign in to comment.