Page MenuHomePhabricator

[services] new DB client method to get userID for a given username
ClosedPublic

Authored by varun on Jul 27 2022, 2:05 PM.
Tags
None
Referenced Files
F3157030: D4657.id15026.diff
Tue, Nov 5, 6:57 PM
F3156988: D4657.id15070.diff
Tue, Nov 5, 6:46 PM
F3156809: D4657.id15027.diff
Tue, Nov 5, 5:33 PM
Unknown Object (File)
Sun, Oct 27, 6:19 PM
Unknown Object (File)
Sun, Oct 27, 6:19 PM
Unknown Object (File)
Sun, Oct 27, 6:19 PM
Unknown Object (File)
Sun, Oct 27, 6:19 PM
Unknown Object (File)
Sun, Oct 27, 6:16 PM

Details

Summary

Using the username-index on the identity-users table, query for an item with the given username and return the corresponding userID

Depends on D4656

Test Plan

used client method to return a userID from DDB

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

varun requested review of this revision.Jul 27 2022, 2:19 PM

Extend the method to work for look up by wallet address too

tomek added inline comments.
services/identity/src/database.rs
235–242 ↗(On Diff #15027)

I don't think that using if is a good idea here as the compiler doesn't enforce that all the enums are used. This is a big issue if we ever decide to introduce new AuthType. We should use match instead.

258 ↗(On Diff #15027)

Maybe == 0?

267 ↗(On Diff #15027)

Why do we remove here?

This revision is now accepted and ready to land.Jul 28 2022, 2:43 AM
services/identity/src/database.rs
235–242 ↗(On Diff #15027)

good point

258 ↗(On Diff #15027)

sure

267 ↗(On Diff #15027)

get() only gives us a reference to the AttributeValue, whereas remove is owned