1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 01:22:48 +00:00

play sounds from web ui - store uploaded sounds in database

This commit is contained in:
2018-09-12 23:36:44 -05:00
parent 325203cc5e
commit be359f7424
26 changed files with 390 additions and 245 deletions

View File

@@ -0,0 +1,28 @@
package model
import (
"time"
"github.com/jinzhu/gorm"
)
type Sound struct {
ID uint `gorm:"primary_key" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at"`
Name string `gorm:"unique" json:"name"`
Extension string `json:"extension"`
UserID string `json:"user_id"`
User User `json:"user"`
}
func SoundCreate(conn *gorm.DB, sound *Sound) error {
return conn.Create(sound).Error
}
func SoundList(conn *gorm.DB) ([]Sound, error) {
sound := []Sound{}
err := conn.Set("gorm:auto_preload", true).Find(&sound).Error
return sound, err
}