|
@@ -0,0 +1,40 @@
|
|
|
|
|
+package handlers
|
|
|
|
|
+
|
|
|
|
|
+import (
|
|
|
|
|
+ "context"
|
|
|
|
|
+
|
|
|
|
|
+ "gogs.fxtmmsk.ru/foxtime/photoplaces/backend/internal/models"
|
|
|
|
|
+ "gogs.fxtmmsk.ru/foxtime/photoplaces/backend/internal/services"
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+type PlaceService interface {
|
|
|
|
|
+ List(ctx context.Context, filter models.PlaceFilter) (*models.PaginatedPlaces, error)
|
|
|
|
|
+ GetByID(ctx context.Context, id string, fetchTags bool) (*models.Place, error)
|
|
|
|
|
+ Create(ctx context.Context, input services.CreatePlaceInput) (*models.Place, error)
|
|
|
|
|
+ Update(ctx context.Context, input services.UpdatePlaceInput, isModerator bool) (*models.Place, error)
|
|
|
|
|
+ Delete(ctx context.Context, id, userID string) error
|
|
|
|
|
+ Moderate(ctx context.Context, id, action, comment, moderatorID string) error
|
|
|
|
|
+ HardDelete(ctx context.Context, id, moderatorID string) error
|
|
|
|
|
+ Restore(ctx context.Context, id, moderatorID string) error
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+type AuthService interface {
|
|
|
|
|
+ Register(ctx context.Context, input services.RegisterInput) (*services.AuthResult, string, error)
|
|
|
|
|
+ Login(ctx context.Context, input services.LoginInput) (*services.AuthResult, string, error)
|
|
|
|
|
+ RefreshSession(ctx context.Context, plainRefreshToken string) (*services.AuthResult, string, error)
|
|
|
|
|
+ RevokeSession(ctx context.Context, plainRefreshToken string) error
|
|
|
|
|
+ GetUser(ctx context.Context, userID string) (*models.User, error)
|
|
|
|
|
+ ValidateAccessToken(tokenString string) (*services.TokenClaims, error)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+type UserRepo interface {
|
|
|
|
|
+ GetByID(ctx context.Context, id string) (*models.User, error)
|
|
|
|
|
+ GetByEmail(ctx context.Context, email string) (*models.User, error)
|
|
|
|
|
+ Create(ctx context.Context, user *models.User) error
|
|
|
|
|
+ Update(ctx context.Context, user *models.User) error
|
|
|
|
|
+ UpdateRole(ctx context.Context, id, role string) error
|
|
|
|
|
+ UpdateStatus(ctx context.Context, id, status string) error
|
|
|
|
|
+ HasSuperadmin(ctx context.Context) (bool, error)
|
|
|
|
|
+ CountByRole(ctx context.Context, role string) (int, error)
|
|
|
|
|
+ List(ctx context.Context, filter models.UserFilter) ([]*models.User, error)
|
|
|
|
|
+}
|