Skip to content

Commit

Permalink
Revert remaining model.go
Browse files Browse the repository at this point in the history
  • Loading branch information
jsha committed May 29, 2024
1 parent ff481e5 commit 72de65e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sa/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func registrationPbToModel(reg *corepb.Registration) (*regModel, error) {

var createdAt time.Time
if !core.IsAnyNilOrZero(reg.CreatedAt) {
createdAt = reg.CreatedAt.AsTime().Truncate(time.Second)
createdAt = reg.CreatedAt.AsTime()
}

return &regModel{
Expand Down Expand Up @@ -411,8 +411,8 @@ func orderToModelv1(order *corepb.Order) (*orderModelv1, error) {
om := &orderModelv1{
ID: order.Id,
RegistrationID: order.RegistrationID,
Expires: order.Expires.AsTime().Truncate(time.Second),
Created: order.Created.AsTime().Truncate(time.Second),
Expires: order.Expires.AsTime(),
Created: order.Created.AsTime(),
BeganProcessing: order.BeganProcessing,
CertificateSerial: order.CertificateSerial,
}
Expand Down Expand Up @@ -458,8 +458,8 @@ func orderToModelv2(order *corepb.Order) (*orderModelv2, error) {
om := &orderModelv2{
ID: order.Id,
RegistrationID: order.RegistrationID,
Expires: order.Expires.AsTime().Truncate(time.Second),
Created: order.Created.AsTime().Truncate(time.Second),
Expires: order.Expires.AsTime(),
Created: order.Created.AsTime(),
BeganProcessing: order.BeganProcessing,
CertificateSerial: order.CertificateSerial,
CertificateProfileName: order.CertificateProfileName,
Expand Down
4 changes: 4 additions & 0 deletions sa/sa.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ func (ssa *SQLStorageAuthority) UpdateRegistration(ctx context.Context, req *cor
return nil, err
}

// The CreatedAt field shouldn't change from the original, so we copy it straight through.
// This also ensures that it's already truncated to second (which happened on creation).
update.CreatedAt = curr.CreatedAt

// Copy the existing registration model's LockCol to the new updated
// registration model's LockCol
update.LockCol = curr.LockCol
Expand Down

0 comments on commit 72de65e

Please sign in to comment.