@@ -15,35 +15,15 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/getprobo/probo/pkg/usrmgr/coredata"
|
"github.com/getprobo/probo/pkg/usrmgr/coredata"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserType struct {
|
func NewUser(u *coredata.User) *User {
|
||||||
ID string
|
return &User{
|
||||||
Email string
|
ID: u.ID,
|
||||||
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(),
|
|
||||||
Email: u.EmailAddress,
|
Email: u.EmailAddress,
|
||||||
|
FullName: u.FullName,
|
||||||
CreatedAt: u.CreatedAt,
|
CreatedAt: u.CreatedAt,
|
||||||
UpdatedAt: u.UpdatedAt,
|
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
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -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.
|
// Viewer is the resolver for the viewer field.
|
||||||
func (r *queryResolver) Viewer(ctx context.Context) (*types.User, error) {
|
func (r *queryResolver) Viewer(ctx context.Context) (*types.User, error) {
|
||||||
user := UserFromContext(ctx)
|
user := UserFromContext(ctx)
|
||||||
return &types.User{
|
return types.NewUser(user), nil
|
||||||
ID: user.ID,
|
|
||||||
Email: user.EmailAddress,
|
|
||||||
FullName: user.FullName,
|
|
||||||
CreatedAt: user.CreatedAt,
|
|
||||||
UpdatedAt: user.UpdatedAt,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StateTransisions is the resolver for the stateTransisions field.
|
// StateTransisions is the resolver for the stateTransisions field.
|
||||||
|
|||||||
Reference in New Issue
Block a user