summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/license.go26
-rw-r--r--model/message.go1
-rw-r--r--model/post.go2
-rw-r--r--model/system.go1
4 files changed, 30 insertions, 0 deletions
diff --git a/model/license.go b/model/license.go
index a271b46b7..ea66fef0d 100644
--- a/model/license.go
+++ b/model/license.go
@@ -8,6 +8,12 @@ import (
"io"
)
+type LicenseRecord struct {
+ Id string `json:"id"`
+ CreateAt int64 `json:"create_at"`
+ Bytes string `json:"-"`
+}
+
type License struct {
Id string `json:"id"`
IssuedAt int64 `json:"issued_at"`
@@ -83,3 +89,23 @@ func LicenseFromJson(data io.Reader) *License {
return nil
}
}
+
+func (lr *LicenseRecord) IsValid() *AppError {
+ if len(lr.Id) != 26 {
+ return NewLocAppError("LicenseRecord.IsValid", "model.license_record.is_valid.id.app_error", nil, "")
+ }
+
+ if lr.CreateAt == 0 {
+ return NewLocAppError("LicenseRecord.IsValid", "model.license_record.is_valid.create_at.app_error", nil, "")
+ }
+
+ if len(lr.Bytes) == 0 || len(lr.Bytes) > 10000 {
+ return NewLocAppError("LicenseRecord.IsValid", "model.license_record.is_valid.create_at.app_error", nil, "")
+ }
+
+ return nil
+}
+
+func (lr *LicenseRecord) PreSave() {
+ lr.CreateAt = GetMillis()
+}
diff --git a/model/message.go b/model/message.go
index 1cb350bbf..cce0ec094 100644
--- a/model/message.go
+++ b/model/message.go
@@ -18,6 +18,7 @@ const (
ACTION_USER_ADDED = "user_added"
ACTION_USER_REMOVED = "user_removed"
ACTION_PREFERENCE_CHANGED = "preference_changed"
+ ACTION_EPHEMERAL_MESSAGE = "ephemeral_message"
)
type Message struct {
diff --git a/model/post.go b/model/post.go
index f9f5a4d1c..8a451831c 100644
--- a/model/post.go
+++ b/model/post.go
@@ -13,8 +13,10 @@ const (
POST_SYSTEM_MESSAGE_PREFIX = "system_"
POST_DEFAULT = ""
POST_SLACK_ATTACHMENT = "slack_attachment"
+ POST_SYSTEM_GENERIC = "system_generic"
POST_JOIN_LEAVE = "system_join_leave"
POST_HEADER_CHANGE = "system_header_change"
+ POST_EPHEMERAL = "system_ephemeral"
)
type Post struct {
diff --git a/model/system.go b/model/system.go
index 70db529d5..b387749f6 100644
--- a/model/system.go
+++ b/model/system.go
@@ -12,6 +12,7 @@ const (
SYSTEM_DIAGNOSTIC_ID = "DiagnosticId"
SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
+ SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
)
type System struct {