address feedback (#1503)
This commit is contained in:
parent
3a1e244bdf
commit
46ae85d2e7
|
@ -7,7 +7,7 @@ type Persistence interface {
|
||||||
EnableInstallation(identity []byte, installationID string) error
|
EnableInstallation(identity []byte, installationID string) error
|
||||||
// DisableInstallation disable the installation.
|
// DisableInstallation disable the installation.
|
||||||
DisableInstallation(identity []byte, installationID string) error
|
DisableInstallation(identity []byte, installationID string) error
|
||||||
// AddInstallations adds the installations for a given identity, maintaining the enabled flag
|
// AddInstallations adds the installations for a given identity, maintaining the enabled flag and returns the newly inserted installations
|
||||||
AddInstallations(identity []byte, timestamp int64, installations []*Installation, defaultEnabled bool) ([]*Installation, error)
|
AddInstallations(identity []byte, timestamp int64, installations []*Installation, defaultEnabled bool) ([]*Installation, error)
|
||||||
// GetInstallations returns all the installations for a given identity
|
// GetInstallations returns all the installations for a given identity
|
||||||
GetInstallations(identity []byte) ([]*Installation, error)
|
GetInstallations(identity []byte) ([]*Installation, error)
|
||||||
|
|
|
@ -76,29 +76,20 @@ func (s *SQLLitePersistence) GetInstallations(identity []byte) ([]*Installation,
|
||||||
}
|
}
|
||||||
|
|
||||||
for installationRows.Next() {
|
for installationRows.Next() {
|
||||||
var (
|
var installation Installation
|
||||||
installationID string
|
|
||||||
version uint32
|
|
||||||
enabled bool
|
|
||||||
timestamp int64
|
|
||||||
)
|
|
||||||
err = installationRows.Scan(
|
err = installationRows.Scan(
|
||||||
&installationID,
|
&installation.ID,
|
||||||
&version,
|
&installation.Version,
|
||||||
&enabled,
|
&installation.Enabled,
|
||||||
×tamp,
|
&installation.Timestamp,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
installationMap[installationID] = &Installation{
|
// We initialized to empty in this case as we want to
|
||||||
ID: installationID,
|
// return metadata as well in this endpoint, but not in others
|
||||||
Version: version,
|
installation.InstallationMetadata = &InstallationMetadata{}
|
||||||
Enabled: enabled,
|
installationMap[installation.ID] = &installation
|
||||||
Timestamp: timestamp,
|
|
||||||
InstallationMetadata: &InstallationMetadata{},
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
metadataStmt, err := s.db.Prepare(`SELECT installation_id, name, device_type, fcm_token FROM installation_metadata WHERE identity = ?`)
|
metadataStmt, err := s.db.Prepare(`SELECT installation_id, name, device_type, fcm_token FROM installation_metadata WHERE identity = ?`)
|
||||||
|
|
Loading…
Reference in New Issue