github.com/jlevesy/mattermost-server@v5.3.2-0.20181003190404-7468f35cb0c8+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  	result := <-a.Srv.Store.Audit().Get(userId, 0, limit)
    12  	if result.Err != nil {
    13  		return nil, result.Err
    14  	}
    15  	return result.Data.(model.Audits), nil
    16  }
    17  
    18  func (a *App) GetAuditsPage(userId string, page int, perPage int) (model.Audits, *model.AppError) {
    19  	result := <-a.Srv.Store.Audit().Get(userId, page*perPage, perPage)
    20  	if result.Err != nil {
    21  		return nil, result.Err
    22  	}
    23  	return result.Data.(model.Audits), nil
    24  }