ocket8888 commented on a change in pull request #3996: Rewrote /user/current to Go URL: https://github.com/apache/trafficcontrol/pull/3996#discussion_r356449549
########## File path: traffic_ops/traffic_ops_golang/dbhelpers/db_helpers.go ########## @@ -62,6 +62,35 @@ WHERE federation_deliveryservice.deliveryservice IN ( ) ` +const getUserByIDQuery = ` +SELECT tm_user.address_line1, + tm_user.address_line2, + tm_user.city, + tm_user.company, + tm_user.country, + tm_user.email, + tm_user.full_name, + tm_user.gid, + tm_user.id, + tm_user.new_user, + tm_user.phone_number, + tm_user.postal_code, + tm_user.public_ssh_key, + tm_user.registration_sent, + tm_user.role, + role.name AS role_name, + tm_user.state_or_province, + tenant.name AS tenant, + tm_user.tenant_id, + tm_user.token, + tm_user.uid, + tm_user.username +FROM tm_user +LEFT OUTER JOIN role ON role.id = tm_user.role +LEFT OUTER JOIN tenant ON tenant.id = tm_user.tenant_id Review comment: Well if there's a constraint that's pure API I'd prefer not to write SQL assuming it's true. Bad data exists, and I don't wanna introduce bugs. But I can make the tenant join `INNER` for sure. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
