2025-04-27 16:38:34 +05:30
|
|
|
package preference
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"github.com/SigNoz/signoz/pkg/types/preferencetypes"
|
2025-06-06 22:38:28 +05:30
|
|
|
"github.com/SigNoz/signoz/pkg/valuer"
|
2025-04-27 16:38:34 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Module interface {
|
2025-06-06 22:38:28 +05:30
|
|
|
// Returns all preferences for the given organization
|
|
|
|
|
ListByOrg(context.Context, valuer.UUID) ([]*preferencetypes.Preference, error)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
2025-06-06 22:38:28 +05:30
|
|
|
// Returns the preference for the given organization by name.
|
|
|
|
|
GetByOrg(context.Context, valuer.UUID, preferencetypes.Name) (*preferencetypes.Preference, error)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
2025-06-06 22:38:28 +05:30
|
|
|
// Updates the preference for the given organization
|
|
|
|
|
UpdateByOrg(context.Context, valuer.UUID, preferencetypes.Name, any) error
|
2025-04-27 16:38:34 +05:30
|
|
|
|
|
|
|
|
// Returns all preferences for the given user
|
2025-06-06 22:38:28 +05:30
|
|
|
ListByUser(context.Context, valuer.UUID) ([]*preferencetypes.Preference, error)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
2025-06-06 22:38:28 +05:30
|
|
|
// Returns the preference for the given user by name.
|
|
|
|
|
GetByUser(context.Context, valuer.UUID, preferencetypes.Name) (*preferencetypes.Preference, error)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
|
|
|
|
// Updates the preference for the given user
|
2025-06-06 22:38:28 +05:30
|
|
|
UpdateByUser(context.Context, valuer.UUID, preferencetypes.Name, any) error
|
2025-04-27 16:38:34 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Handler interface {
|
|
|
|
|
// Returns the preference for the given organization
|
2025-06-06 22:38:28 +05:30
|
|
|
GetByOrg(http.ResponseWriter, *http.Request)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
|
|
|
|
// Updates the preference for the given organization
|
2025-06-06 22:38:28 +05:30
|
|
|
UpdateByOrg(http.ResponseWriter, *http.Request)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
|
|
|
|
// Returns all preferences for the given organization
|
2025-06-06 22:38:28 +05:30
|
|
|
ListByOrg(http.ResponseWriter, *http.Request)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
|
|
|
|
// Returns the preference for the given user
|
2025-06-06 22:38:28 +05:30
|
|
|
GetByUser(http.ResponseWriter, *http.Request)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
|
|
|
|
// Updates the preference for the given user
|
2025-06-06 22:38:28 +05:30
|
|
|
UpdateByUser(http.ResponseWriter, *http.Request)
|
2025-04-27 16:38:34 +05:30
|
|
|
|
|
|
|
|
// Returns all preferences for the given user
|
2025-06-06 22:38:28 +05:30
|
|
|
ListByUser(http.ResponseWriter, *http.Request)
|
2025-04-27 16:38:34 +05:30
|
|
|
}
|