Skip to content

Commit

Permalink
refactor: add field names at struct initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
bastean committed May 4, 2024
1 parent b6b9343 commit 55c5de3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion pkg/context/shared/domain/aggregate/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ func (root *AggregateRoot) PullMessages() []*message.Message {
}

func NewAggregateRoot() *AggregateRoot {
return &AggregateRoot{Messages: []*message.Message{}}
return &AggregateRoot{
Messages: []*message.Message{},
}
}
22 changes: 11 additions & 11 deletions pkg/context/user/domain/aggregate/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ func create(id, email, username, password string, verified bool) *User {
verifiedVO := valueObject.NewVerified(verified)

return &User{
aggregateRoot,
idVO,
emailVO,
usernameVO,
passwordVO,
verifiedVO,
AggregateRoot: aggregateRoot,
Id: idVO,
Email: emailVO,
Username: usernameVO,
Password: passwordVO,
Verified: verifiedVO,
}
}

func (user *User) ToPrimitives() *UserPrimitive {
return &UserPrimitive{
user.Id.Value,
user.Email.Value,
user.Username.Value,
user.Password.Value,
user.Verified.Value,
Id: user.Id.Value,
Email: user.Email.Value,
Username: user.Username.Value,
Password: user.Password.Value,
Verified: user.Verified.Value,
}
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/context/user/infrastructure/persistence/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,7 @@ func NewUserMongoRepository(mdb *database.MongoDB, collectionName string, hashin
},
})

return &UserCollection{collection, hashing}
return &UserCollection{
collection: collection,
hashing: hashing}
}

0 comments on commit 55c5de3

Please sign in to comment.