mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-16 04:44:29 +01:00
Merge pull request #156 from Dolu89/feature/list-your-product-ui-capabilities
feat: add capabilities table + query + add columns to project for project creation
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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!
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Project" ADD COLUMN "discord" TEXT NOT NULL DEFAULT E'',
|
||||
ADD COLUMN "github" TEXT NOT NULL DEFAULT E'',
|
||||
ADD COLUMN "hashtag" TEXT NOT NULL DEFAULT E'',
|
||||
ADD COLUMN "launch_status" TEXT NOT NULL DEFAULT E'',
|
||||
ADD COLUMN "tagline" TEXT NOT NULL DEFAULT E'',
|
||||
ADD COLUMN "twitter" TEXT NOT NULL DEFAULT E'';
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Capability" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"icon" TEXT,
|
||||
"is_official" BOOLEAN NOT NULL DEFAULT false,
|
||||
|
||||
CONSTRAINT "Capability_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_CapabilityToProject" (
|
||||
"A" INTEGER NOT NULL,
|
||||
"B" INTEGER NOT NULL
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Capability_title_key" ON "Capability"("title");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_CapabilityToProject_AB_unique" ON "_CapabilityToProject"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_CapabilityToProject_B_index" ON "_CapabilityToProject"("B");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_CapabilityToProject" ADD FOREIGN KEY ("A") REFERENCES "Capability"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_CapabilityToProject" ADD FOREIGN KEY ("B") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -131,6 +131,9 @@ model Project {
|
||||
screenshots String[]
|
||||
screenshots_ids Int[]
|
||||
website String
|
||||
discord String @default("")
|
||||
twitter String @default("")
|
||||
github String @default("")
|
||||
thumbnail_image String?
|
||||
thumbnail_image_id Int? @unique
|
||||
thumbnail_image_rel HostedImage? @relation("Project_Thumbnail", fields: [thumbnail_image_id], references: [id])
|
||||
@@ -139,14 +142,18 @@ model Project {
|
||||
cover_image_rel HostedImage? @relation("Project_CoverImage", fields: [cover_image_id], references: [id])
|
||||
lightning_address String?
|
||||
lnurl_callback_url String?
|
||||
tagline String @default("")
|
||||
launch_status String @default("")
|
||||
hashtag String @default("")
|
||||
|
||||
category Category @relation(fields: [category_id], references: [id])
|
||||
category_id Int
|
||||
votes_count Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
awards Award[]
|
||||
tags Tag[]
|
||||
awards Award[]
|
||||
tags Tag[]
|
||||
capabilities Capability[]
|
||||
|
||||
recruit_roles ProjectRecruitRoles[]
|
||||
tournaments TournamentProject[]
|
||||
@@ -409,3 +416,14 @@ model TournamentProject {
|
||||
|
||||
@@id([tournament_id, project_id])
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// Capability
|
||||
// -----------------
|
||||
model Capability {
|
||||
id Int @id @default(autoincrement())
|
||||
title String @unique
|
||||
icon String?
|
||||
is_official Boolean @default(false)
|
||||
project Project[]
|
||||
}
|
||||
|
||||
@@ -510,6 +510,63 @@ const skills = [
|
||||
},
|
||||
]
|
||||
|
||||
const capabilities = [
|
||||
{
|
||||
id: 1,
|
||||
is_official: true,
|
||||
title: 'Mobile',
|
||||
icon: '📱'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
is_official: true,
|
||||
title: 'Web',
|
||||
icon: '💻'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
is_official: true,
|
||||
title: 'WebLN',
|
||||
icon: '🎛️'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
is_official: true,
|
||||
title: 'LNURL-auth',
|
||||
icon: '🔑️️'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
is_official: true,
|
||||
title: 'LNURL-pay',
|
||||
icon: '💸'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
is_official: true,
|
||||
title: 'LNURL-channel',
|
||||
icon: '🕳️️'
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
is_official: true,
|
||||
title: 'LNURL-withdraw',
|
||||
icon: '🎬️'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
is_official: true,
|
||||
title: 'BOLT 11',
|
||||
icon: '⚡'
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
is_official: true,
|
||||
title: 'BOLT 12',
|
||||
icon: '⚡'
|
||||
},
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
categories,
|
||||
projects,
|
||||
@@ -517,4 +574,5 @@ module.exports = {
|
||||
hackathons,
|
||||
roles,
|
||||
skills,
|
||||
capabilities,
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
const { PrismaClient } = require("@prisma/client");
|
||||
const { generatePrivateKey, getPublicKey } = require("../../api/utils/nostr-tools");
|
||||
const { categories, projects, tags, hackathons, roles, skills } = require("./data");
|
||||
const { categories, projects, tags, hackathons, roles, skills, capabilities } = require("./data");
|
||||
const Chance = require('chance');
|
||||
const { getCoverImage, randomItems, random } = require("./helpers");
|
||||
const { tournament: tournamentMock } = require("./data/tournament.seed");
|
||||
@@ -67,7 +67,9 @@ async function main() {
|
||||
|
||||
// await createTournament();
|
||||
|
||||
await migrateOldImages();
|
||||
// await migrateOldImages();
|
||||
|
||||
await createCapabilities();
|
||||
}
|
||||
|
||||
async function migrateOldImages() {
|
||||
@@ -499,6 +501,13 @@ async function createTournament() {
|
||||
|
||||
}
|
||||
|
||||
async function createCapabilities() {
|
||||
console.log("Creating Capabilities");
|
||||
await prisma.capability.createMany({
|
||||
data: capabilities
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
|
||||
@@ -201,7 +201,7 @@ export default function ProjectDetailsTab(props: Props) {
|
||||
|
||||
<Card>
|
||||
<h2 className="text-body2 font-bolder">🦾 Capabilities</h2>
|
||||
<p className="text-body4 font-light text-gray-600 mt-8">Let other makers know what lightning capabilities your applicaiton has.</p>
|
||||
<p className="text-body4 font-light text-gray-600 mt-8">Let other makers know what lightning capabilities your application has.</p>
|
||||
<div className="mt-24">
|
||||
<Controller
|
||||
control={control}
|
||||
|
||||
Reference in New Issue
Block a user