Merge branch 'dev' into feature/tournament-pages

This commit is contained in:
MTG2000
2022-09-04 09:45:30 +03:00
21 changed files with 198 additions and 101 deletions

View File

@@ -305,6 +305,7 @@ export interface NexusGenObjects {
payment_request: string; // String!
}
WalletKey: { // root type
is_current: boolean; // Boolean!
key: string; // String!
name: string; // String!
}
@@ -611,6 +612,7 @@ export interface NexusGenFieldTypes {
payment_request: string; // String!
}
WalletKey: { // field return type
is_current: boolean; // Boolean!
key: string; // String!
name: string; // String!
}
@@ -935,6 +937,7 @@ export interface NexusGenFieldTypeNames {
payment_request: 'String'
}
WalletKey: { // field return type name
is_current: 'Boolean'
key: 'String'
name: 'String'
}

View File

@@ -425,6 +425,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')
}
})

View File

@@ -7,6 +7,9 @@ const { getDirectUploadUrl } = require('../../services/imageUpload.service')
const { prisma } = require('../../prisma')
const postUploadImageUrl = async (req, res) => {
return res.status(404).send("This api is in progress");
const userPubKey = await extractKeyFromCookie(req.headers.cookie ?? req.headers.Cookie)
const user = await getUserByPubKey(userPubKey)