-
Notifications
You must be signed in to change notification settings - Fork 71
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
chore(services/user): migrate user-team-list proto op #1650
base: main
Are you sure you want to change the base?
Conversation
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Deploying rivet with Cloudflare Pages
|
06909a8
to
4c41e8e
Compare
4c41e8e
to
075a092
Compare
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 know this is still in progress, just providing some initial feedback. Feel free to ignore any changes you've already made. Really good stuff all around.
I only have nits to add on top of the comments i left:
- You can remove the leading
::
from all user pkg paths (::user::ops::get
->user::ops::get
) - Auto dereferencing should handle calls to
.op
in API services automatically, so you can change(*ctx)
to justctx
- The migration files from api-identity were moved to the wrong location, the entire folder at
packages/services/user-identity/db/user-identity
should be moved topackages/services/user/db/user-identity
- In the API layer we could change functions to accept an
OperationCtx
(new, from chirp-workflow) or aCtx
(from api-helper) instead of anOperationContext
(old) which would allow us to get rid ofcompat
calls and just do.op
. This is low priority though and isn't required
team_ids: team_ids | ||
.iter() | ||
.map(|id| (*id).into()) | ||
.collect::<Vec<common::Uuid>>() |
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.
Nit: you can leave out the type in .collect
statements if there is enough type info for the compiler to predict the type:
.collect::<Vec<common::Uuid>>() | |
.collect::<Vec<_>>() |
or even
.collect::<Vec<common::Uuid>>() | |
.collect::<_>() |
chirp_workflow::compat::op( | ||
&ctx, | ||
::user::ops::identity::create::Input { | ||
user_id: primary_user_id, | ||
identity: backend::user_identity::Identity { | ||
kind: Some(backend::user_identity::identity::Kind::Email(backend::user_identity::identity::Email { | ||
email: util::faker::email() | ||
})) | ||
} | ||
} | ||
) |
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.
Standalone services should be converted to use the new contexts as well, that way you dont have to use compat
. See cluster-gc
for an example. You'll have to change the ctx
variable above to use StandaloneCtx
chirp_workflow::compat::op( | ||
&ctx, | ||
::user::ops::identity::create::Input { | ||
user_id: primary_user_id, | ||
identity: backend::user_identity::Identity { | ||
kind: Some(backend::user_identity::identity::Kind::Email(backend::user_identity::identity::Email { | ||
email: util::faker::email() | ||
})) | ||
} | ||
} | ||
) |
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.
See above comment
|
||
#[derive(Debug)] | ||
pub struct Output { | ||
pub users: Vec<backend::user::User> |
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.
The User
type should be converted from proto to rust. It looks like you already know the drill given the team_list
op 👍
#[derive(Debug)] | ||
pub struct Input { | ||
pub user_id: Uuid, | ||
pub identity: backend::user_identity::Identity, |
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.
Type should be converted from proto to rust
#[derive(Debug)] | ||
pub struct User { | ||
pub user_id: Uuid, | ||
pub identities: Vec<backend::user_identity::Identity> |
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.
See above comment
|
||
#[derive(Debug)] | ||
pub struct Output { | ||
pub errors: Vec<common::ValidationError>, |
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.
Should be converted to rust type
#[derive(Debug)] | ||
pub struct Input { | ||
pub user_id: Uuid, | ||
pub client: backend::net::ClientInfo, |
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.
Should be converted to rust type
|
||
let res = ctx.op(::user::ops::token_create::Input { | ||
user_id: user_id, | ||
client: backend::net::ClientInfo {..Default::default()} |
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.
client: backend::net::ClientInfo {..Default::default()} | |
client: backend::net::ClientInfo::default() |
e508246
to
ec88581
Compare
ec88581
to
d8bc66a
Compare
d8bc66a
to
6fb3d05
Compare
6fb3d05
to
c1c6586
Compare
c1c6586
to
2c153f0
Compare
Changes