chore: update admin apis
This commit is contained in:
@@ -23,13 +23,28 @@ var ErrAdminUserNotFound = errors.New("user not found")
|
||||
type AdminService struct {
|
||||
repo *repository.AdminRepo
|
||||
notif *NotificationService
|
||||
feedback *FeedbackService
|
||||
mail mailer.Mailer
|
||||
logger *zap.Logger
|
||||
frontendURL string
|
||||
}
|
||||
|
||||
func NewAdminService(repo *repository.AdminRepo, notif *NotificationService, mail mailer.Mailer, logger *zap.Logger, frontendURL string) *AdminService {
|
||||
return &AdminService{repo: repo, notif: notif, mail: mail, logger: logger, frontendURL: frontendURL}
|
||||
func NewAdminService(repo *repository.AdminRepo, notif *NotificationService, feedback *FeedbackService, mail mailer.Mailer, logger *zap.Logger, frontendURL string) *AdminService {
|
||||
return &AdminService{repo: repo, notif: notif, feedback: feedback, mail: mail, logger: logger, frontendURL: frontendURL}
|
||||
}
|
||||
|
||||
// AcknowledgeFeedback marks a feedback row acknowledged and emails the author
|
||||
// that we've seen it. Reuses FeedbackService so the email is identical to the
|
||||
// (now removed) public /stats action. Returns ErrAlreadyAcknowledged when the
|
||||
// row was already acknowledged.
|
||||
func (s *AdminService) AcknowledgeFeedback(ctx context.Context, id string) error {
|
||||
return s.feedback.Acknowledge(ctx, id)
|
||||
}
|
||||
|
||||
// ResolveFeedback marks a feedback row resolved and emails the author a
|
||||
// thank-you. Returns ErrAlreadyResolved when the row was already resolved.
|
||||
func (s *AdminService) ResolveFeedback(ctx context.Context, id string) error {
|
||||
return s.feedback.Resolve(ctx, id)
|
||||
}
|
||||
|
||||
func (s *AdminService) ListUsers(ctx context.Context, q string, limit, offset int) ([]model.AdminUser, int, error) {
|
||||
|
||||
Reference in New Issue
Block a user