-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Base server #1
Conversation
ShamanEstBanan
commented
Apr 16, 2023
•
edited
Loading
edited
- рабочий сервер для хранения данных
- протокол gRPC+TLS
- база Postgres и миграции через Goose
- отдельные Auth и Keeper GRPC-подсерверы, чтобы отвязать proto-файлы для возможного масштабирования авторизации
- данные можно : создать, получить, редактировать, удалять, получить все записи юзера, получить все записи определенного типа
- покрыл часть методов юнит-тестами (но не все, по времени не успеваю сделать норм покрытие)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В целом неплохо. Мелкие правки и вперед к дальнейшему развитию!
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") | ||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем второй раз чекать?
"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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не рассортированы импорты
internal/server/record_test.go
Outdated
// UnimplementedKeeperServiceServer pb.UnimplementedKeeperServiceServer | ||
// } | ||
// type args struct { | ||
// ctx context.Context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не надо коммитить закомментированный код
switch e := err.(type) { | ||
case *pgconn.PgError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше использовать errors.As
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{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proto хорошо написаны