Skip to content
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

Replace PublicUserType with models.PublicUser type #355

Open
wants to merge 1 commit into
base: refactor/public_user_model
Choose a base branch
from

Conversation

ajlacey
Copy link
Collaborator

@ajlacey ajlacey commented Sep 29, 2024

This PR uses the new PublicUser type from the model in the user handlers.

Comment on lines -58 to -61
if err != nil {
http.Error(w, "Error retrieving number of users.", http.StatusInternalServerError)
return
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no errors currently returned by the call to GetNumMarketUsers(bets)

Comment on lines -13 to -27
// PublicUserType is a struct for user data that is safe to send to the client for Profiles
type PublicUserType struct {
Username string `json:"username"`
DisplayName string `json:"displayname" gorm:"unique;not null"`
UserType string `json:"usertype"`
InitialAccountBalance int64 `json:"initialAccountBalance"`
AccountBalance int64 `json:"accountBalance"`
PersonalEmoji string `json:"personalEmoji,omitempty"`
Description string `json:"description,omitempty"`
PersonalLink1 string `json:"personalink1,omitempty"`
PersonalLink2 string `json:"personalink2,omitempty"`
PersonalLink3 string `json:"personalink3,omitempty"`
PersonalLink4 string `json:"personalink4,omitempty"`
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these fields are just being re-declared from the model. By making them a component type of the model User, we can access them all together.

Copy link
Collaborator

@j4qfrost j4qfrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM, just a lift and shift right?

@ajlacey
Copy link
Collaborator Author

ajlacey commented Sep 29, 2024

LTGM, just a lift and shift right?

Yeah, this is just how the changes to the model in #354 are going to be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants