github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/app/audit.go (about)

     1  // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package app
     5  
     6  import (
     7  	"github.com/mattermost/mattermost-server/model"
     8  )
     9  
    10  func (a *App) GetAudits(userId string, limit int) (model.Audits, *model.AppError) {
    11  	if result := <-a.Srv.Store.Audit().Get(userId, 0, limit); result.Err != nil {
    12  		return nil, result.Err
    13  	} else {
    14  		return result.Data.(model.Audits), nil
    15  	}
    16  }
    17  
    18  func (a *App) GetAuditsPage(userId string, page int, perPage int) (model.Audits, *model.AppError) {
    19  	if result := <-a.Srv.Store.Audit().Get(userId, page*perPage, perPage); result.Err != nil {
    20  		return nil, result.Err
    21  	} else {
    22  		return result.Data.(model.Audits), nil
    23  	}
    24  }