-
Notifications
You must be signed in to change notification settings - Fork 669
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
NOISSUE - Rename package aliases uuidProvider into uuid #1323
Conversation
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 I understand well, this is to remove dependency against Mainflux UUID provider?
However, I am afraid that whoever starts removing Mainflux UUID provider and replacing it with the ULID will completely forget and miss this file, as it will be no longer using it.
his is why I prefer keeping dependency, and reminding that the more general task should be undertaken - overall switch to ULID.
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #1323 +/- ##
=======================================
Coverage 59.89% 59.90%
=======================================
Files 113 113
Lines 8835 8836 +1
=======================================
+ Hits 5292 5293 +1
Misses 3081 3081
Partials 462 462
Continue to review full report at Codecov.
|
readers/postgres/messages_test.go
Outdated
@@ -38,13 +38,13 @@ var ( | |||
func TestReadSenml(t *testing.T) { | |||
writer := pwriter.New(db) | |||
|
|||
chanID, err := uuidProvider.New().ID() | |||
chanID, err := uuid.New().ID() |
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.
There is no need to instantiate a new ID provider for each ID. You can create one provider and use it for all IDs in this test. Check all the other places in tests where you have multiple instances.
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
auth/postgres/key_test.go
Outdated
"github.com/stretchr/testify/require" | ||
) | ||
|
||
const ( |
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.
const email = "user-save@example.com"
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
users/service.go
Outdated
hasher Hasher | ||
email Emailer | ||
auth mainflux.AuthServiceClient | ||
uuidProvider mainflux.IDProvider |
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.
This is not necessarily a UUID provider (we'll switch to ULID soon) and the underlying format should be transparent to the Users service (that's one of the reasons we use the interface), so idp
or idProvider
sounds like a better naming.
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.
Right, let's follow interface naming.
users/service.go
Outdated
@@ -186,7 +187,7 @@ func (svc usersService) Register(ctx context.Context, user User) (string, error) | |||
return "", errors.Wrap(ErrMalformedEntity, err) | |||
} | |||
user.Password = hash | |||
uid, err := uuidProvider.New().ID() | |||
uid, err := svc.uuidProvider.ID() |
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.
I'm glad you fixed this, it was a horrible mistake.
cmd/users/main.go
Outdated
@@ -284,7 +285,9 @@ func newService(db *sqlx.DB, tracer opentracing.Tracer, auth mainflux.AuthServic | |||
logger.Error(fmt.Sprintf("Failed to configure e-mailing util: %s", err.Error())) | |||
} | |||
|
|||
svc := users.New(userRepo, groupRepo, hasher, auth, emailer) | |||
uuidProvider := uuid.New() |
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.
Since we are using hasher
as an instance of the hasher (bcrypt
), we should do the same for the ID provider. We don't really care what's the underlying implementation.
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
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.
LGTM
* NOISSUE - Rename pkg aliases uuidProvider into uuid and fix authn typo Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add missing error checks Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use global uuidProvider Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use expTime globally Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix user uuid provider Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix review Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use idProvider name Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use idProvider instead of uuidProvider Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use idProvider instead of uuidProvider Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: Manuel Imperiale manuel.imperiale@gmail.com