diff --git a/src/templates/snek/gql/queries/user.ts b/src/templates/snek/gql/queries/user.ts index 0637899..2b680c1 100644 --- a/src/templates/snek/gql/queries/user.ts +++ b/src/templates/snek/gql/queries/user.ts @@ -24,26 +24,49 @@ const whoami = gql` /** * Get user profile. * - * @param {string} slug Slug: > + * @param {string} slug Slug: > * @param {string} token A users JWT * @returns {string} A profile page of a user * @description A query to fetch profile data */ const profile = gql` - query profile($username: String!, $token: String!) { - profile: user(username: $username, token: $token) { - username - firstName - lastName - email - verified: isActive - personpage { - title + query profile($slug: String!, $token: String!) { + page(slug: $slug, token: $token) { + ... on PersonFormPage { + personName: title + firstName + lastName + email + platformData: cache + sources + person { + cache + sources + } tids bids + follows { + personName: slug + } + followedBy { + personName: slug + } + likes { + personName: slug + } + likedBy { + personName: slug + } + achievements { + id + title + image { + src + imageSourceUrl + } + points + } } - platformData: cache - sources } } `; diff --git a/src/templates/snek/gql/tasks/user.ts b/src/templates/snek/gql/tasks/user.ts index a59d415..51ac9ad 100644 --- a/src/templates/snek/gql/tasks/user.ts +++ b/src/templates/snek/gql/tasks/user.ts @@ -32,15 +32,39 @@ interface CacheData { */ interface ProfileData { profile: { - username: string; + profileName: string; firstName: string; lastName: string; email: string; - verified: string; platformData: string; sources: string; bids: string; tids: string; + person: { + cache: string; + sources: string; + }; + follows: { + personName: string; + }[]; + followedBy: { + personName: string; + }[]; + likes: { + personName: string; + }[]; + likedBy: { + personName: string; + }[]; + achievements: { + id: string; + title: string; + image: { + src: string; + imageSourceUrl: string; + }; + points: string; + }; }; } @@ -106,15 +130,15 @@ class SnekGqlUserTasks { /** * Get profile. * - * @param {string} username Username: + * @param {string} slug Slug: > * @returns {Promise>} The profile page of a user */ - async profile(username: string): Promise> { + async profile(slug: string): Promise> { const response = await this.parent.run( "query", this.parent.template.queries.user.profile, { - username, + slug, token: await this.parent.session.upToDateToken(), } );