Implement compliance endpoints for APIv4 (#5683)

* Implement compliance endpoints for APIv4

* Add paging to get reports endpoint
Этот коммит содержится в:
Joram Wilander
2017-03-13 10:14:16 -04:00
коммит произвёл GitHub
родитель a284cd8c18
Коммит 3ebfb36953
11 изменённых файлов: 241 добавлений и 9 удалений

Просмотреть файл

@@ -87,17 +87,17 @@ func (us SqlComplianceStore) Update(compliance *model.Compliance) StoreChannel {
return storeChannel
}
func (s SqlComplianceStore) GetAll() StoreChannel {
func (s SqlComplianceStore) GetAll(offset, limit int) StoreChannel {
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
query := "SELECT * FROM Compliances ORDER BY CreateAt DESC"
query := "SELECT * FROM Compliances ORDER BY CreateAt DESC LIMIT :Limit OFFSET :Offset"
var compliances model.Compliances
if _, err := s.GetReplica().Select(&compliances, query); err != nil {
if _, err := s.GetReplica().Select(&compliances, query, map[string]interface{}{"Offset": offset, "Limit": limit}); err != nil {
result.Err = model.NewLocAppError("SqlComplianceStore.Get", "store.sql_compliance.get.finding.app_error", nil, err.Error())
} else {
result.Data = compliances