Add type-graphql dependency and extend GraphQL schema with new types and fields
This commit is contained in:
105
package-lock.json
generated
105
package-lock.json
generated
@@ -39,7 +39,8 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"passport-jwt": "^4.0.1",
|
||||
"reflect-metadata": "^0.2.0",
|
||||
"rxjs": "^7.8.1"
|
||||
"rxjs": "^7.8.1",
|
||||
"type-graphql": "^2.0.0-rc.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@clerk/types": "^4.23.0",
|
||||
@@ -4189,6 +4190,46 @@
|
||||
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@graphql-yoga/subscription": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@graphql-yoga/subscription/-/subscription-5.0.1.tgz",
|
||||
"integrity": "sha512-1wCB1DfAnaLzS+IdoOzELGGnx1ODEg9nzQXFh4u2j02vAnne6d+v4A7HIH9EqzVdPLoAaMKXCZUUdKs+j3z1fg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@graphql-yoga/typed-event-target": "^3.0.0",
|
||||
"@repeaterjs/repeater": "^3.0.4",
|
||||
"@whatwg-node/events": "^0.1.0",
|
||||
"tslib": "^2.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@graphql-yoga/subscription/node_modules/@whatwg-node/events": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@whatwg-node/events/-/events-0.1.2.tgz",
|
||||
"integrity": "sha512-ApcWxkrs1WmEMS2CaLLFUEem/49erT3sxIVjpzU5f6zmVcnijtDSrhoK2zVobOIikZJdH63jdAXOrvjf6eOUNQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@graphql-yoga/typed-event-target": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@graphql-yoga/typed-event-target/-/typed-event-target-3.0.0.tgz",
|
||||
"integrity": "sha512-w+liuBySifrstuHbFrHoHAEyVnDFVib+073q8AeAJ/qqJfvFvAwUPLLtNohR/WDVRgSasfXtl3dcNuVJWN+rjg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@repeaterjs/repeater": "^3.0.4",
|
||||
"tslib": "^2.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/module-importer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
|
||||
@@ -5636,7 +5677,6 @@
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@repeaterjs/repeater/-/repeater-3.0.6.tgz",
|
||||
"integrity": "sha512-Javneu5lsuhwNCryN+pXH93VPQ8g0dBX7wItHFgYiwQmzE1sVdg5tWHiOgHywzL2W21XQopa7IwIEnNbmeUJYA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@sinclair/typebox": {
|
||||
@@ -5978,6 +6018,12 @@
|
||||
"integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz",
|
||||
"integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/send": {
|
||||
"version": "0.17.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz",
|
||||
@@ -9934,6 +9980,18 @@
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/graphql-query-complexity": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/graphql-query-complexity/-/graphql-query-complexity-0.12.0.tgz",
|
||||
"integrity": "sha512-fWEyuSL6g/+nSiIRgIipfI6UXTI7bAxrpPlCY1c0+V3pAEUo1ybaKmSBgNr1ed2r+agm1plJww8Loig9y6s2dw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lodash.get": "^4.4.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"graphql": "^14.6.0 || ^15.0.0 || ^16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/graphql-request": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-6.1.0.tgz",
|
||||
@@ -11817,6 +11875,12 @@
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.get": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
@@ -14713,6 +14777,43 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/type-graphql": {
|
||||
"version": "2.0.0-rc.2",
|
||||
"resolved": "https://registry.npmjs.org/type-graphql/-/type-graphql-2.0.0-rc.2.tgz",
|
||||
"integrity": "sha512-DJ8erG1cmjteMrOhFIkBHOqRM+L+wCJxvNjbbj1Y+q2r4HZkB1qOSS4ZD4AaoAfRPAp1yU23gMtmzf0jen/FFA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/TypeGraphQL"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typegraphql"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@graphql-yoga/subscription": "^5.0.0",
|
||||
"@types/node": "*",
|
||||
"@types/semver": "^7.5.6",
|
||||
"graphql-query-complexity": "^0.12.0",
|
||||
"semver": "^7.5.4",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18.12.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"class-validator": ">=0.14.0",
|
||||
"graphql": "^16.8.1",
|
||||
"graphql-scalars": "^1.23.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"class-validator": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"passport-jwt": "^4.0.1",
|
||||
"reflect-metadata": "^0.2.0",
|
||||
"rxjs": "^7.8.1"
|
||||
"rxjs": "^7.8.1",
|
||||
"type-graphql": "^2.0.0-rc.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@clerk/types": "^4.23.0",
|
||||
|
||||
@@ -61,10 +61,74 @@ builder.prismaObject('Message', {
|
||||
builder.prismaObject('Service', {
|
||||
fields: (t) => ({
|
||||
id: t.exposeID('id'),
|
||||
name: t.exposeString('name'),
|
||||
description: t.exposeString('description'),
|
||||
centerId: t.exposeID('centerId'),
|
||||
price: t.expose('price', {
|
||||
type: 'Float',
|
||||
}),
|
||||
rating: t.expose('rating', {
|
||||
type: 'Float',
|
||||
}),
|
||||
createdAt: t.expose('createdAt', {
|
||||
type: 'DateTime',
|
||||
nullable: true,
|
||||
}),
|
||||
updatedAt: t.expose('updatedAt', {
|
||||
type: 'DateTime',
|
||||
nullable: true,
|
||||
}),
|
||||
managedBy: t.relation('managedBy'),
|
||||
feedbacks: t.relation('feedbacks'),
|
||||
order: t.relation('order'),
|
||||
workshop: t.relation('workshop'),
|
||||
milestone: t.relation('milestone'),
|
||||
schedule: t.relation('schedule'),
|
||||
serviceAndCategory: t.relation('serviceAndCategory'),
|
||||
workshopOrganization: t.relation('workshopOrganization'),
|
||||
user: t.relation('user'),
|
||||
userId: t.exposeID('userId'),
|
||||
}),
|
||||
});
|
||||
|
||||
builder.prismaObject('Milestone', {
|
||||
fields: (t) => ({
|
||||
id: t.exposeID('id'),
|
||||
serviceId: t.exposeID('serviceId'),
|
||||
}),
|
||||
});
|
||||
|
||||
builder.prismaObject('Schedule', {
|
||||
fields: (t) => ({
|
||||
id: t.exposeID('id'),
|
||||
serviceId: t.exposeID('serviceId'),
|
||||
}),
|
||||
});
|
||||
|
||||
builder.prismaObject('ServiceAndCategory', {
|
||||
fields: (t) => ({
|
||||
serviceId: t.exposeID('serviceId'),
|
||||
categoryId: t.exposeID('categoryId'),
|
||||
service: t.relation('service'),
|
||||
category: t.relation('category'),
|
||||
}),
|
||||
});
|
||||
|
||||
builder.prismaObject('WorkshopOrganization', {
|
||||
fields: (t) => ({
|
||||
serviceId: t.exposeID('serviceId'),
|
||||
workshopId: t.exposeID('workshopId'),
|
||||
service: t.relation('service'),
|
||||
workshop: t.relation('workshop'),
|
||||
}),
|
||||
});
|
||||
|
||||
builder.prismaObject('Category', {
|
||||
fields: (t) => ({
|
||||
id: t.exposeID('id'),
|
||||
}),
|
||||
});
|
||||
|
||||
builder.prismaObject('Center', {
|
||||
fields: (t) => ({
|
||||
id: t.exposeID('id'),
|
||||
@@ -166,6 +230,19 @@ builder.queryType({
|
||||
});
|
||||
},
|
||||
}),
|
||||
service: t.prismaField({
|
||||
type: 'Service',
|
||||
args: {
|
||||
id: t.arg.string(),
|
||||
},
|
||||
resolve: (query, root, args, ctx, info) => {
|
||||
return prisma.service.findUnique({
|
||||
where: {
|
||||
id: args.id?.toString(),
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
centers: t.prismaField({
|
||||
type: ['Center'],
|
||||
resolve: (query, root, args, ctx, info) => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user