feat: add recruit_roles to project DB modal/api

This commit is contained in:
MTG2000
2022-09-06 11:41:09 +03:00
parent 6fe859ff85
commit 8c77b1be4f
6 changed files with 59 additions and 4 deletions

View File

@@ -436,6 +436,7 @@ export interface NexusGenFieldTypes {
id: number; // Int!
lightning_address: string | null; // String
lnurl_callback_url: string | null; // String
recruit_roles: NexusGenRootTypes['MakerRole'][]; // [MakerRole!]!
screenshots: string[]; // [String!]!
tags: NexusGenRootTypes['Tag'][]; // [Tag!]!
thumbnail_image: string; // String!
@@ -728,6 +729,7 @@ export interface NexusGenFieldTypeNames {
id: 'Int'
lightning_address: 'String'
lnurl_callback_url: 'String'
recruit_roles: 'MakerRole'
screenshots: 'String'
tags: 'Tag'
thumbnail_image: 'String'

View File

@@ -234,6 +234,7 @@ type Project {
id: Int!
lightning_address: String
lnurl_callback_url: String
recruit_roles: [MakerRole!]!
screenshots: [String!]!
tags: [Tag!]!
thumbnail_image: String!

View File

@@ -8,6 +8,7 @@ const {
const { prisma } = require('../../../prisma');
const { paginationArgs, getLnurlDetails, lightningAddressToLnurl } = require('./helpers');
const { MakerRole } = require('./users');
const Project = objectType({
@@ -44,6 +45,28 @@ const Project = objectType({
return prisma.project.findUnique({ where: { id: parent.id } }).tags();
}
})
t.nonNull.list.nonNull.field('recruit_roles', {
type: MakerRole,
resolve: async (parent) => {
const data = await prisma.project.findUnique({
where: {
id: parent.id
},
select: {
recruit_roles: {
select: {
role: true,
level: true
}
},
}
})
return data.recruit_roles.map(data => {
return ({ ...data.role, level: data.level })
})
}
})
}
})

View File

@@ -451,6 +451,7 @@ module.exports = {
User,
MyProfile,
WalletKey,
MakerRole,
// Queries
me,
profile,