summaryrefslogtreecommitdiffstats
path: root/app/job.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/job.go')
-rw-r--r--app/job.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/job.go b/app/job.go
new file mode 100644
index 000000000..00439e4d2
--- /dev/null
+++ b/app/job.go
@@ -0,0 +1,28 @@
+// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package app
+
+import (
+ "github.com/mattermost/platform/model"
+)
+
+func GetJobStatus(id string) (*model.JobStatus, *model.AppError) {
+ if result := <-Srv.Store.JobStatus().Get(id); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.JobStatus), nil
+ }
+}
+
+func GetJobStatusesByTypePage(jobType string, page int, perPage int) ([]*model.JobStatus, *model.AppError) {
+ return GetJobStatusesByType(jobType, page*perPage, perPage)
+}
+
+func GetJobStatusesByType(jobType string, offset int, limit int) ([]*model.JobStatus, *model.AppError) {
+ if result := <-Srv.Store.JobStatus().GetAllByTypePage(jobType, offset, limit); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.([]*model.JobStatus), nil
+ }
+}