hunk.code_window: ifeq ($(BUILD_ENTERPRISE_READY),true)
   	$(GO) vet $(GOFLAGS) ./enterprise/account_migration || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/brand || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/cluster || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/compliance || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/data_retention || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/elasticsearch || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/emoji || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/imports || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/ldap || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/metrics || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/mfa || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/oauth/google || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/oauth/office365 || exit 1
   	$(GO) vet $(GOFLAGS) ./enterprise/saml || exit 1
   endif
   todo:
   	@! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime --ignore-dir webapp/non_npm_dependencies/ TODO
  
hunk.labels: keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep
hunk.after_edit: 	$(GO) vet $(GOFLAGS) $(EE_PACKAGES) || exit 1
  
hunk.file_path: Makefile
hunk.type: replace
file: // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
  // See License.txt for license information.
  
  package app
  
  import (
  	"github.com/mattermost/platform/model"
  	"github.com/mattermost/platform/jobs"
  )
  
  func GetJob(id string) (*model.Job, *model.AppError) {
  	if result := <-Srv.Store.Job().Get(id); result.Err != nil {
  		return nil, result.Err
  	} else {
  		return result.Data.(*model.Job), nil
  	}
  }
  
  func GetJobsPage(page int, perPage int) ([]*model.Job, *model.AppError) {
  	return GetJobs(page*perPage, perPage)
  }
  
  func GetJobs(offset int, limit int) ([]*model.Job, *model.AppError) {
  	if result := <-Srv.Store.Job().GetAllPage(offset, limit); result.Err != nil {
  		return nil, result.Err
  	} else {
  		return result.Data.([]*model.Job), nil
  	}
  }
  
  func GetJobsByTypePage(jobType string, page int, perPage int) ([]*model.Job, *model.AppError) {
  	return GetJobsByType(jobType, page*perPage, perPage)
  }
  
  func GetJobsByType(jobType string, offset int, limit int) ([]*model.Job, *model.AppError) {
  	if result := <-Srv.Store.Job().GetAllByTypePage(jobType, offset, limit); result.Err != nil {
  		return nil, result.Err
  	} else {
  		return result.Data.([]*model.Job), nil
  	}
  }
  
  func CreateJob(job *model.Job) (*model.Job, *model.AppError) {
  	return jobs.CreateJob(job.Type, job.Data)
  }
  
  func CancelJob(jobId string) *model.AppError {
  	return jobs.RequestCancellation(jobId)
  }
  