#4 - reset users
This commit is contained in:
22
internal/handlers/resetUsersHandler.go
Normal file
22
internal/handlers/resetUsersHandler.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/rdarius/boot-dev-blog-aggregator/internal/config"
|
||||
"os"
|
||||
)
|
||||
|
||||
func ResetUsersHandler(s *config.State, cmd config.Command) error {
|
||||
ctx := context.Background()
|
||||
|
||||
err := s.DB.ResetUsers(ctx)
|
||||
if err != nil {
|
||||
fmt.Println("Failed to remove users")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Println("Users removed")
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user