Merge branch 'master' into dev

This commit is contained in:
MTG2000
2022-09-01 15:51:36 +03:00
13 changed files with 307 additions and 218 deletions

View File

@@ -271,6 +271,7 @@ export interface NexusGenObjects {
payment_request: string; // String!
}
WalletKey: { // root type
is_current: boolean; // Boolean!
key: string; // String!
name: string; // String!
}
@@ -544,6 +545,7 @@ export interface NexusGenFieldTypes {
payment_request: string; // String!
}
WalletKey: { // field return type
is_current: boolean; // Boolean!
key: string; // String!
name: string; // String!
}
@@ -835,6 +837,7 @@ export interface NexusGenFieldTypeNames {
payment_request: 'String'
}
WalletKey: { // field return type name
is_current: 'Boolean'
key: 'String'
name: 'String'
}

View File

@@ -382,6 +382,7 @@ type Vote {
}
type WalletKey {
is_current: Boolean!
key: String!
name: String!
}

View File

@@ -171,9 +171,9 @@ const MyProfile = objectType({
t.nonNull.list.nonNull.field('walletsKeys', {
type: "WalletKey",
resolve: (parent) => {
return prisma.user.findUnique({ where: { id: parent.id } }).userKeys();
resolve: async (parent, _, context) => {
const userKeys = await prisma.user.findUnique({ where: { id: parent.id } }).userKeys();
return userKeys.map(k => ({ ...k, is_current: k.key === context.userPubKey }))
}
});
}
@@ -283,6 +283,7 @@ const WalletKey = objectType({
definition(t) {
t.nonNull.string('key');
t.nonNull.string('name');
t.nonNull.boolean('is_current')
}
})