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: save user info from google #1254

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions api-description/web-api.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2802,6 +2802,15 @@ definitions:
items:
type: object
$ref: '#/definitions/accountSearchFilter'
firstName:
type: string
lastName:
type: string
language:
type: string
lastSeen:
type: string
format: int64
accountAccountV2EnvironmentRole:
type: object
properties:
Expand Down Expand Up @@ -2840,6 +2849,27 @@ definitions:
$ref: '#/definitions/accountAccountV2EnvironmentRole'
writeType:
$ref: '#/definitions/ChangeAccountV2EnvironmentRolesCommandWriteType'
accountChangeAccountV2FirstNameCommand:
type: object
properties:
firstName:
type: string
accountChangeAccountV2LanguageCommand:
type: object
properties:
language:
type: string
accountChangeAccountV2LastNameCommand:
type: object
properties:
lastName:
type: string
accountChangeAccountV2LastSeenCommand:
type: object
properties:
lastSeen:
type: string
format: int64
accountChangeAccountV2NameCommand:
type: object
properties:
Expand Down Expand Up @@ -2896,6 +2926,12 @@ definitions:
items:
type: object
$ref: '#/definitions/accountSearchFilter'
firstName:
type: string
lastName:
type: string
language:
type: string
accountConsoleAccountEnvironmentRole:
type: object
properties:
Expand Down Expand Up @@ -2940,6 +2976,12 @@ definitions:
items:
type: object
$ref: '#/definitions/accountAccountV2EnvironmentRole'
firstName:
type: string
lastName:
type: string
language:
type: string
accountCreateAccountV2Request:
type: object
properties:
Expand Down Expand Up @@ -3287,6 +3329,14 @@ definitions:
$ref: '#/definitions/accountChangeAccountV2OrganizationRoleCommand'
changeEnvironmentRolesCommand:
$ref: '#/definitions/accountChangeAccountV2EnvironmentRolesCommand'
changeFirstNameCommand:
$ref: '#/definitions/accountChangeAccountV2FirstNameCommand'
changeLastNameCommand:
$ref: '#/definitions/accountChangeAccountV2LastNameCommand'
changeLanguageCommand:
$ref: '#/definitions/accountChangeAccountV2LanguageCommand'
changeLastSeenCommand:
$ref: '#/definitions/accountChangeAccountV2LastSeenCommand'
accountUpdateAccountV2Response:
type: object
accountUpdateSearchFilterRequest:
Expand Down
4 changes: 2 additions & 2 deletions manifests/bucketeer/charts/web/values.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions migration/mysql/20241021012743_update_account_v2_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "account_v2" table
ALTER TABLE `account_v2` ADD COLUMN `first_name` varchar(255) NULL, ADD COLUMN `last_name` varchar(255) NULL, ADD COLUMN `language` varchar(10) NULL, ADD COLUMN `last_seen` bigint NOT NULL DEFAULT 0;
3 changes: 2 additions & 1 deletion migration/mysql/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:4nKDaGsoVgDy9YoQUWW3GyfQOic4Zs5DK7+JUW5Sj+4=
h1:JetkXwjKhNlwfbKJHuhP2rmChwM1zWVqcJwuE0ok3fs=
20240626022133_initialization.sql h1:u9qmPkwWX7PN92qEcDDfR92lrMpwadQSMxUJgv6LjQ0=
20240708065726_update_audit_log_table.sql h1:k7gK8Njv1yHMsYXAQtSgMaSbXy4lxyZ9MPzbJyMyyoM=
20240815043128_update_auto_ops_rule_table.sql h1:6ib+XfS1uu9AUO3qESvkpUfOu3qUsLwHm9KHcrGEz0E=
Expand All @@ -8,3 +8,4 @@ h1:4nKDaGsoVgDy9YoQUWW3GyfQOic4Zs5DK7+JUW5Sj+4=
20240822110001_update_push_table.sql h1:NG45/qGmJDgDlFrKhKLDqmLXMp94S9GOlQ8k/HObCe4=
20240827085123_update_environment_id_table.sql h1:VbtGa+UP5wjRjrffXtLTg9eWSZZH047MzMaT4c3JJSE=
20240923154451_update_organization_table.sql h1:AmFazbhx6ZzuW+JMcrpX2kyAKx7TUMUnASJIePRuvBk=
20241021012743_update_account_v2_table.sql h1:21Vc0dFhk5Z832JPENmSkMnGWGGesSgbP+ZYLd7yCgI=
23 changes: 21 additions & 2 deletions pkg/account/api/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,15 @@ func (s *AccountService) CreateAccountV2(
return nil, err
}
account := domain.NewAccountV2(
req.Command.Email, req.Command.Name, req.Command.AvatarImageUrl, req.OrganizationId,
req.Command.OrganizationRole, req.Command.EnvironmentRoles,
req.Command.Email,
req.Command.Name,
req.Command.FirstName,
req.Command.LastName,
req.Command.Language,
req.Command.AvatarImageUrl,
req.OrganizationId,
req.Command.OrganizationRole,
req.Command.EnvironmentRoles,
)
err = s.accountStorage.RunInTransaction(ctx, func() error {
// TODO: temporary implementation: double write account v2 ---
Expand Down Expand Up @@ -183,6 +190,15 @@ func (s *AccountService) getUpdateAccountV2Commands(req *accountproto.UpdateAcco
if req.ChangeNameCommand != nil {
commands = append(commands, req.ChangeNameCommand)
}
if req.ChangeFirstNameCommand != nil {
commands = append(commands, req.ChangeFirstNameCommand)
}
if req.ChangeLastNameCommand != nil {
commands = append(commands, req.ChangeLastNameCommand)
}
if req.ChangeLanguageCommand != nil {
commands = append(commands, req.ChangeLanguageCommand)
}
if req.ChangeAvatarUrlCommand != nil {
commands = append(commands, req.ChangeAvatarUrlCommand)
}
Expand All @@ -192,6 +208,9 @@ func (s *AccountService) getUpdateAccountV2Commands(req *accountproto.UpdateAcco
if req.ChangeEnvironmentRolesCommand != nil {
commands = append(commands, req.ChangeEnvironmentRolesCommand)
}
if req.ChangeLastSeenCommand != nil {
commands = append(commands, req.ChangeLastSeenCommand)
}
return commands
}

Expand Down
Loading
Loading