chore: rename workspace service

This commit is contained in:
Steven
2023-09-21 08:25:55 +08:00
parent 763205a89b
commit 271c133913
11 changed files with 342 additions and 344 deletions

View File

@ -31,7 +31,7 @@ func NewAPIV2Service(secret string, profile *profile.Profile, store *store.Store
authProvider.AuthenticationInterceptor,
),
)
apiv2pb.RegisterWorkspaceSettingServiceServer(grpcServer, NewWorkspaceSettingService(store))
apiv2pb.RegisterWorkspaceServiceServer(grpcServer, NewWorkspaceService(store))
apiv2pb.RegisterUserServiceServer(grpcServer, NewUserService(secret, store))
apiv2pb.RegisterUserSettingServiceServer(grpcServer, NewUserSettingService(store))
apiv2pb.RegisterShortcutServiceServer(grpcServer, NewShortcutService(secret, store))
@ -64,7 +64,7 @@ func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) error
}
gwMux := grpcRuntime.NewServeMux()
if err := apiv2pb.RegisterWorkspaceSettingServiceHandler(context.Background(), gwMux, conn); err != nil {
if err := apiv2pb.RegisterWorkspaceServiceHandler(context.Background(), gwMux, conn); err != nil {
return err
}
if err := apiv2pb.RegisterUserServiceHandler(context.Background(), gwMux, conn); err != nil {

View File

@ -10,20 +10,20 @@ import (
"google.golang.org/grpc/status"
)
type WorkspaceSettingService struct {
apiv2pb.UnimplementedWorkspaceSettingServiceServer
type WorkspaceService struct {
apiv2pb.UnimplementedWorkspaceServiceServer
Store *store.Store
}
// NewWorkspaceSettingService creates a new WorkspaceSettingService.
func NewWorkspaceSettingService(store *store.Store) *WorkspaceSettingService {
return &WorkspaceSettingService{
// NewWorkspaceService creates a new WorkspaceService.
func NewWorkspaceService(store *store.Store) *WorkspaceService {
return &WorkspaceService{
Store: store,
}
}
func (s *WorkspaceSettingService) GetWorkspaceSetting(ctx context.Context, _ *apiv2pb.GetWorkspaceSettingRequest) (*apiv2pb.GetWorkspaceSettingResponse, error) {
func (s *WorkspaceService) GetWorkspaceSetting(ctx context.Context, _ *apiv2pb.GetWorkspaceSettingRequest) (*apiv2pb.GetWorkspaceSettingResponse, error) {
isAdmin := false
userID, ok := ctx.Value(userIDContextKey).(int32)
if ok {
@ -61,7 +61,7 @@ func (s *WorkspaceSettingService) GetWorkspaceSetting(ctx context.Context, _ *ap
}, nil
}
func (s *WorkspaceSettingService) UpdateWorkspaceSetting(ctx context.Context, request *apiv2pb.UpdateWorkspaceSettingRequest) (*apiv2pb.UpdateWorkspaceSettingResponse, error) {
func (s *WorkspaceService) UpdateWorkspaceSetting(ctx context.Context, request *apiv2pb.UpdateWorkspaceSettingRequest) (*apiv2pb.UpdateWorkspaceSettingResponse, error) {
if request.UpdateMask == nil || len(request.UpdateMask) == 0 {
return nil, status.Errorf(codes.InvalidArgument, "update mask is empty")
}