@@ -28,24 +28,17 @@ import (
28
28
)
29
29
30
30
type UserAttributesService interface {
31
- AddUserAttributes (request * UserAttributesDto ) (* UserAttributesDto , error )
32
- UpdateUserAttributes (request * UserAttributesDto ) (* UserAttributesDto , error )
33
- PatchUserAttributes (request * UserAttributesDto ) (* UserAttributesDto , error )
34
- GetUserAttribute (request * UserAttributesDto ) (* UserAttributesDto , error )
31
+ AddUserAttributes (request * bean. UserAttributesDto ) (* bean. UserAttributesDto , error )
32
+ UpdateUserAttributes (request * bean. UserAttributesDto ) (* bean. UserAttributesDto , error )
33
+ PatchUserAttributes (request * bean. UserAttributesDto ) (* bean. UserAttributesDto , error )
34
+ GetUserAttribute (request * bean. UserAttributesDto ) (* bean. UserAttributesDto , error )
35
35
}
36
36
37
37
type UserAttributesServiceImpl struct {
38
38
logger * zap.SugaredLogger
39
39
attributesRepository repository.UserAttributesRepository
40
40
}
41
41
42
- type UserAttributesDto struct {
43
- EmailId string `json:"emailId"`
44
- Key string `json:"key"`
45
- Value string `json:"value"`
46
- UserId int32 `json:"-"`
47
- }
48
-
49
42
func NewUserAttributesServiceImpl (logger * zap.SugaredLogger ,
50
43
attributesRepository repository.UserAttributesRepository ) * UserAttributesServiceImpl {
51
44
serviceImpl := & UserAttributesServiceImpl {
@@ -55,7 +48,7 @@ func NewUserAttributesServiceImpl(logger *zap.SugaredLogger,
55
48
return serviceImpl
56
49
}
57
50
58
- func (impl UserAttributesServiceImpl ) AddUserAttributes (request * UserAttributesDto ) (* UserAttributesDto , error ) {
51
+ func (impl UserAttributesServiceImpl ) AddUserAttributes (request * bean. UserAttributesDto ) (* bean. UserAttributesDto , error ) {
59
52
dao := & repository.UserAttributesDao {
60
53
EmailId : request .EmailId ,
61
54
Key : request .Key ,
@@ -70,7 +63,7 @@ func (impl UserAttributesServiceImpl) AddUserAttributes(request *UserAttributesD
70
63
return request , nil
71
64
}
72
65
73
- func (impl UserAttributesServiceImpl ) UpdateUserAttributes (request * UserAttributesDto ) (* UserAttributesDto , error ) {
66
+ func (impl UserAttributesServiceImpl ) UpdateUserAttributes (request * bean. UserAttributesDto ) (* bean. UserAttributesDto , error ) {
74
67
75
68
userAttribute , err := impl .GetUserAttribute (request )
76
69
if err != nil {
@@ -100,7 +93,7 @@ func (impl UserAttributesServiceImpl) UpdateUserAttributes(request *UserAttribut
100
93
return request , nil
101
94
}
102
95
103
- func (impl UserAttributesServiceImpl ) PatchUserAttributes (request * UserAttributesDto ) (* UserAttributesDto , error ) {
96
+ func (impl UserAttributesServiceImpl ) PatchUserAttributes (request * bean. UserAttributesDto ) (* bean. UserAttributesDto , error ) {
104
97
existingAttribute , err := impl .GetUserAttribute (request )
105
98
if err != nil {
106
99
impl .logger .Errorw ("error while getting user attributes during patch request" , "req" , request , "error" , err )
@@ -156,7 +149,7 @@ func (impl UserAttributesServiceImpl) parseJSONValue(jsonValue, context string)
156
149
}
157
150
158
151
// updateAttributeInDatabase updates the merged data in the database
159
- func (impl UserAttributesServiceImpl ) updateAttributeInDatabase (request * UserAttributesDto , mergedData map [string ]interface {}) (* UserAttributesDto , error ) {
152
+ func (impl UserAttributesServiceImpl ) updateAttributeInDatabase (request * bean. UserAttributesDto , mergedData map [string ]interface {}) (* bean. UserAttributesDto , error ) {
160
153
mergedJSON , err := json .Marshal (mergedData )
161
154
if err != nil {
162
155
impl .logger .Errorw ("error converting merged data to JSON" , "data" , mergedData , "error" , err )
@@ -253,7 +246,7 @@ func (impl UserAttributesServiceImpl) mergeResourceTypes(existingResources, newR
253
246
return hasChanges
254
247
}
255
248
256
- func (impl UserAttributesServiceImpl ) GetUserAttribute (request * UserAttributesDto ) (* UserAttributesDto , error ) {
249
+ func (impl UserAttributesServiceImpl ) GetUserAttribute (request * bean. UserAttributesDto ) (* bean. UserAttributesDto , error ) {
257
250
258
251
dao := & repository.UserAttributesDao {
259
252
EmailId : request .EmailId ,
@@ -269,7 +262,7 @@ func (impl UserAttributesServiceImpl) GetUserAttribute(request *UserAttributesDt
269
262
impl .logger .Errorw ("error in fetching user attributes" , "req" , request , "error" , err )
270
263
return nil , errors .New ("error occurred while getting user attributes" )
271
264
}
272
- resAttrDto := & UserAttributesDto {
265
+ resAttrDto := & bean. UserAttributesDto {
273
266
EmailId : request .EmailId ,
274
267
Key : request .Key ,
275
268
Value : modelValue ,
0 commit comments