Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base server #1

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Base server #1

wants to merge 12 commits into from

Conversation

ShamanEstBanan
Copy link
Owner

@ShamanEstBanan ShamanEstBanan commented Apr 16, 2023

  • рабочий сервер для хранения данных
  • протокол gRPC+TLS
  • база Postgres и миграции через Goose
  • отдельные Auth и Keeper GRPC-подсерверы, чтобы отвязать proto-файлы для возможного масштабирования авторизации
  • данные можно : создать, получить, редактировать, удалять, получить все записи юзера, получить все записи определенного типа
  • покрыл часть методов юнит-тестами (но не все, по времени не успеваю сделать норм покрытие)

Copy link

@bambruysk bambruysk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В целом неплохо. Мелкие правки и вперед к дальнейшему развитию!

Comment on lines +38 to +46
if errors.Is(err, errs.ErrLoginIsEmpty) ||
errors.Is(err, errs.ErrPasswordIsEmpty) ||
errors.Is(err, errs.ErrInvalidLoginOrPassword) {
return nil, status.Error(codes.InvalidArgument, err.Error())
} else if errors.Is(err, errs.ErrLoginAlreadyExist) {
return nil, status.Error(codes.AlreadyExists, err.Error())
} else {
return nil, status.Error(codes.Internal, "internal problem")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это все лучше заменить на switch

return nil, status.Error(codes.Internal, "internal problem")
}
}
if err != nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем второй раз чекать?

Comment on lines +4 to +12
"ShamanEstBanan-GophKeeper-server/internal/domain/entity"
"ShamanEstBanan-GophKeeper-server/internal/errs"
pb "ShamanEstBanan-GophKeeper-server/internal/proto"
mainService "ShamanEstBanan-GophKeeper-server/internal/server/authServer/mock"
"context"
"errors"
"github.com/golang/mock/gomock"
"reflect"
"testing"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не рассортированы импорты

// UnimplementedKeeperServiceServer pb.UnimplementedKeeperServiceServer
// }
// type args struct {
// ctx context.Context

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не надо коммитить закомментированный код

Comment on lines +74 to +75
switch e := err.(type) {
case *pgconn.PgError:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше использовать errors.As

Comment on lines +1 to +23
syntax = "proto3";

package gophKeeper.proto;

option go_package = "./";

message GetAllRecordsRequest{
}

message GetAllRecordsResponse{
message Record{
string id = 1;
string name = 2;
string type = 3;
}
repeated Record records = 1;
}

message GetRecordsByTypeRequest{
string type = 1;
}

message GetRecordsByTypeResponse{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proto хорошо написаны

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants