mirror of
https://github.com/twofas/2fas-server.git
synced 2024-11-22 10:20:45 +01:00
41 lines
703 B
Go
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
|
|
}
|