mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-02-23 15:34:21 +01:00
feat: add createdAt to userKeys, tour participations
This commit is contained in:
@@ -171,9 +171,16 @@ const MyProfile = objectType({
|
||||
|
||||
t.nonNull.list.nonNull.field('walletsKeys', {
|
||||
type: "WalletKey",
|
||||
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 }))
|
||||
resolve: (parent, _, context) => {
|
||||
return prisma.userKey.findMany({
|
||||
where: {
|
||||
user_id: parent.id,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: "asc"
|
||||
}
|
||||
})
|
||||
.then(keys => keys.map(k => ({ ...k, is_current: k.key === context.userPubKey })))
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -283,6 +290,7 @@ const WalletKey = objectType({
|
||||
definition(t) {
|
||||
t.nonNull.string('key');
|
||||
t.nonNull.string('name');
|
||||
t.nonNull.date('createdAt');
|
||||
t.nonNull.boolean('is_current')
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user