Skip to content

Commit d653a26

Browse files
committed
allow user nickname
1 parent a6f2483 commit d653a26

17 files changed

Lines changed: 479 additions & 35 deletions

File tree

cmd/server/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func main() {
6363
authGroup.POST("/login", authHandler.Login)
6464
authGroup.POST("/logout", authHandler.Logout)
6565
authGroup.GET("/me", middleware.Auth(client), authHandler.Me)
66+
authGroup.PUT("/profile", middleware.Auth(client), authHandler.UpdateProfile)
6667
authGroup.PUT("/password", middleware.Auth(client), authHandler.ChangePassword)
6768

6869
// OIDC routes

ent/migrate/schema.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ent/mutation.go

Lines changed: 74 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ent/runtime.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ent/schema/user.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ func (User) Fields() []ent.Field {
2323
Unique().
2424
NotEmpty().
2525
Comment("用户名"),
26+
field.String("nickname").
27+
Optional().
28+
Comment("昵称/显示名"),
2629
field.String("password_hash").
2730
Default("").
2831
Comment("密码哈希 (OIDC用户可为空)"),
@@ -52,4 +55,4 @@ func (User) Indexes() []ent.Index {
5255
index.Fields("username").Unique(),
5356
index.Fields("session_token"),
5457
}
55-
}
58+
}

ent/user.go

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ent/user/user.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ent/user/where.go

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ent/user_create.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)