set created_at time for invites in inmem (#588)

This commit is contained in:
Victor Vrantchan 2016-12-07 11:20:21 -05:00 committed by GitHub
parent 62a5e65c2e
commit 02945f1e3b

View File

@ -2,6 +2,7 @@ package inmem
import (
"sort"
"time"
"github.com/kolide/kolide-ose/server/errors"
"github.com/kolide/kolide-ose/server/kolide"
@ -18,6 +19,11 @@ func (orm *Datastore) NewInvite(invite *kolide.Invite) (*kolide.Invite, error) {
}
}
// set time if missing.
if invite.CreatedAt.IsZero() {
invite.CreatedAt = time.Now()
}
invite.ID = uint(len(orm.invites) + 1)
orm.invites[invite.ID] = invite
return invite, nil