feat: add projects card to user profile

This commit is contained in:
MTG2000
2022-10-04 15:29:52 +03:00
parent b4bf13e54a
commit 08c8dc065c
11 changed files with 121 additions and 7 deletions

View File

@@ -548,6 +548,7 @@ export interface NexusGenFieldTypes {
name: string; // String!
nostr_prv_key: string | null; // String
nostr_pub_key: string | null; // String
projects: NexusGenRootTypes['Project'][]; // [Project!]!
role: string | null; // String
roles: NexusGenRootTypes['MakerRole'][]; // [MakerRole!]!
similar_makers: NexusGenRootTypes['User'][]; // [User!]!
@@ -744,6 +745,7 @@ export interface NexusGenFieldTypes {
linkedin: string | null; // String
location: string | null; // String
name: string; // String!
projects: NexusGenRootTypes['Project'][]; // [Project!]!
role: string | null; // String
roles: NexusGenRootTypes['MakerRole'][]; // [MakerRole!]!
similar_makers: NexusGenRootTypes['User'][]; // [User!]!
@@ -781,6 +783,7 @@ export interface NexusGenFieldTypes {
linkedin: string | null; // String
location: string | null; // String
name: string; // String!
projects: NexusGenRootTypes['Project'][]; // [Project!]!
role: string | null; // String
roles: NexusGenRootTypes['MakerRole'][]; // [MakerRole!]!
similar_makers: NexusGenRootTypes['User'][]; // [User!]!
@@ -937,6 +940,7 @@ export interface NexusGenFieldTypeNames {
name: 'String'
nostr_prv_key: 'String'
nostr_pub_key: 'String'
projects: 'Project'
role: 'String'
roles: 'MakerRole'
similar_makers: 'User'
@@ -1133,6 +1137,7 @@ export interface NexusGenFieldTypeNames {
linkedin: 'String'
location: 'String'
name: 'String'
projects: 'Project'
role: 'String'
roles: 'MakerRole'
similar_makers: 'User'
@@ -1170,6 +1175,7 @@ export interface NexusGenFieldTypeNames {
linkedin: 'String'
location: 'String'
name: 'String'
projects: 'Project'
role: 'String'
roles: 'MakerRole'
similar_makers: 'User'

View File

@@ -31,6 +31,7 @@ interface BaseUser {
linkedin: String
location: String
name: String!
projects: [Project!]!
role: String
roles: [MakerRole!]!
similar_makers: [User!]!
@@ -216,6 +217,7 @@ type MyProfile implements BaseUser {
name: String!
nostr_prv_key: String
nostr_pub_key: String
projects: [Project!]!
role: String
roles: [MakerRole!]!
similar_makers: [User!]!
@@ -554,6 +556,7 @@ type User implements BaseUser {
linkedin: String
location: String
name: String!
projects: [Project!]!
role: String
roles: [MakerRole!]!
similar_makers: [User!]!

View File

@@ -72,6 +72,19 @@ const BaseUser = interfaceType({
}).then(d => d.map(item => item.tournament))
}
})
t.nonNull.list.nonNull.field('projects', {
type: "Project",
resolve: async (parent) => {
return prisma.projectMember.findMany({
where: {
userId: parent.id
},
include: {
project: true
}
}).then(d => d.map(item => item.project))
}
})
t.nonNull.list.nonNull.field('similar_makers', {
type: "User",
resolve(parent,) {