feat: add "Full Name" field to user creation (#13659)

Adds the ability to specify "Full Name" (a.k.a. Name) when
creating users either via CLI or UI.
This commit is contained in:
Cian Johnston
2024-06-26 09:00:42 +01:00
committed by GitHub
parent 87ad560aff
commit 8a3592582b
33 changed files with 435 additions and 25 deletions
+1
View File
@@ -1122,6 +1122,7 @@ func (s *MethodTestSuite) TestUser() {
ID: u.ID,
Email: u.Email,
Username: u.Username,
Name: u.Name,
UpdatedAt: u.UpdatedAt,
}).Asserts(u, policy.ActionUpdatePersonal).Returns(u)
}))
+1
View File
@@ -289,6 +289,7 @@ func User(t testing.TB, db database.Store, orig database.User) database.User {
ID: takeFirst(orig.ID, uuid.New()),
Email: takeFirst(orig.Email, namesgenerator.GetRandomName(1)),
Username: takeFirst(orig.Username, namesgenerator.GetRandomName(1)),
Name: takeFirst(orig.Name, namesgenerator.GetRandomName(1)),
HashedPassword: takeFirstSlice(orig.HashedPassword, []byte(must(cryptorand.String(32)))),
CreatedAt: takeFirst(orig.CreatedAt, dbtime.Now()),
UpdatedAt: takeFirst(orig.UpdatedAt, dbtime.Now()),
+2
View File
@@ -322,6 +322,7 @@ func convertUsers(users []database.User, count int64) []database.GetUsersRow {
ID: u.ID,
Email: u.Email,
Username: u.Username,
Name: u.Name,
HashedPassword: u.HashedPassword,
CreatedAt: u.CreatedAt,
UpdatedAt: u.UpdatedAt,
@@ -6492,6 +6493,7 @@ func (q *FakeQuerier) InsertUser(_ context.Context, arg database.InsertUserParam
CreatedAt: arg.CreatedAt,
UpdatedAt: arg.UpdatedAt,
Username: arg.Username,
Name: arg.Name,
Status: database.UserStatusDormant,
RBACRoles: arg.RBACRoles,
LoginType: arg.LoginType,
+1
View File
@@ -330,6 +330,7 @@ func ConvertUserRows(rows []GetUsersRow) []User {
ID: r.ID,
Email: r.Email,
Username: r.Username,
Name: r.Name,
HashedPassword: r.HashedPassword,
CreatedAt: r.CreatedAt,
UpdatedAt: r.UpdatedAt,
+4 -1
View File
@@ -8917,6 +8917,7 @@ INSERT INTO
id,
email,
username,
name,
hashed_password,
created_at,
updated_at,
@@ -8924,13 +8925,14 @@ INSERT INTO
login_type
)
VALUES
($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id, email, username, hashed_password, created_at, updated_at, status, rbac_roles, login_type, avatar_url, deleted, last_seen_at, quiet_hours_schedule, theme_preference, name
($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING id, email, username, hashed_password, created_at, updated_at, status, rbac_roles, login_type, avatar_url, deleted, last_seen_at, quiet_hours_schedule, theme_preference, name
`
type InsertUserParams struct {
ID uuid.UUID `db:"id" json:"id"`
Email string `db:"email" json:"email"`
Username string `db:"username" json:"username"`
Name string `db:"name" json:"name"`
HashedPassword []byte `db:"hashed_password" json:"hashed_password"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
@@ -8943,6 +8945,7 @@ func (q *sqlQuerier) InsertUser(ctx context.Context, arg InsertUserParams) (User
arg.ID,
arg.Email,
arg.Username,
arg.Name,
arg.HashedPassword,
arg.CreatedAt,
arg.UpdatedAt,
+2 -1
View File
@@ -62,6 +62,7 @@ INSERT INTO
id,
email,
username,
name,
hashed_password,
created_at,
updated_at,
@@ -69,7 +70,7 @@ INSERT INTO
login_type
)
VALUES
($1, $2, $3, $4, $5, $6, $7, $8) RETURNING *;
($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING *;
-- name: UpdateUserProfile :one
UPDATE