LibraryElements: export GetAllElements to service (#93782)

This commit is contained in:
Matheus Macabu 2024-09-27 08:48:56 +02:00 committed by GitHub
parent 87c81825b7
commit 40bcd0df41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -1081,3 +1081,8 @@ func (l *mockLibraryElementService) DisconnectElementsFromDashboard(c context.Co
func (l *mockLibraryElementService) DeleteLibraryElementsInFolder(c context.Context, signedInUser identity.Requester, folderUID string) error {
return nil
}
// GetAll gets all library elements with support to query filters.
func (l *mockLibraryElementService) GetAllElements(c context.Context, signedInUser identity.Requester, query model.SearchLibraryElementsQuery) (model.LibraryElementSearchResult, error) {
return model.LibraryElementSearchResult{}, nil
}

View File

@ -40,6 +40,7 @@ type Service interface {
ConnectElementsToDashboard(c context.Context, signedInUser identity.Requester, elementUIDs []string, dashboardID int64) error
DisconnectElementsFromDashboard(c context.Context, dashboardID int64) error
DeleteLibraryElementsInFolder(c context.Context, signedInUser identity.Requester, folderUID string) error
GetAllElements(c context.Context, signedInUser identity.Requester, query model.SearchLibraryElementsQuery) (model.LibraryElementSearchResult, error)
}
// LibraryElementService is the service for the Library Element feature.
@ -85,6 +86,11 @@ func (l *LibraryElementService) DeleteLibraryElementsInFolder(c context.Context,
return l.deleteLibraryElementsInFolderUID(c, signedInUser, folderUID)
}
// GetAll gets all library elements with support to query filters.
func (l *LibraryElementService) GetAllElements(c context.Context, signedInUser identity.Requester, query model.SearchLibraryElementsQuery) (model.LibraryElementSearchResult, error) {
return l.getAllLibraryElements(c, signedInUser, query)
}
func (l *LibraryElementService) addUidToLibraryPanel(model []byte, newUid string) (json.RawMessage, error) {
var modelMap map[string]any
err := json.Unmarshal(model, &modelMap)