Update db interface
This commit is contained in:
parent
b01c6fb05e
commit
c3eb1d72b4
2 changed files with 2 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ type DB interface {
|
||||||
GetUser(id string) (*api.User, error)
|
GetUser(id string) (*api.User, error)
|
||||||
|
|
||||||
// Devices.
|
// Devices.
|
||||||
PutDevice(pubKey, userId string) (string, error)
|
PutDevice(pubKey []byte, userId string) (string, error)
|
||||||
GetDevice(id string) (*api.Device, error)
|
GetDevice(id string) (*api.Device, error)
|
||||||
GetUserDevices(userId string) ([]*api.Device, error)
|
GetUserDevices(userId string) ([]*api.Device, error)
|
||||||
GetDeviceUser(deviceId string) (*api.User, error)
|
GetDeviceUser(deviceId string) (*api.User, error)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ func (d *localDB) GetUser(id string) (*api.User, error) {
|
||||||
return u, nil
|
return u, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *localDB) PutDevice(pubKey, userId string) (string, error) {
|
func (d *localDB) PutDevice(pubKey []byte, userId string) (string, error) {
|
||||||
id := ulid.Make().String()
|
id := ulid.Make().String()
|
||||||
if _, ok := d.users[userId]; !ok {
|
if _, ok := d.users[userId]; !ok {
|
||||||
return "", errors.New("user does not exist")
|
return "", errors.New("user does not exist")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue