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

Feat/user #1

Merged
merged 16 commits into from
Aug 14, 2024
Merged

Feat/user #1

merged 16 commits into from
Aug 14, 2024

Conversation

victorzhu30
Copy link
Contributor

@victorzhu30 victorzhu30 commented Aug 7, 2024

Reorganized the user routes, implemented most of the handlers(except watch/unwatch feature) related to the user feature, revised user DTO models according to the frontend model fields and expanded the functionality of repository/user.go

@victorzhu30 victorzhu30 requested a review from dujiajun August 9, 2024 15:54
@victorzhu30 victorzhu30 closed this Aug 9, 2024
@victorzhu30 victorzhu30 reopened this Aug 9, 2024
.idea/.gitignore Outdated Show resolved Hide resolved
model/converter/user.go Outdated Show resolved Hide resolved
model/converter/user.go Outdated Show resolved Hide resolved
model/converter/user.go Outdated Show resolved Hide resolved
model/converter/user.go Show resolved Hide resolved
repository/user.go Show resolved Hide resolved
router.go Outdated
@@ -47,9 +47,13 @@ func registerRouter(r *gin.Engine) {
userGroup := needAuthGroup.Group("/user")
userGroup.GET("", handler.GetUserListHandler)
userGroup.GET("/suggest", handler.GetSuggestedUserHandler)
userGroup.GET("/me", handler.GetCurrentUserHandler)
userGroup.GET("/:userID", handler.GetUserDetailHandler)
userGroup.GET("/me", handler.GetCurrentUserSummaryHandler)
Copy link
Contributor

Choose a reason for hiding this comment

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

me感觉可以去掉,统一用 /:userID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

前端个人页面的概览部分其他用户是否被允许访问?对应GetCurrentUserSummaryHandler
有这些数据:

export type UserSummaryProps = {
  review_count: number;
  like_receive: number;
  tip_receive: number;
  following_course_count: number;
};

如果允许的话我就改一下,或者加个鉴权?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我暂时设置为了不允许访问,加了鉴权

export type UserDetailProps = {
  id: number;
  username: string;
  avatar: string;
  bio: string;
};

允许访问

export type UserProfileProps = {
  id: number;
  user_id: number;
  username: string;
  bio: string;
  email: string;
  avatar: string;
  role: string;
  department: string;
  major: string;
  grade: string;
}

不允许访问

Copy link
Contributor

Choose a reason for hiding this comment

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

需要鉴权的,本人和第三方视角的内容是不一样的。先这样吧,后面再调。

service/user.go Show resolved Hide resolved
service/user.go Outdated Show resolved Hide resolved
handler/user.go Outdated Show resolved Hide resolved
@dujiajun
Copy link
Contributor

别的没啥问题了,rebase 一下 main 然后过 ci 吧

…ailHandler and GetUserViewsHandler in \handler\user.go which are partially declared in commit bcba52e
- Renamed routes in userGroup
- Added a new '/user' route in adminGroup for displaying the user list
- Refined user-related handlers to improve readability
- Implemented authentication checks across user-related endpoints
…UserSummaryDTO func which caused cycle import
…function parameter in repository/user.go from value to reference
@dujiajun dujiajun merged commit 5ff2586 into main Aug 14, 2024
2 checks passed
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