tabby icon indicating copy to clipboard operation
tabby copied to clipboard

feat(ee): add `name` field for user model, add api to update it

Open darknight opened this issue 1 year ago • 5 comments

For closing https://github.com/TabbyML/tabby/issues/2054

  • add new migration to alter users table

    • name could be NULL for back compatibility
  • update UserDAO to add name field, add update_user_name to execute SQL UPDATE

  • implement new endpoint update_user_name for AuthenticationService

  • implement new mutation endpoint update_user_name

  • run make update-db-schema to update ee/tabby-db/schema/schema.sql & ee/tabby-db/schema/schema.svg

  • run tabby-schema/examples/update-schema.rs to update schema.graphql file

  • udpate README

darknight avatar May 12 '24 08:05 darknight

Manual test result:

Screenshot 2024-05-12 161217 Screenshot 2024-05-12 161235

darknight avatar May 12 '24 08:05 darknight

autofix failed due to

error[E0601]: `main` function not found in crate `tabby`

cargo_bloat failed due to

Resource not accessible by integration

Test coverage failed due to:

There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 429 - {'detail': ErrorDetail(string='Rate limit reached. Please upload with the Codecov repository upload token to resolve issue. Expected time to availability: 678s.', code='throttled')}

All of errors seem irrelevant to my change

darknight avatar May 12 '24 08:05 darknight

code coverage report Rate limit reached error, and cargo bloat report Resource not accessible by integration. I suspect this is due to external pull request from forked repository, but not very sure about it.

darknight avatar May 13 '24 16:05 darknight

Otherwise LGTM.

As a followup, please fill user.name field when user registered from oauth identity providers.

Correct me if I'm wrong, currently when user register from oauth, we only fetch user email info then create user accordingly. Now we also want to fetch username info, and call update_user_name during the register process?

One more concern is, in this PR I didn't put UNIQUE constraint on the new name field, just like email or auth_token, this is more like product decision, may need your suggestion. cc: @wsxiaoys

darknight avatar May 14 '24 17:05 darknight

Please also rebase against main

wsxiaoys avatar May 15 '24 16:05 wsxiaoys