summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/compliance_post.go92
-rw-r--r--model/compliance_post_test.go27
-rw-r--r--model/system.go9
3 files changed, 124 insertions, 4 deletions
diff --git a/model/compliance_post.go b/model/compliance_post.go
new file mode 100644
index 000000000..636be8f17
--- /dev/null
+++ b/model/compliance_post.go
@@ -0,0 +1,92 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package model
+
+import (
+ "time"
+)
+
+type CompliancePost struct {
+
+ // From Team
+ TeamName string
+ TeamDisplayName string
+
+ // From Channel
+ ChannelName string
+ ChannelDisplayName string
+
+ // From User
+ UserUsername string
+ UserEmail string
+ UserNickname string
+
+ // From Post
+ PostId string
+ PostCreateAt int64
+ PostUpdateAt int64
+ PostDeleteAt int64
+ PostRootId string
+ PostParentId string
+ PostOriginalId string
+ PostMessage string
+ PostType string
+ PostProps string
+ PostHashtags string
+ PostFilenames string
+}
+
+func CompliancePostHeader() []string {
+ return []string{
+ "TeamName",
+ "TeamDisplayName",
+
+ "ChannelName",
+ "ChannelDisplayName",
+
+ "UserUsername",
+ "UserEmail",
+ "UserNickname",
+
+ "PostId",
+ "PostCreateAt",
+ "PostUpdateAt",
+ "PostDeleteAt",
+ "PostRootId",
+ "PostParentId",
+ "PostOriginalId",
+ "PostMessage",
+ "PostType",
+ "PostProps",
+ "PostHashtags",
+ "PostFilenames",
+ }
+}
+
+func (me *CompliancePost) Row() []string {
+ return []string{
+ me.TeamName,
+ me.TeamDisplayName,
+
+ me.ChannelName,
+ me.ChannelDisplayName,
+
+ me.UserUsername,
+ me.UserEmail,
+ me.UserNickname,
+
+ me.PostId,
+ time.Unix(0, me.PostCreateAt*1000).Format(time.RFC3339),
+ time.Unix(0, me.PostUpdateAt*1000).Format(time.RFC3339),
+ time.Unix(0, me.PostDeleteAt*1000).Format(time.RFC3339),
+ me.PostRootId,
+ me.PostParentId,
+ me.PostOriginalId,
+ me.PostMessage,
+ me.PostType,
+ me.PostProps,
+ me.PostHashtags,
+ me.PostFilenames,
+ }
+}
diff --git a/model/compliance_post_test.go b/model/compliance_post_test.go
new file mode 100644
index 000000000..28e20ba4b
--- /dev/null
+++ b/model/compliance_post_test.go
@@ -0,0 +1,27 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package model
+
+import (
+ "testing"
+)
+
+func TestCompliancePostHeader(t *testing.T) {
+ if CompliancePostHeader()[0] != "TeamName" {
+ t.Fatal()
+ }
+}
+
+func TestCompliancePost(t *testing.T) {
+ o := CompliancePost{TeamName: "test", PostFilenames: "files", PostCreateAt: GetMillis()}
+ r := o.Row()
+
+ if r[0] != "test" {
+ t.Fatal()
+ }
+
+ if r[len(r)-1] != "files" {
+ t.Fatal()
+ }
+}
diff --git a/model/system.go b/model/system.go
index b387749f6..68d542c15 100644
--- a/model/system.go
+++ b/model/system.go
@@ -9,10 +9,11 @@ import (
)
const (
- SYSTEM_DIAGNOSTIC_ID = "DiagnosticId"
- SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
- SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
- SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
+ SYSTEM_DIAGNOSTIC_ID = "DiagnosticId"
+ SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
+ SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
+ SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
+ SYSTEM_LAST_COMPLIANCE_TIME = "LastComplianceTime"
)
type System struct {