feat: add capabilities table + query + add columns to project for project creation

This commit is contained in:
Dolu
2022-09-16 15:04:12 +02:00
parent da7e909b46
commit cc9eec8bfb
8 changed files with 213 additions and 6 deletions

View File

@@ -91,7 +91,10 @@ export interface NexusGenInputs {
title: string; // String!
}
TeamMemberInput: { // input type
avatar?: string | null; // String
id: number; // Int!
jobTitle?: string | null; // String
name?: string | null; // String
role: NexusGenEnums['TEAM_MEMBER_ROLE']; // TEAM_MEMBER_ROLE!
}
UpdateProjectInput: { // input type
@@ -177,6 +180,12 @@ export interface NexusGenObjects {
id: number; // Int!
workplan: string; // String!
}
Capability: { // root type
icon: string; // String!
id: number; // Int!
is_official: boolean; // Boolean!
title: string; // String!
}
Category: { // root type
icon?: string | null; // String
id: number; // Int!
@@ -428,6 +437,12 @@ export interface NexusGenFieldTypes {
id: number; // Int!
workplan: string; // String!
}
Capability: { // field return type
icon: string; // String!
id: number; // Int!
is_official: boolean; // Boolean!
title: string; // String!
}
Category: { // field return type
apps_count: number; // Int!
cover_image: string | null; // String
@@ -561,6 +576,7 @@ export interface NexusGenFieldTypes {
Query: { // field return type
allCategories: NexusGenRootTypes['Category'][]; // [Category!]!
allProjects: NexusGenRootTypes['Project'][]; // [Project!]!
getAllCapabilities: NexusGenRootTypes['Capability'][]; // [Capability!]!
getAllHackathons: NexusGenRootTypes['Hackathon'][]; // [Hackathon!]!
getAllMakersRoles: NexusGenRootTypes['GenericMakerRole'][]; // [GenericMakerRole!]!
getAllMakersSkills: NexusGenRootTypes['MakerSkill'][]; // [MakerSkill!]!
@@ -792,6 +808,12 @@ export interface NexusGenFieldTypeNames {
id: 'Int'
workplan: 'String'
}
Capability: { // field return type name
icon: 'String'
id: 'Int'
is_official: 'Boolean'
title: 'String'
}
Category: { // field return type name
apps_count: 'Int'
cover_image: 'String'
@@ -925,6 +947,7 @@ export interface NexusGenFieldTypeNames {
Query: { // field return type name
allCategories: 'Category'
allProjects: 'Project'
getAllCapabilities: 'Capability'
getAllHackathons: 'Hackathon'
getAllMakersRoles: 'GenericMakerRole'
getAllMakersSkills: 'MakerSkill'

View File

@@ -67,6 +67,13 @@ type BountyApplication {
workplan: String!
}
type Capability {
icon: String!
id: Int!
is_official: Boolean!
title: String!
}
type Category {
apps_count: Int!
cover_image: String
@@ -297,6 +304,7 @@ enum ProjectLaunchStatusEnum {
type Query {
allCategories: [Category!]!
allProjects(skip: Int = 0, take: Int = 50): [Project!]!
getAllCapabilities: [Capability!]!
getAllHackathons(sortBy: String, tag: Int): [Hackathon!]!
getAllMakersRoles: [GenericMakerRole!]!
getAllMakersSkills: [MakerSkill!]!
@@ -391,7 +399,10 @@ type Tag {
}
input TeamMemberInput {
avatar: String
id: Int!
jobTitle: String
name: String
role: TEAM_MEMBER_ROLE!
}

View File

@@ -119,6 +119,27 @@ const Award = objectType({
})
const Capability = objectType({
name: 'Capability',
definition(t) {
t.nonNull.int('id');
t.nonNull.string('title');
t.nonNull.string('icon');
t.nonNull.boolean('is_official');
}
})
const getAllCapabilities = extendType({
type: "Query",
definition(t) {
t.nonNull.list.nonNull.field('getAllCapabilities', {
type: Capability,
async resolve(parent, args, context) {
return prisma.capability.findMany();
}
})
}
})
const getProject = extendType({
@@ -297,6 +318,9 @@ const TeamMemberInput = inputObjectType({
name: 'TeamMemberInput',
definition(t) {
t.nonNull.int('id')
t.nullable.string('name')
t.nullable.string('avatar')
t.nullable.string('jobTitle')
t.nonNull.field("role", {
type: TEAM_MEMBER_ROLE
})
@@ -356,8 +380,33 @@ const createProject = extendType({
type: CreateProjectResponse,
args: { input: CreateProjectInput },
async resolve(_root, args, ctx) {
const { title } = args.input;
const {
title,
tagline,
hashtag,
description,
capabilities,
category_id,
cover_image,
discord,
github,
twitter,
website,
launch_status,
members,
recruit_roles,
screenshots,
thumbnail_image,
tournaments,
} = args.input
const user = await getUserByPubKey(ctx.userPubKey);
// Do some validation
if (!user)
throw new ApolloError("Not Authenticated");
// TODO Create project
}
})
},
@@ -438,6 +487,7 @@ module.exports = {
searchProjects,
projectsByCategory,
getLnurlDetailsForProject,
getAllCapabilities,
// Mutations
createProject,