diff --git a/pkg/api/console/v1/types/user.go b/pkg/api/console/v1/types/user.go index 7813e7a30..3495d613b 100644 --- a/pkg/api/console/v1/types/user.go +++ b/pkg/api/console/v1/types/user.go @@ -15,35 +15,15 @@ package types import ( - "time" - "github.com/getprobo/probo/pkg/usrmgr/coredata" ) -type UserType struct { - ID string - Email string - CreatedAt time.Time - UpdatedAt time.Time -} - -// NewUser creates a new UserType from a coredata.User -func NewUser(u *coredata.User) *UserType { - return &UserType{ - ID: u.ID.String(), +func NewUser(u *coredata.User) *User { + return &User{ + ID: u.ID, Email: u.EmailAddress, + FullName: u.FullName, CreatedAt: u.CreatedAt, UpdatedAt: u.UpdatedAt, } } - -// AddUserToOrganizationInput is the input for adding a user to an organization -type AddUserToOrganizationInput struct { - UserID string - OrganizationID string -} - -// AddUserToOrganizationPayload is the payload for adding a user to an organization -type AddUserToOrganizationPayload struct { - User *UserType -} diff --git a/pkg/api/console/v1/v1_resolver.go b/pkg/api/console/v1/v1_resolver.go index 0f96e9f2e..7f0bf503e 100644 --- a/pkg/api/console/v1/v1_resolver.go +++ b/pkg/api/console/v1/v1_resolver.go @@ -334,13 +334,7 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error // Viewer is the resolver for the viewer field. func (r *queryResolver) Viewer(ctx context.Context) (*types.User, error) { user := UserFromContext(ctx) - return &types.User{ - ID: user.ID, - Email: user.EmailAddress, - FullName: user.FullName, - CreatedAt: user.CreatedAt, - UpdatedAt: user.UpdatedAt, - }, nil + return types.NewUser(user), nil } // StateTransisions is the resolver for the stateTransisions field.