diff --git a/api-schema.graphql b/api-schema.graphql index d79a1515..48cc7dfe 100644 --- a/api-schema.graphql +++ b/api-schema.graphql @@ -469,6 +469,7 @@ type Mutation { adminUpdateRole(input: AdminUpdateRoleInput!, roleId: String!): Role adminUpdateUser(input: AdminUpdateUserInput!, userId: String!): User adminVerifyNetworkAssets: Boolean + adminVerifyUser(userId: String!): Boolean anonVerifyIdentityChallenge(input: VerifyIdentityChallengeInput!): IdentityChallenge logout: Boolean userAddCommunityMember(communityId: String!, input: UserAddCommunityMemberInput!): CommunityMember @@ -788,6 +789,7 @@ type User { name: String private: Boolean profileUrl: String! + pubkeyProfile: String role: UserRole status: UserStatus updatedAt: DateTime diff --git a/libs/api/core/data-access/src/lib/protocol/api-core-protocol.service.ts b/libs/api/core/data-access/src/lib/protocol/api-core-protocol.service.ts index a9819f4c..f82b7000 100644 --- a/libs/api/core/data-access/src/lib/protocol/api-core-protocol.service.ts +++ b/libs/api/core/data-access/src/lib/protocol/api-core-protocol.service.ts @@ -1,18 +1,22 @@ import { AnchorProvider } from '@coral-xyz/anchor' import { Injectable, Logger, OnModuleInit } from '@nestjs/common' import { - PUBKEY_PROFILE_PROGRAM_ID, - PubKeyIdentityProvider, + AnchorKeypairWallet, + getKeypairFromByteArray, + IdentityProvider, + ProfileGetByProvider, + ProfileGetByUsername, + PUBKEY_PROTOCOL_PROGRAM_ID, + PubKeyCommunity, PubKeyPointer, PubKeyProfile, -} from '@pubkey-program-library/anchor' -import { AnchorKeypairWallet, GetProfileByUsername, PubKeyProfileSdk } from '@pubkey-program-library/sdk' -import { GetProfileByProvider } from '@pubkey-program-library/sdk/src/lib/pubkey-profile-sdk' + PubkeyProtocolSdk, +} from '@pubkey-protocol/sdk' import { Connection, Keypair, LAMPORTS_PER_SOL } from '@solana/web3.js' import { ApiCoreConfigService } from '../config/api-core-config.service' function isValidProvider(provider: string): boolean { - return Object.values(PubKeyIdentityProvider).includes(provider as PubKeyIdentityProvider) + return Object.values(IdentityProvider).includes(provider as IdentityProvider) } @Injectable() @@ -20,7 +24,7 @@ export class ApiCoreProtocolService implements OnModuleInit { private readonly logger = new Logger(ApiCoreProtocolService.name) private feePayer: Keypair | undefined private connection: Connection | undefined - private sdk: PubKeyProfileSdk | undefined + private sdk: PubkeyProtocolSdk | undefined constructor(private readonly config: ApiCoreConfigService) {} @@ -34,16 +38,16 @@ export class ApiCoreProtocolService implements OnModuleInit { return } - this.feePayer = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(this.config.pubkeyProtocolFeePayer))) + this.feePayer = getKeypairFromByteArray(JSON.parse(this.config.pubkeyProtocolFeePayer)) this.connection = new Connection(this.config.pubkeyProtocolEndpoint, 'confirmed') this.logger.verbose(`PubKey Protocol: Endpoint: ${this.config.pubkeyProtocolEndpoint}`) const balance = await this.connection.getBalance(this.feePayer.publicKey) this.logger.verbose( `PubKey Protocol: Fee payer: ${this.feePayer.publicKey}, balance: ${balance / LAMPORTS_PER_SOL}`, ) - this.sdk = new PubKeyProfileSdk({ + this.sdk = new PubkeyProtocolSdk({ connection: this.connection, - programId: PUBKEY_PROFILE_PROGRAM_ID, + programId: PUBKEY_PROTOCOL_PROGRAM_ID, provider: new AnchorProvider(this.connection, new AnchorKeypairWallet(this.feePayer), { commitment: this.connection.commitment, }), @@ -59,26 +63,34 @@ export class ApiCoreProtocolService implements OnModuleInit { return this.sdk } - async getProfileByProvider(options: GetProfileByProvider): Promise { + async getCommunity(options: { community: string }): Promise { + return this.ensureSdk().communityGet(options) + } + + async getCommunities(): Promise { + return this.ensureSdk().communityGetAll() + } + + async getProfileByProvider(options: ProfileGetByProvider): Promise { if (!isValidProvider(options.provider)) { throw new Error(`Invalid provider: ${options.provider}`) } - return this.ensureSdk().getProfileByProviderNullable(options) + return this.ensureSdk().profileGetByProviderNullable(options) } - async getProfileByUsername(options: GetProfileByUsername): Promise { - return this.ensureSdk().getProfileByUsernameNullable(options) + async getProfileByUsername(options: ProfileGetByUsername): Promise { + return this.ensureSdk().profileGetByUsernameNullable(options) } async getProfiles(): Promise { - return this.ensureSdk().getProfiles() + return this.ensureSdk().profileGetAll() } getProviders() { - return Object.values(PubKeyIdentityProvider) + return Object.values(IdentityProvider) } async getPointers(): Promise { - return this.ensureSdk().getPointers() + return this.ensureSdk().pointerGetAll() } } diff --git a/libs/api/core/feature/src/lib/api-core-protocol.controller.ts b/libs/api/core/feature/src/lib/api-core-protocol.controller.ts index 7d3f5925..f73a097e 100644 --- a/libs/api/core/feature/src/lib/api-core-protocol.controller.ts +++ b/libs/api/core/feature/src/lib/api-core-protocol.controller.ts @@ -1,11 +1,25 @@ -import { Controller, Get, Param } from '@nestjs/common' +import { Controller, Get, NotFoundException, Param } from '@nestjs/common' import { ApiCoreService } from '@pubkey-link/api-core-data-access' -import { PubKeyIdentityProvider } from '@pubkey-program-library/anchor' +import { IdentityProvider } from '@pubkey-protocol/sdk' -@Controller() +@Controller('ppl') export class ApiCoreProtocolController { constructor(private readonly service: ApiCoreService) {} + @Get('communities') + communities() { + return this.service.protocol.getCommunities() + } + + @Get('community/:community') + async community(@Param('community') community: string) { + const found = await this.service.protocol.getCommunity({ community }) + if (found) { + return found + } + throw new NotFoundException('Profile not found') + } + @Get('pointers') pointers() { return this.service.protocol.getPointers() @@ -22,12 +36,20 @@ export class ApiCoreProtocolController { } @Get('provider/:provider/:providerId') - profileByProvider(@Param('provider') provider: PubKeyIdentityProvider, @Param('providerId') providerId: string) { - return this.service.protocol.getProfileByProvider({ providerId, provider }) + async profileByProvider(@Param('provider') provider: IdentityProvider, @Param('providerId') providerId: string) { + const found = await this.service.protocol.getProfileByProvider({ providerId, provider }) + if (found) { + return found + } + throw new NotFoundException('Profile not found') } - @Get('username/:username') - profileByUsername(@Param('username') username: string) { - return this.service.protocol.getProfileByUsername({ username }) + @Get('profile/:username') + async profileByUsername(@Param('username') username: string) { + const found = await this.service.protocol.getProfileByUsername({ username }) + if (found) { + return found + } + throw new NotFoundException('Profile not found') } } diff --git a/libs/api/network/data-access/src/lib/api-network-cluster.service.ts b/libs/api/network/data-access/src/lib/api-network-cluster.service.ts index bf090cbc..8742acd2 100644 --- a/libs/api/network/data-access/src/lib/api-network-cluster.service.ts +++ b/libs/api/network/data-access/src/lib/api-network-cluster.service.ts @@ -6,7 +6,7 @@ import { Injectable, Logger } from '@nestjs/common' import { OnEvent } from '@nestjs/event-emitter' import { Network, NetworkCluster } from '@prisma/client' import { ApiCoreService } from '@pubkey-link/api-core-data-access' -import { AnchorKeypairWallet } from '@pubkey-program-library/sdk' +import { AnchorKeypairWallet } from '@pubkey-protocol/sdk' import { Connection, Keypair } from '@solana/web3.js' import { ChainId, Client } from '@solflare-wallet/utl-sdk' import { diff --git a/libs/api/user/data-access/src/lib/api-user-data-admin.service.ts b/libs/api/user/data-access/src/lib/api-user-data-admin.service.ts index d5b6c5f8..2c251846 100644 --- a/libs/api/user/data-access/src/lib/api-user-data-admin.service.ts +++ b/libs/api/user/data-access/src/lib/api-user-data-admin.service.ts @@ -47,4 +47,8 @@ export class ApiUserDataAdminService { username: newUsername, }) } + + async verifyUser(userId: string) { + return this.data.verify(userId) + } } diff --git a/libs/api/user/data-access/src/lib/api-user-data.service.ts b/libs/api/user/data-access/src/lib/api-user-data.service.ts index f840cabb..057da183 100644 --- a/libs/api/user/data-access/src/lib/api-user-data.service.ts +++ b/libs/api/user/data-access/src/lib/api-user-data.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@nestjs/common' import { Prisma } from '@prisma/client' import { ApiCoreService, PagingInputFields } from '@pubkey-link/api-core-data-access' +import { IdentityProvider } from '@pubkey-protocol/sdk' import { UserPaging } from './entity/user.entity' @Injectable() @@ -25,7 +26,7 @@ export class ApiUserDataService { } async findOne(userId: string) { - const found = await this.core.data.user.findUnique({ where: { id: userId } }) + const found = await this.core.data.user.findUnique({ where: { id: userId }, include: { identities: true } }) if (!found) { throw new Error(`User ${userId} not found`) } @@ -66,4 +67,34 @@ export class ApiUserDataService { } return true } + + async verify(userId: string) { + const found = await this.findOne(userId) + if (!found.identities.length) { + throw new Error(`Can't verify a user without identities`) + } + let foundPubkeyProfile = null + for (const identity of found.identities) { + console.log(`Checking ${identity.provider} ${identity.providerId}`) + foundPubkeyProfile = await this.core.protocol.getProfileByProvider({ + provider: identity.provider as IdentityProvider, + providerId: identity.providerId, + }) + if (foundPubkeyProfile) { + console.log(`We found one, we break!`) + break + } + } + if (foundPubkeyProfile) { + if (found.pubkeyProfile !== foundPubkeyProfile.publicKey.toString()) { + const updated = await this.core.data.user.update({ + where: { id: found.id }, + data: { pubkeyProfile: foundPubkeyProfile.publicKey.toString() }, + }) + + console.log(`Updated ${updated.username}, attached pubkey profile ${updated.pubkeyProfile}`) + } + } + return true + } } diff --git a/libs/api/user/data-access/src/lib/entity/user.entity.ts b/libs/api/user/data-access/src/lib/entity/user.entity.ts index 8cd0365c..b9a10585 100644 --- a/libs/api/user/data-access/src/lib/entity/user.entity.ts +++ b/libs/api/user/data-access/src/lib/entity/user.entity.ts @@ -26,6 +26,8 @@ export class User { @Field({ nullable: true }) name?: string | null @Field({ nullable: true }) + pubkeyProfile?: string | null + @Field({ nullable: true }) username!: string @HideField() identities?: unknown[] | null diff --git a/libs/api/user/feature/src/lib/api-admin-user.resolver.ts b/libs/api/user/feature/src/lib/api-admin-user.resolver.ts index 405b9c25..9912aa30 100644 --- a/libs/api/user/feature/src/lib/api-admin-user.resolver.ts +++ b/libs/api/user/feature/src/lib/api-admin-user.resolver.ts @@ -33,4 +33,9 @@ export class ApiAdminUserResolver { adminUpdateUser(@Args('userId') userId: string, @Args('input') input: AdminUpdateUserInput) { return this.service.admin.updateUser(userId, input) } + + @Mutation(() => Boolean, { nullable: true }) + adminVerifyUser(@Args('userId') userId: string) { + return this.service.admin.verifyUser(userId) + } } diff --git a/libs/sdk/src/generated/graphql-sdk.ts b/libs/sdk/src/generated/graphql-sdk.ts index 59cb2fbb..dda9ccf5 100644 --- a/libs/sdk/src/generated/graphql-sdk.ts +++ b/libs/sdk/src/generated/graphql-sdk.ts @@ -499,6 +499,7 @@ export type Mutation = { adminUpdateRole?: Maybe adminUpdateUser?: Maybe adminVerifyNetworkAssets?: Maybe + adminVerifyUser?: Maybe anonVerifyIdentityChallenge?: Maybe logout?: Maybe userAddCommunityMember?: Maybe @@ -679,6 +680,10 @@ export type MutationAdminUpdateUserArgs = { userId: Scalars['String']['input'] } +export type MutationAdminVerifyUserArgs = { + userId: Scalars['String']['input'] +} + export type MutationAnonVerifyIdentityChallengeArgs = { input: VerifyIdentityChallengeInput } @@ -1370,6 +1375,7 @@ export type User = { name?: Maybe private?: Maybe profileUrl: Scalars['String']['output'] + pubkeyProfile?: Maybe role?: Maybe status?: Maybe updatedAt?: Maybe @@ -1598,17 +1604,18 @@ export type MeQuery = { __typename?: 'Query' me?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null identities?: Array<{ __typename?: 'Identity' @@ -1979,17 +1986,18 @@ export type UserFindManyBotRolesQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -2236,17 +2244,18 @@ export type CommunityMemberDetailsFragment = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } @@ -2350,34 +2359,36 @@ export type AdminFindManyCommunityMemberQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null }> @@ -2491,34 +2502,36 @@ export type AdminFindOneCommunityMemberQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -2622,34 +2635,36 @@ export type AdminAddCommunityMemberMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -2753,34 +2768,36 @@ export type AdminUpdateCommunityMemberMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -2889,34 +2906,36 @@ export type UserGetCommunityMemberQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -3021,34 +3040,36 @@ export type UserFindManyCommunityMemberQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null }> @@ -3162,34 +3183,36 @@ export type UserFindOneCommunityMemberQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -3293,34 +3316,36 @@ export type UserAddCommunityMemberMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -3424,34 +3449,36 @@ export type UserUpdateCommunityMemberMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null }> | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -3639,17 +3666,18 @@ export type AnonGetCommunitiesQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -3827,17 +3855,18 @@ export type UserGetCommunitiesQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -3952,17 +3981,18 @@ export type UserFindManyCommunityQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -4170,17 +4200,18 @@ export type IdentityGrantDetailsFragment = { updatedAt?: Date | null grantee?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } @@ -4230,33 +4261,35 @@ export type AdminFindManyIdentityQuery = { updatedAt?: Date | null grantee?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null }> | null owner?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null }> | null @@ -4276,6 +4309,7 @@ export type AdminFindUserByIdentityQuery = { private?: boolean | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null username?: string | null @@ -4367,17 +4401,18 @@ export type UserFindManyIdentityQuery = { updatedAt?: Date | null grantee?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null }> | null @@ -4417,33 +4452,35 @@ export type UserFindOneIdentityQuery = { updatedAt?: Date | null grantee?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null }> | null owner?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -4807,34 +4844,36 @@ export type LogDetailsFragment = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null } | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } @@ -5004,34 +5043,36 @@ export type UserFindManyLogQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null } | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null }> @@ -5211,34 +5252,36 @@ export type UserFindOneLogQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null } | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -5409,34 +5452,36 @@ export type AdminFindManyLogQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null } | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null }> @@ -5616,34 +5661,36 @@ export type AdminFindOneLogQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null } | null user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -6292,17 +6339,18 @@ export type RoleDetailsFragment = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -6466,17 +6514,18 @@ export type AdminFindManyRoleQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -6583,17 +6632,18 @@ export type AdminFindOneRoleQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -6689,17 +6739,18 @@ export type AdminCreateRoleMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -6796,17 +6847,18 @@ export type AdminUpdateRoleMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -6910,17 +6962,18 @@ export type UserFindManyRoleQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -7027,17 +7080,18 @@ export type UserFindOneRoleQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -7133,17 +7187,18 @@ export type UserCreateRoleMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -7321,17 +7376,18 @@ export type UserUpdateRoleMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -7494,17 +7550,18 @@ export type SnapshotDetailsFragment = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -7623,17 +7680,18 @@ export type UserFindManySnapshotQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -7761,17 +7819,18 @@ export type UserFindOneSnapshotQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -7875,17 +7934,18 @@ export type UserCreateSnapshotMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -7997,17 +8057,18 @@ export type AdminFindManySnapshotQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -8135,17 +8196,18 @@ export type AdminFindOneSnapshotQuery = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -8249,17 +8311,18 @@ export type AdminCreateSnapshotMutation = { userId: string user?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } | null @@ -8280,6 +8343,7 @@ export type UserSummaryFragment = { private?: boolean | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null username?: string | null @@ -8287,17 +8351,18 @@ export type UserSummaryFragment = { export type UserDetailsFragment = { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } @@ -8317,17 +8382,18 @@ export type AdminFindManyUserQuery = { __typename?: 'UserPaging' data: Array<{ __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null identities?: Array<{ __typename?: 'Identity' @@ -8368,17 +8434,18 @@ export type AdminFindOneUserQuery = { __typename?: 'Query' item?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } @@ -8392,21 +8459,28 @@ export type AdminUpdateUserMutation = { __typename?: 'Mutation' updated?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } +export type AdminVerifyUserMutationVariables = Exact<{ + userId: Scalars['String']['input'] +}> + +export type AdminVerifyUserMutation = { __typename?: 'Mutation'; verified?: boolean | null } + export type UserFindManyUserQueryVariables = Exact<{ input: UserFindManyUserInput }> @@ -8417,17 +8491,18 @@ export type UserFindManyUserQuery = { __typename?: 'UserPaging' data: Array<{ __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null }> meta: { @@ -8451,17 +8526,18 @@ export type UserFindOneUserQuery = { __typename?: 'Query' item?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null identities?: Array<{ __typename?: 'Identity' @@ -8491,17 +8567,18 @@ export type UserFindOneUserByIdQuery = { __typename?: 'Query' item?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } @@ -8514,17 +8591,18 @@ export type UserUpdateUserMutation = { __typename?: 'Mutation' updated?: { __typename?: 'User' - avatarUrl?: string | null createdAt?: Date | null + lastLogin?: Date | null + status?: UserStatus | null + updatedAt?: Date | null + avatarUrl?: string | null developer?: boolean | null private?: boolean | null - lastLogin?: Date | null id: string name?: string | null + pubkeyProfile?: string | null profileUrl: string role?: UserRole | null - status?: UserStatus | null - updatedAt?: Date | null username?: string | null } | null } @@ -8616,21 +8694,28 @@ export const IdentityChallengeDetailsFragmentDoc = gql` verified } ` -export const UserDetailsFragmentDoc = gql` - fragment UserDetails on User { +export const UserSummaryFragmentDoc = gql` + fragment UserSummary on User { avatarUrl - createdAt developer private - lastLogin id name + pubkeyProfile profileUrl role + username + } +` +export const UserDetailsFragmentDoc = gql` + fragment UserDetails on User { + ...UserSummary + createdAt + lastLogin status updatedAt - username } + ${UserSummaryFragmentDoc} ` export const IdentityGrantDetailsFragmentDoc = gql` fragment IdentityGrantDetails on IdentityGrant { @@ -8916,18 +9001,6 @@ export const SnapshotItemDetailsFragmentDoc = gql` } } ` -export const UserSummaryFragmentDoc = gql` - fragment UserSummary on User { - avatarUrl - developer - private - id - name - profileUrl - role - username - } -` export const LogoutDocument = gql` mutation logout { logout @@ -10066,6 +10139,11 @@ export const AdminUpdateUserDocument = gql` } ${UserDetailsFragmentDoc} ` +export const AdminVerifyUserDocument = gql` + mutation adminVerifyUser($userId: String!) { + verified: adminVerifyUser(userId: $userId) + } +` export const UserFindManyUserDocument = gql` query userFindManyUser($input: UserFindManyUserInput!) { paging: userFindManyUser(input: $input) { @@ -10250,6 +10328,7 @@ const AdminDeleteUserDocumentString = print(AdminDeleteUserDocument) const AdminFindManyUserDocumentString = print(AdminFindManyUserDocument) const AdminFindOneUserDocumentString = print(AdminFindOneUserDocument) const AdminUpdateUserDocumentString = print(AdminUpdateUserDocument) +const AdminVerifyUserDocumentString = print(AdminVerifyUserDocument) const UserFindManyUserDocumentString = print(UserFindManyUserDocument) const UserFindOneUserDocumentString = print(UserFindOneUserDocument) const UserFindOneUserByIdDocumentString = print(UserFindOneUserByIdDocument) @@ -13026,6 +13105,27 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = variables, ) }, + adminVerifyUser( + variables: AdminVerifyUserMutationVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: AdminVerifyUserMutation + errors?: GraphQLError[] + extensions?: any + headers: Headers + status: number + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest(AdminVerifyUserDocumentString, variables, { + ...requestHeaders, + ...wrappedRequestHeaders, + }), + 'adminVerifyUser', + 'mutation', + variables, + ) + }, userFindManyUser( variables: UserFindManyUserQueryVariables, requestHeaders?: GraphQLClientRequestHeaders, diff --git a/libs/sdk/src/graphql/feature-user.graphql b/libs/sdk/src/graphql/feature-user.graphql index 02295bf5..2fe59d08 100644 --- a/libs/sdk/src/graphql/feature-user.graphql +++ b/libs/sdk/src/graphql/feature-user.graphql @@ -4,24 +4,18 @@ fragment UserSummary on User { private id name + pubkeyProfile profileUrl role username } fragment UserDetails on User { - avatarUrl + ...UserSummary createdAt - developer - private lastLogin - id - name - profileUrl - role status updatedAt - username } mutation adminDeleteUser($userId: String!) { @@ -54,6 +48,9 @@ mutation adminUpdateUser($userId: String!, $input: AdminUpdateUserInput!) { } } +mutation adminVerifyUser($userId: String!) { + verified: adminVerifyUser(userId: $userId) +} query userFindManyUser($input: UserFindManyUserInput!) { paging: userFindManyUser(input: $input) { data { diff --git a/libs/web/user/data-access/src/lib/use-admin-find-many-user.ts b/libs/web/user/data-access/src/lib/use-admin-find-many-user.ts index 19164632..f43c5755 100644 --- a/libs/web/user/data-access/src/lib/use-admin-find-many-user.ts +++ b/libs/web/user/data-access/src/lib/use-admin-find-many-user.ts @@ -49,5 +49,10 @@ export function useAdminFindManyUser(props?: AdminFindManyUserInput) { toastSuccess('User deleted') return query.refetch() }), + verifyUser: (userId: string) => + sdk.adminVerifyUser({ userId }).then(async () => { + toastSuccess('User verified') + await query.refetch() + }), } } diff --git a/libs/web/user/feature/src/lib/admin-user-list-feature.tsx b/libs/web/user/feature/src/lib/admin-user-list-feature.tsx index b27db952..51772025 100644 --- a/libs/web/user/feature/src/lib/admin-user-list-feature.tsx +++ b/libs/web/user/feature/src/lib/admin-user-list-feature.tsx @@ -7,7 +7,8 @@ import { AdminUserUiSelectRole } from './admin-user-ui-select-role' import { AdminUserUiSelectStatus } from './admin-user-ui-select-status' export function AdminUserListFeature() { - const { deleteUser, items, pagination, query, role, setRole, setSearch, setStatus, status } = useAdminFindManyUser() + const { deleteUser, items, pagination, query, role, setRole, setSearch, setStatus, status, verifyUser } = + useAdminFindManyUser() return ( } rightAction={}> @@ -26,6 +27,7 @@ export function AdminUserListFeature() { if (!window.confirm('Are you sure?')) return return deleteUser(user.id) }} + verifyUser={(user) => verifyUser(user.id)} users={items} page={pagination.page} totalRecords={pagination.total} diff --git a/libs/web/user/ui/src/lib/admin-user-ui-table.tsx b/libs/web/user/ui/src/lib/admin-user-ui-table.tsx index 015f981f..e2e4c9bb 100644 --- a/libs/web/user/ui/src/lib/admin-user-ui-table.tsx +++ b/libs/web/user/ui/src/lib/admin-user-ui-table.tsx @@ -2,7 +2,7 @@ import { ActionIcon, Alert, Group, ScrollArea } from '@mantine/core' import { User } from '@pubkey-link/sdk' import { IdentityUiAvatarGroup } from '@pubkey-link/web-core-ui' import { UiTime } from '@pubkey-ui/core' -import { IconPencil, IconTrash, IconUser } from '@tabler/icons-react' +import { IconParking, IconPencil, IconTrash, IconUser } from '@tabler/icons-react' import { DataTable, DataTableProps } from 'mantine-datatable' import { Link } from 'react-router-dom' import { UserUiItem } from './user-ui-item' @@ -16,6 +16,7 @@ interface AdminUserTableProps { totalRecords: DataTableProps['totalRecords'] recordsPerPage: DataTableProps['recordsPerPage'] onPageChange: (page: number) => void + verifyUser: (user: User) => Promise } export function AdminUserUiTable({ @@ -25,6 +26,7 @@ export function AdminUserUiTable({ page, recordsPerPage, totalRecords, + verifyUser, }: AdminUserTableProps) { return ( @@ -83,7 +85,10 @@ export function AdminUserUiTable({ width: '10%', textAlign: 'right', render: (item) => ( - + + verifyUser(item)}> + + diff --git a/libs/web/user/ui/src/lib/user-ui-item.tsx b/libs/web/user/ui/src/lib/user-ui-item.tsx index a0f2bfa8..aff0e5c2 100644 --- a/libs/web/user/ui/src/lib/user-ui-item.tsx +++ b/libs/web/user/ui/src/lib/user-ui-item.tsx @@ -24,7 +24,7 @@ export function UserUiItem({ return ( - + diff --git a/libs/web/user/ui/src/lib/user-ui-username.tsx b/libs/web/user/ui/src/lib/user-ui-username.tsx index a064d68d..37e2612c 100644 --- a/libs/web/user/ui/src/lib/user-ui-username.tsx +++ b/libs/web/user/ui/src/lib/user-ui-username.tsx @@ -11,6 +11,7 @@ export function UserUiUsername({ to, user, ...props }: TextProps & { to?: string {user.username} + {user.pubkeyProfile ? 🅿️ : null} {user.private ? ( diff --git a/package.json b/package.json index 1d126e66..a9411458 100644 --- a/package.json +++ b/package.json @@ -71,8 +71,7 @@ "@ogma/platform-express": "^5.0.1", "@ogma/platform-graphql": "^5.0.1", "@prisma/client": "5.18.0", - "@pubkey-program-library/anchor": "^1.7.1", - "@pubkey-program-library/sdk": "^1.7.1", + "@pubkey-protocol/sdk": "^1.0.0", "@pubkey-ui/core": "^1.7.0", "@pubkeyapp/wallet-adapter-mantine-ui": "^2.3.0", "@solana-developers/helpers": "^2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9217c6dd..d9dbf1bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -122,12 +122,9 @@ importers: '@prisma/client': specifier: 5.18.0 version: 5.18.0(prisma@5.18.0) - '@pubkey-program-library/anchor': - specifier: ^1.7.1 - version: 1.7.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@pubkey-program-library/sdk': - specifier: ^1.7.1 - version: 1.7.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@pubkey-protocol/sdk': + specifier: ^1.0.0 + version: 1.0.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@pubkey-ui/core': specifier: ^1.7.0 version: 1.7.0(@types/react@18.3.1)(dayjs@1.11.11)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -1662,16 +1659,30 @@ packages: bundledDependencies: - is-unicode-supported + '@coral-xyz/anchor-errors@0.30.1': + resolution: {integrity: sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ==} + engines: {node: '>=10'} + '@coral-xyz/anchor@0.29.0': resolution: {integrity: sha512-eny6QNG0WOwqV0zQ7cs/b1tIuzZGmP7U7EcH+ogt4Gdbl8HDmIYVMh/9aTmYZPaFWjtUaI8qSn73uYEXWfATdA==} engines: {node: '>=11'} + '@coral-xyz/anchor@0.30.1': + resolution: {integrity: sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ==} + engines: {node: '>=11'} + '@coral-xyz/borsh@0.29.0': resolution: {integrity: sha512-s7VFVa3a0oqpkuRloWVPdCK7hMbAMY270geZOGfCnaqexrP5dTIpbEHL33req6IYPPJ0hYa71cdvJ1h6V55/oQ==} engines: {node: '>=10'} peerDependencies: '@solana/web3.js': ^1.68.0 + '@coral-xyz/borsh@0.30.1': + resolution: {integrity: sha512-aaxswpPrCFKl8vZTbxLssA2RvwX2zmKLlRCIktJOwW+VpVwYtXRtlWiIP+c2pPRKneiTiWCN2GEMSH9j1zTlWQ==} + engines: {node: '>=10'} + peerDependencies: + '@solana/web3.js': ^1.68.0 + '@cspotcode/source-map-support@0.8.1': resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} @@ -3339,11 +3350,11 @@ packages: '@protobufjs/utf8@1.1.0': resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} - '@pubkey-program-library/anchor@1.7.1': - resolution: {integrity: sha512-3GbBcr9+xggp0JHAEtHIN1ZjxAwIBVh66C+rjfX/lqkGFsmUHNNNVX81jB6C9P6S7WWbIvT84mPr3y6SoAZ41A==} + '@pubkey-protocol/anchor@1.0.0': + resolution: {integrity: sha512-nqkUe0XWpAS5CFz0PhQ9k2RNHmSB3lxzYHYPnRnpO532omc9od7kqyEHMGKRQQbRcIHy8Lrmk4/QBYaEOu+lJQ==} - '@pubkey-program-library/sdk@1.7.1': - resolution: {integrity: sha512-GEJEWxTVQ+C0xaZ9Yqvm3PeXHcB1uxaqDpGRqtoBAuXk5MHOsoWycQCXpLafnnfJtAaTiMG5e4fbWQVPj/wfoQ==} + '@pubkey-protocol/sdk@1.0.0': + resolution: {integrity: sha512-P7Qfk8BW3j3o16W99tDrT20CvmNzpw1aa6//54/WWDUE7u3yLydu4BSDnJWjhzdER/zstb1snE5/H5LI631gog==} '@pubkey-ui/core@1.7.0': resolution: {integrity: sha512-mVpdcnN+CeFqup0IGRZRLUvDiOWPBmcRILmitriLBB4089iAC9EzUM3loTYt9oxj/MDjkrbMmMiE50Uo0ai7fA==} @@ -11871,8 +11882,8 @@ snapshots: '@aws-crypto/sha1-browser': 3.0.0 '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sso-oidc': 3.575.0(@aws-sdk/client-sts@3.575.0) - '@aws-sdk/client-sts': 3.575.0 + '@aws-sdk/client-sso-oidc': 3.575.0 + '@aws-sdk/client-sts': 3.575.0(@aws-sdk/client-sso-oidc@3.575.0) '@aws-sdk/core': 3.575.0 '@aws-sdk/credential-provider-node': 3.575.0(@aws-sdk/client-sso-oidc@3.575.0)(@aws-sdk/client-sts@3.575.0) '@aws-sdk/middleware-bucket-endpoint': 3.575.0 @@ -11929,11 +11940,11 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/client-sso-oidc@3.575.0(@aws-sdk/client-sts@3.575.0)': + '@aws-sdk/client-sso-oidc@3.575.0': dependencies: '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sts': 3.575.0 + '@aws-sdk/client-sts': 3.575.0(@aws-sdk/client-sso-oidc@3.575.0) '@aws-sdk/core': 3.575.0 '@aws-sdk/credential-provider-node': 3.575.0(@aws-sdk/client-sso-oidc@3.575.0)(@aws-sdk/client-sts@3.575.0) '@aws-sdk/middleware-host-header': 3.575.0 @@ -11972,7 +11983,6 @@ snapshots: '@smithy/util-utf8': 3.0.0 tslib: 2.6.3 transitivePeerDependencies: - - '@aws-sdk/client-sts' - aws-crt '@aws-sdk/client-sso@3.575.0': @@ -12018,11 +12028,11 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/client-sts@3.575.0': + '@aws-sdk/client-sts@3.575.0(@aws-sdk/client-sso-oidc@3.575.0)': dependencies: '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sso-oidc': 3.575.0(@aws-sdk/client-sts@3.575.0) + '@aws-sdk/client-sso-oidc': 3.575.0 '@aws-sdk/core': 3.575.0 '@aws-sdk/credential-provider-node': 3.575.0(@aws-sdk/client-sso-oidc@3.575.0)(@aws-sdk/client-sts@3.575.0) '@aws-sdk/middleware-host-header': 3.575.0 @@ -12061,6 +12071,7 @@ snapshots: '@smithy/util-utf8': 3.0.0 tslib: 2.6.3 transitivePeerDependencies: + - '@aws-sdk/client-sso-oidc' - aws-crt '@aws-sdk/core@3.575.0': @@ -12094,7 +12105,7 @@ snapshots: '@aws-sdk/credential-provider-ini@3.575.0(@aws-sdk/client-sso-oidc@3.575.0)(@aws-sdk/client-sts@3.575.0)': dependencies: - '@aws-sdk/client-sts': 3.575.0 + '@aws-sdk/client-sts': 3.575.0(@aws-sdk/client-sso-oidc@3.575.0) '@aws-sdk/credential-provider-env': 3.575.0 '@aws-sdk/credential-provider-process': 3.575.0 '@aws-sdk/credential-provider-sso': 3.575.0(@aws-sdk/client-sso-oidc@3.575.0) @@ -12151,7 +12162,7 @@ snapshots: '@aws-sdk/credential-provider-web-identity@3.575.0(@aws-sdk/client-sts@3.575.0)': dependencies: - '@aws-sdk/client-sts': 3.575.0 + '@aws-sdk/client-sts': 3.575.0(@aws-sdk/client-sso-oidc@3.575.0) '@aws-sdk/types': 3.575.0 '@smithy/property-provider': 3.0.0 '@smithy/types': 3.0.0 @@ -12267,7 +12278,7 @@ snapshots: '@aws-sdk/token-providers@3.575.0(@aws-sdk/client-sso-oidc@3.575.0)': dependencies: - '@aws-sdk/client-sso-oidc': 3.575.0(@aws-sdk/client-sts@3.575.0) + '@aws-sdk/client-sso-oidc': 3.575.0 '@aws-sdk/types': 3.575.0 '@smithy/property-provider': 3.0.0 '@smithy/shared-ini-file-loader': 3.0.0 @@ -13307,6 +13318,8 @@ snapshots: picocolors: 1.0.0 sisteransi: 1.0.5 + '@coral-xyz/anchor-errors@0.30.1': {} + '@coral-xyz/anchor@0.29.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: '@coral-xyz/borsh': 0.29.0(@solana/web3.js@1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) @@ -13328,12 +13341,40 @@ snapshots: - encoding - utf-8-validate + '@coral-xyz/anchor@0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@coral-xyz/anchor-errors': 0.30.1 + '@coral-xyz/borsh': 0.30.1(@solana/web3.js@1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + '@noble/hashes': 1.4.0 + '@solana/web3.js': 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bn.js: 5.2.1 + bs58: 4.0.1 + buffer-layout: 1.2.2 + camelcase: 6.3.0 + cross-fetch: 3.1.8 + crypto-hash: 1.3.0 + eventemitter3: 4.0.7 + pako: 2.1.0 + snake-case: 3.0.4 + superstruct: 0.15.5 + toml: 3.0.0 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + '@coral-xyz/borsh@0.29.0(@solana/web3.js@1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))': dependencies: '@solana/web3.js': 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) bn.js: 5.2.1 buffer-layout: 1.2.2 + '@coral-xyz/borsh@0.30.1(@solana/web3.js@1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))': + dependencies: + '@solana/web3.js': 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bn.js: 5.2.1 + buffer-layout: 1.2.2 + '@cspotcode/source-map-support@0.8.1': dependencies: '@jridgewell/trace-mapping': 0.3.9 @@ -16054,9 +16095,9 @@ snapshots: '@protobufjs/utf8@1.1.0': {} - '@pubkey-program-library/anchor@1.7.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@pubkey-protocol/anchor@1.0.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@coral-xyz/anchor': 0.29.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@coral-xyz/anchor': 0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@noble/hashes': 1.4.0 '@solana/web3.js': 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: @@ -16064,10 +16105,10 @@ snapshots: - encoding - utf-8-validate - '@pubkey-program-library/sdk@1.7.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@pubkey-protocol/sdk@1.0.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@coral-xyz/anchor': 0.29.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@pubkey-program-library/anchor': 1.7.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@coral-xyz/anchor': 0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@pubkey-protocol/anchor': 1.0.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@solana-developers/helpers': 2.3.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@solana/web3.js': 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 49dc1467..df95cdb0 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -306,6 +306,7 @@ model User { developer Boolean @default(false) private Boolean @default(false) name String? + pubkeyProfile String? role UserRole @default(User) status UserStatus @default(Created) username String @unique