init: Initial commit
This commit is contained in:
24
app/repositories/service.go
Normal file
24
app/repositories/service.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"git.secnex.io/secnex/taro-bot/database"
|
||||
"git.secnex.io/secnex/taro-bot/models"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func CreateService(name, description string, url *string) error {
|
||||
service := &models.Service{
|
||||
Name: name,
|
||||
Description: description,
|
||||
URL: url,
|
||||
}
|
||||
return database.DB.Create(service).Error
|
||||
}
|
||||
|
||||
func GetService(id uuid.UUID) (*models.Service, error) {
|
||||
var service models.Service
|
||||
if err := database.DB.Where("id = ?", id).First(&service).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &service, nil
|
||||
}
|
||||
Reference in New Issue
Block a user