From 2a8d9dbcada5937ea47479d1b6af27ba751fbd4a Mon Sep 17 00:00:00 2001 From: Maxim Ivanchenko Date: Wed, 14 Aug 2024 16:10:07 +0300 Subject: [PATCH] Rename "phone" to "phone_number" in GET v1/users/me as it is done in other methods of v1/users/me endpoints --- .../integration-tests/user/patch_user_integration_test.go | 8 ++++---- internal/repositories/user.go | 4 ++-- swagger.yaml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/integration-tests/user/patch_user_integration_test.go b/internal/integration-tests/user/patch_user_integration_test.go index bdf2b31..311a653 100644 --- a/internal/integration-tests/user/patch_user_integration_test.go +++ b/internal/integration-tests/user/patch_user_integration_test.go @@ -37,7 +37,7 @@ func TestIntegration_PatchUpdate(t *testing.T) { passportIssueDate := date passportNumber := gofakeit.Digit() passportSeries := gofakeit.Digit() - phone := gofakeit.Phone() + phoneNumber := gofakeit.Phone() surname := gofakeit.LastName() vk := gofakeit.URL() website := gofakeit.URL() @@ -48,7 +48,7 @@ func TestIntegration_PatchUpdate(t *testing.T) { PassportIssueDate: strfmt.Date(date), PassportNumber: passportNumber, PassportSeries: passportSeries, - Phone: phone, + PhoneNumber: phoneNumber, Surname: surname, Vk: vk, Website: website, @@ -65,7 +65,7 @@ func TestIntegration_PatchUpdate(t *testing.T) { assert.Equal(t, passportIssueDate.String(), *user.GetPayload().PassportIssueDate) assert.Equal(t, passportNumber, *user.GetPayload().PassportNumber) assert.Equal(t, passportSeries, *user.GetPayload().PassportSeries) - assert.Equal(t, phone, *user.GetPayload().PhoneNumber) + assert.Equal(t, phoneNumber, *user.GetPayload().PhoneNumber) assert.Equal(t, surname, *user.GetPayload().Surname) }) @@ -135,7 +135,7 @@ func TestIntegration_PatchUpdate(t *testing.T) { PassportIssueDate: strfmt.Date{}, PassportNumber: "", PassportSeries: "", - Phone: "", + PhoneNumber: "", Surname: "", Vk: "", Website: "", diff --git a/internal/repositories/user.go b/internal/repositories/user.go index f771f16..749906d 100644 --- a/internal/repositories/user.go +++ b/internal/repositories/user.go @@ -74,8 +74,8 @@ func (r *userRepository) UpdateUserByID(ctx context.Context, id int, patch *mode if patch.PassportSeries != "" { userUpdate.SetPassportSeries(patch.PassportSeries) } - if patch.Phone != "" { - userUpdate.SetPhone(patch.Phone) + if patch.PhoneNumber != "" { + userUpdate.SetPhone(patch.PhoneNumber) } if patch.PassportNumber != "" { //TODO: if user changes his passport data or name/surname, diff --git a/swagger.yaml b/swagger.yaml index 89dcc16..712d0e0 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -2158,7 +2158,7 @@ definitions: passport_issue_date: type: string format: date - phone: + phone_number: type: string org_name: type: string