Skip to content

Commit e19f829

Browse files
committed
refactor(mgmt): move full_name and metadata handling to EE only
Because - CE does not have DB columns for full_name and metadata (migrations are in EE) - Convertor should not reference fields that don't exist in CE database - Integration tests should not test EE-only features This commit - Remove FullName handling from convertor.go (DB → PB and PB → DB) - Remove fullName and metadata tests from integration tests - Keep fields in datamodel for EE to use via shared struct
1 parent 81de394 commit e19f829

File tree

3 files changed

+0
-20
lines changed

3 files changed

+0
-20
lines changed

integration-test/const.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export const defaultUserUpdate = {
5656
profile: {
5757
displayName: "Instill AI",
5858
companyName: "Instill AI",
59-
fullName: "", // Reset to empty
6059
},
6160
role: "hobbyist",
6261
newsletterSubscription: true,
@@ -70,7 +69,6 @@ export const defaultUser = {
7069
profile: {
7170
displayName: "Instill AI",
7271
companyName: "Instill AI",
73-
fullName: "",
7472
},
7573
role: "hobbyist",
7674
newsletterSubscription: true,

integration-test/rest-public-user.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ export function CheckPublicGetUser(header) {
5252
(r) => r.json().user.profile.displayName !== undefined,
5353
[`GET /${constant.mgmtVersion}/user response profile.companyName`]:
5454
(r) => r.json().user.profile.companyName !== undefined,
55-
// fullName is optional, just check field exists in profile (can be empty string)
56-
[`GET /${constant.mgmtVersion}/user response profile.fullName exists`]:
57-
(r) => r.json().user.profile.hasOwnProperty('fullName') || r.json().user.profile.fullName === undefined,
58-
// metadata is optional, check field exists in profile (can be null/undefined)
59-
[`GET /${constant.mgmtVersion}/user response profile.metadata exists`]:
60-
(r) => r.json().user.profile.hasOwnProperty('metadata') || r.json().user.profile.metadata === undefined,
6155
[`GET /${constant.mgmtVersion}/user response role`]:
6256
(r) => r.json().user.role !== undefined,
6357
[`GET /${constant.mgmtVersion}/user response newsletterSubscription`]:
@@ -78,8 +72,6 @@ export function CheckPublicPatchAuthenticatedUser(header) {
7872
profile: {
7973
displayName: "test",
8074
companyName: "company",
81-
fullName: "Test User Full Name",
82-
metadata: { usageType: "test", source: "integration-test" },
8375
},
8476
role: "ai-engineer",
8577
newsletterSubscription: true,
@@ -137,10 +129,6 @@ export function CheckPublicPatchAuthenticatedUser(header) {
137129
() => updatedUser.profile.displayName === userUpdate.profile.displayName,
138130
[`PATCH /${constant.mgmtVersion}/user response profile.companyName updated`]:
139131
() => updatedUser.profile.companyName === userUpdate.profile.companyName,
140-
[`PATCH /${constant.mgmtVersion}/user response profile.fullName updated`]:
141-
() => updatedUser.profile.fullName === userUpdate.profile.fullName,
142-
[`PATCH /${constant.mgmtVersion}/user response profile.metadata updated`]:
143-
() => updatedUser.profile.metadata !== undefined && updatedUser.profile.metadata.usageType === userUpdate.profile.metadata.usageType,
144132
[`PATCH /${constant.mgmtVersion}/user response role updated`]:
145133
() => updatedUser.role === userUpdate.role,
146134
[`PATCH /${constant.mgmtVersion}/user response newsletterSubscription updated`]:

pkg/service/convertor.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ func (s *service) DBUser2PBUser(ctx context.Context, dbUser *datamodel.Owner) (*
160160
Avatar: &avatar,
161161
Bio: &dbUser.Bio.String,
162162
SocialProfileLinks: socialProfileLinks,
163-
FullName: &dbUser.FullName.String,
164163
},
165164
Email: dbUser.Email,
166165
}, nil
@@ -211,7 +210,6 @@ func (s *service) DBUser2PBAuthenticatedUser(ctx context.Context, dbUser *datamo
211210
Avatar: &avatar,
212211
Bio: &dbUser.Bio.String,
213212
SocialProfileLinks: socialProfileLinks,
214-
FullName: &dbUser.FullName.String,
215213
},
216214
OnboardingStatus: mgmtpb.OnboardingStatus(dbUser.OnboardingStatus),
217215
}, nil
@@ -300,10 +298,6 @@ func (s *service) PBAuthenticatedUser2DBUser(ctx context.Context, pbUser *mgmtpb
300298
return []byte{}
301299
}(),
302300
OnboardingStatus: datamodel.OnboardingStatus(pbUser.OnboardingStatus),
303-
FullName: sql.NullString{
304-
String: pbUser.GetProfile().GetFullName(),
305-
Valid: len(pbUser.GetProfile().GetFullName()) > 0,
306-
},
307301
}, nil
308302
}
309303

0 commit comments

Comments
 (0)