Skip to content

Typeorm/Graphql: How to retrieve profile information (eg firstname/lastname) and where to store it #768

@derblitz

Description

@derblitz

If using the createUser function on the frontend in order to create a user and when having included a profile (like in the official example), I'm wondering where this information is saved on the backend? Or if it's not saved, how I can retrieve it and save it manually? I'm using postgres and don't see the information stored in any of the tables.

Frontend code:

public onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
    e.preventDefault();
    this.setState({ error: null });
    try {
        await accountsPassword.createUser({
            email: this.state.email,
            username: this.state.email,
            password: this.state.password,
            profile: {
                firstName: this.state.firstName,
                lastName: this.state.lastName,
            },
        })
        this.props.history.push('/login/');
    } catch (err) {
        console.log(err)
        this.setState({ error: err.message })
    }
}

Backend (typeDefs):

extend input CreateUserInput {
    profile: CreateUserProfileInput!
}

input CreateUserProfileInput {
    firstName: String!
    lastName: String!
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions