| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from shared.utils import to_unix_timestamp |
| 6 |
| 5 from google.appengine.ext import ndb | 7 from google.appengine.ext import ndb |
| 6 | 8 |
| 7 class Record(ndb.Model): | 9 class Record(ndb.Model): # pragma: no cover |
| 8 timestamp = ndb.DateTimeProperty(auto_now=True) | 10 timestamp = ndb.DateTimeProperty(auto_now=True) |
| 9 tags = ndb.StringProperty(repeated=True) | 11 tags = ndb.StringProperty(repeated=True) |
| 10 fields = ndb.JsonProperty(default={}) | 12 fields = ndb.JsonProperty(default={}) |
| 13 |
| 14 def to_dict(self): |
| 15 return { |
| 16 'key': self.key.id() if type(self.key.id()) != long else None, |
| 17 'timestamp': to_unix_timestamp(self.timestamp), |
| 18 'tags': self.tags, |
| 19 'fields': self.fields, |
| 20 } |
| OLD | NEW |