Dashboards: Split GetDashboardVersions method (#49967)

* Split GetDashboarVersions method

* Add sqlstore dialect and tests

* Fix signature of PAtchPreference

* Add GetDialect to sqlstore and remove GetDashboardVersions

* Add GetDialect to db interface

* Implement List

* add deleted test function

* Remove GetDialect from sqlstore interface

* Remove deleted method from mock

* Refactor test
This commit is contained in:
idafurjes
2022-06-02 15:59:05 +02:00
committed by GitHub
parent 3e81fa0716
commit bdf50f3dd2
16 changed files with 284 additions and 175 deletions
@@ -20,7 +20,8 @@ type Service struct {
func ProvideService(db db.DB) dashver.Service {
return &Service{
store: &sqlStore{
db: db,
db: db,
dialect: db.GetDialect(),
},
}
}
@@ -63,3 +64,11 @@ func (s *Service) DeleteExpired(ctx context.Context, cmd *dashver.DeleteExpiredV
}
return nil
}
// List all dashboard versions for the given dashboard ID.
func (s *Service) List(ctx context.Context, query *dashver.ListDashboardVersionsQuery) ([]*dashver.DashboardVersionDTO, error) {
if query.Limit == 0 {
query.Limit = 1000
}
return s.store.List(ctx, query)
}