mirror of
https://github.com/aljazceru/landscape-template.git
synced 2025-12-18 23:04:20 +01:00
feat: add makers resolver to project query api
This commit is contained in:
@@ -279,6 +279,10 @@ export interface NexusGenObjects {
|
|||||||
votes_count: number; // Int!
|
votes_count: number; // Int!
|
||||||
website: string; // String!
|
website: string; // String!
|
||||||
}
|
}
|
||||||
|
ProjectMember: { // root type
|
||||||
|
role: NexusGenEnums['TEAM_MEMBER_ROLE']; // TEAM_MEMBER_ROLE!
|
||||||
|
user: NexusGenRootTypes['User']; // User!
|
||||||
|
}
|
||||||
Query: {};
|
Query: {};
|
||||||
Question: { // root type
|
Question: { // root type
|
||||||
body: string; // String!
|
body: string; // String!
|
||||||
@@ -564,6 +568,7 @@ export interface NexusGenFieldTypes {
|
|||||||
id: number; // Int!
|
id: number; // Int!
|
||||||
lightning_address: string | null; // String
|
lightning_address: string | null; // String
|
||||||
lnurl_callback_url: string | null; // String
|
lnurl_callback_url: string | null; // String
|
||||||
|
memebrs: NexusGenRootTypes['ProjectMember'][]; // [ProjectMember!]!
|
||||||
recruit_roles: NexusGenRootTypes['MakerRole'][]; // [MakerRole!]!
|
recruit_roles: NexusGenRootTypes['MakerRole'][]; // [MakerRole!]!
|
||||||
screenshots: string[]; // [String!]!
|
screenshots: string[]; // [String!]!
|
||||||
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
|
||||||
@@ -572,6 +577,10 @@ export interface NexusGenFieldTypes {
|
|||||||
votes_count: number; // Int!
|
votes_count: number; // Int!
|
||||||
website: string; // String!
|
website: string; // String!
|
||||||
}
|
}
|
||||||
|
ProjectMember: { // field return type
|
||||||
|
role: NexusGenEnums['TEAM_MEMBER_ROLE']; // TEAM_MEMBER_ROLE!
|
||||||
|
user: NexusGenRootTypes['User']; // User!
|
||||||
|
}
|
||||||
Query: { // field return type
|
Query: { // field return type
|
||||||
allCategories: NexusGenRootTypes['Category'][]; // [Category!]!
|
allCategories: NexusGenRootTypes['Category'][]; // [Category!]!
|
||||||
allProjects: NexusGenRootTypes['Project'][]; // [Project!]!
|
allProjects: NexusGenRootTypes['Project'][]; // [Project!]!
|
||||||
@@ -934,6 +943,7 @@ export interface NexusGenFieldTypeNames {
|
|||||||
id: 'Int'
|
id: 'Int'
|
||||||
lightning_address: 'String'
|
lightning_address: 'String'
|
||||||
lnurl_callback_url: 'String'
|
lnurl_callback_url: 'String'
|
||||||
|
memebrs: 'ProjectMember'
|
||||||
recruit_roles: 'MakerRole'
|
recruit_roles: 'MakerRole'
|
||||||
screenshots: 'String'
|
screenshots: 'String'
|
||||||
tags: 'Tag'
|
tags: 'Tag'
|
||||||
@@ -942,6 +952,10 @@ export interface NexusGenFieldTypeNames {
|
|||||||
votes_count: 'Int'
|
votes_count: 'Int'
|
||||||
website: 'String'
|
website: 'String'
|
||||||
}
|
}
|
||||||
|
ProjectMember: { // field return type name
|
||||||
|
role: 'TEAM_MEMBER_ROLE'
|
||||||
|
user: 'User'
|
||||||
|
}
|
||||||
Query: { // field return type name
|
Query: { // field return type name
|
||||||
allCategories: 'Category'
|
allCategories: 'Category'
|
||||||
allProjects: 'Project'
|
allProjects: 'Project'
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ type Project {
|
|||||||
id: Int!
|
id: Int!
|
||||||
lightning_address: String
|
lightning_address: String
|
||||||
lnurl_callback_url: String
|
lnurl_callback_url: String
|
||||||
|
memebrs: [ProjectMember!]!
|
||||||
recruit_roles: [MakerRole!]!
|
recruit_roles: [MakerRole!]!
|
||||||
screenshots: [String!]!
|
screenshots: [String!]!
|
||||||
tags: [Tag!]!
|
tags: [Tag!]!
|
||||||
@@ -302,6 +303,11 @@ enum ProjectLaunchStatusEnum {
|
|||||||
WIP
|
WIP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProjectMember {
|
||||||
|
role: TEAM_MEMBER_ROLE!
|
||||||
|
user: User!
|
||||||
|
}
|
||||||
|
|
||||||
type Query {
|
type Query {
|
||||||
allCategories: [Category!]!
|
allCategories: [Category!]!
|
||||||
allProjects(skip: Int = 0, take: Int = 50): [Project!]!
|
allProjects(skip: Int = 0, take: Int = 50): [Project!]!
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const { ImageInput } = require('./misc');
|
|||||||
const { MakerRole } = require('./users');
|
const { MakerRole } = require('./users');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Project = objectType({
|
const Project = objectType({
|
||||||
name: 'Project',
|
name: 'Project',
|
||||||
definition(t) {
|
definition(t) {
|
||||||
@@ -73,6 +74,20 @@ const Project = objectType({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.nonNull.list.nonNull.field('memebrs', {
|
||||||
|
type: ProjectMember,
|
||||||
|
resolve: (parent) => {
|
||||||
|
return prisma.projectMember.findMany({
|
||||||
|
where: {
|
||||||
|
projectId: parent.id
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
user: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
t.nonNull.list.nonNull.field('recruit_roles', {
|
t.nonNull.list.nonNull.field('recruit_roles', {
|
||||||
type: MakerRole,
|
type: MakerRole,
|
||||||
resolve: async (parent) => {
|
resolve: async (parent) => {
|
||||||
@@ -102,6 +117,17 @@ const TEAM_MEMBER_ROLE = enumType({
|
|||||||
members: ['Admin', 'Maker'],
|
members: ['Admin', 'Maker'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ProjectMember = objectType({
|
||||||
|
name: "ProjectMember",
|
||||||
|
definition(t) {
|
||||||
|
t.nonNull.field('user', {
|
||||||
|
type: "User"
|
||||||
|
})
|
||||||
|
t.nonNull.field("role", {
|
||||||
|
type: TEAM_MEMBER_ROLE
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
const Award = objectType({
|
const Award = objectType({
|
||||||
|
|||||||
Reference in New Issue
Block a user