upvote and feedback list
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build is passing

This commit is contained in:
2024-04-22 19:39:41 +03:00
parent 8fb0c0f056
commit 16a03ca5a1
17 changed files with 983 additions and 12 deletions

View File

@@ -31,3 +31,35 @@ func (t *Feedback) GetBySessionID(sessionID string) ([]*models.Feedback, error)
return tickets, nil
}
func (t *Feedback) GetByUUID(uuid string) (*models.Feedback, error) {
var ticket models.Feedback
res := t.db.
Preload("Upvote").
Where("uuid = ?", uuid).
First(&ticket)
if res.Error != nil {
return nil, res.Error
}
return &ticket, nil
}
func (t *Feedback) GetByProjectID(projectID models.FeedbackType) ([]*models.Feedback, error) {
var tickets []*models.Feedback
res := t.db.
Where("project_id = ?", projectID).
Where("type = ?", models.FeedbackTypeFeature).
Find(&tickets)
if res.Error != nil {
return nil, res.Error
}
return tickets, nil
}
func (t *Feedback) CreateUpvote(upvote *models.Upvote) error {
return t.db.Create(upvote).Error
}