Skip to content

Commit

Permalink
Merge pull request #152 from iota-uz/sdk-145
Browse files Browse the repository at this point in the history
fix: user create and update Middle name
  • Loading branch information
diyor28 authored Feb 25, 2025
2 parents ffde9b8 + 55568b0 commit 4080722
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion e2e/cypress/e2e/users/register.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("user auth and registration flow", () => {

cy.visit("http://localhost:3200/users");
cy.get("tbody tr").should("have.length", 2);
cy.get("tbody tr").should("contain.text", "TestNew UserNew");
cy.get("tbody tr").should("contain.text", "TestNew UserNew MidNew");
cy.get("tbody tr").should("contain.text", "[email protected]");

cy.visit("http://localhost:3200/logout");
Expand Down
7 changes: 6 additions & 1 deletion modules/core/domain/aggregates/user/user_dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package user
import (
"context"
"fmt"
"github.com/nicksnyder/go-i18n/v2/i18n"
"time"

"github.com/nicksnyder/go-i18n/v2/i18n"

"github.com/go-playground/validator/v10"
"github.com/iota-uz/iota-sdk/modules/core/domain/aggregates/role"
"github.com/iota-uz/iota-sdk/pkg/constants"
Expand All @@ -14,6 +15,7 @@ import (
type CreateDTO struct {
FirstName string `validate:"required"`
LastName string `validate:"required"`
MiddleName string `validate:"required"`
Email string `validate:"required,email"`
Password string
RoleIDs []uint `validate:"required"`
Expand All @@ -24,6 +26,7 @@ type CreateDTO struct {
type UpdateDTO struct {
FirstName string `validate:"required"`
LastName string `validate:"required"`
MiddleName string `validate:"required"`
Email string `validate:"required,email"`
Password string
RoleIDs []uint
Expand Down Expand Up @@ -95,6 +98,7 @@ func (u *CreateDTO) ToEntity() (User, error) {
return &user{
firstName: u.FirstName,
lastName: u.LastName,
middleName: u.MiddleName,
email: u.Email,
roles: roles,
password: u.Password,
Expand All @@ -120,6 +124,7 @@ func (u *UpdateDTO) ToEntity(id uint) (User, error) {
return &user{
id: id,
firstName: u.FirstName,
middleName: u.MiddleName,
lastName: u.LastName,
email: u.Email,
roles: roles,
Expand Down

0 comments on commit 4080722

Please sign in to comment.