-
Notifications
You must be signed in to change notification settings - Fork 649
Add token_count
to GET /api/v1/me
response
#3071
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
Changes from all commits
5bab212
099e402
974caff
ded1aa4
aaee1c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,12 @@ pub struct OwnedCrate { | |
pub struct EncodableMe { | ||
pub user: EncodablePrivateUser, | ||
pub owned_crates: Vec<OwnedCrate>, | ||
pub meta: EncodableMeMeta, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone, Copy)] | ||
pub struct EncodableMeMeta { | ||
pub token_count: i64, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder, what's the criteria for information being in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for asking this question. when I was working on this it seemed obvious to me, but now I'm not so sure anymore either. 😅 I'm now wondering if it would be better to instead include the list of token IDs, like in a proper relationship declaration, but that would probably slightly slow down the query and for what we're trying to build it doesn't make a difference. Maybe my confusion comes from using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about this a little bit more. I think my reason for putting this in
I guess it would be best if this was encoded as a proper relationship instead |
||
} | ||
|
||
/// The serialization format for the `User` model. | ||
|
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 think it would make me feel better if one of the tokens in the test was revoked and we asserted that it didn't count towards this total.
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.
thinking some more about it, I wonder if this
revoked: false
query really makes sense for us here. if our primary goal is to teach the user that he needs to create his first token to interact withcargo
then, if he has a revoked token already, he apparently doesn't need to be taught this anymore :D