Skip to content

Commit

Permalink
Add queriable shorter uuids (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomiceli authored Sep 23, 2024
1 parent 605c8b8 commit 56b4fd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/db/gist.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (gist *Gist) BeforeDelete(tx *gorm.DB) error {
func GetGist(user string, gistUuid string) (*Gist, error) {
gist := new(Gist)
err := db.Preload("User").Preload("Forked.User").
Where("(gists.uuid = ? OR gists.url = ?) AND users.username like ?", gistUuid, gistUuid, user).
Where("(gists.uuid like ? OR gists.url = ?) AND users.username like ?", gistUuid+"%", gistUuid, user).
Joins("join users on gists.user_id = users.id").
First(&gist).Error

Expand Down

0 comments on commit 56b4fd4

Please sign in to comment.