25 lines
563 B
Go
25 lines
563 B
Go
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
|
|
}
|