2fas-server/internal/api/mobile/domain/mobile_device.go
2022-12-31 10:22:38 +01:00

41 lines
703 B
Go

package domain
import (
"github.com/google/uuid"
"gorm.io/gorm"
)
const (
IOS = "ios"
Android = "android"
)
type MobileDevice struct {
gorm.Model
Id uuid.UUID `gorm:"primarykey"`
Name string
Platform string
FcmToken string
}
func (MobileDevice) TableName() string {
return "mobile_devices"
}
func NewMobileDevice(id uuid.UUID, name, platform, fcmToken string) *MobileDevice {
return &MobileDevice{
Id: id,
Name: name,
Platform: platform,
FcmToken: fcmToken,
}
}
type MobileDeviceRepository interface {
Save(device *MobileDevice) error
Update(device *MobileDevice) error
FindById(device uuid.UUID) (*MobileDevice, error)
FindAll() []*MobileDevice
}