This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/internal/db/devices.go
2021-02-04 05:16:13 -05:00

31 lines
708 B
Go

package db
import (
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"reichard.io/imagini/graph/model"
)
func (dbm *DBManager) CreateDevice(device *model.Device) error {
log.Debug("[db] Creating device: ", device.Name)
refreshKey := uuid.New().String()
device.RefreshKey = &refreshKey
err := dbm.db.Create(device).Error
return err
}
func (dbm *DBManager) Device(device *model.Device) (int64, error) {
var count int64
err := dbm.db.Where(device).First(device).Count(&count).Error
return count, err
}
func (dbm *DBManager) DeleteDevice(user *model.Device) error {
return nil
}
func (dbm *DBManager) UpdateRefreshToken(device *model.Device, refreshToken string) error {
return nil
}