feat: added new commands

- added follow command
- added unfollow command
- following command
- introduced logged in user middleware
This commit is contained in:
Stevan Freeborn
2026-08-02 07:49:57 -05:00
parent c012f6008c
commit f51b1b941a
8 changed files with 331 additions and 9 deletions
+20
View File
@@ -0,0 +1,20 @@
package command
import (
"context"
"github.com/StevanFreeborn/gator/internal/database"
"github.com/StevanFreeborn/gator/internal/state"
)
func requiresLoggedInUser(handler func(*state.State, database.User) error) CommandHandler {
return func(s *state.State) error {
loggedInUser, err := s.GetCurrentUser(context.Background())
if err != nil {
return err
}
return handler(s, loggedInUser)
}
}