Refactor code structure and dependencies
This commit is contained in:
@@ -26,6 +26,9 @@ COPY --from=node_modules /app/node_modules ./node_modules
|
|||||||
# Expose the port
|
# Expose the port
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
|
||||||
|
# run migrations
|
||||||
|
RUN npm run prisma:migrate
|
||||||
# generate prisma client
|
# generate prisma client
|
||||||
RUN npm run prisma:generate
|
RUN npm run prisma:generate
|
||||||
|
|
||||||
|
|||||||
31
package-lock.json
generated
31
package-lock.json
generated
@@ -51,6 +51,7 @@
|
|||||||
"@types/node": "^20.3.1",
|
"@types/node": "^20.3.1",
|
||||||
"@types/passport-jwt": "^4.0.1",
|
"@types/passport-jwt": "^4.0.1",
|
||||||
"@types/supertest": "^6.0.0",
|
"@types/supertest": "^6.0.0",
|
||||||
|
"@types/ws": "^8.5.12",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||||
"@typescript-eslint/parser": "^8.0.0",
|
"@typescript-eslint/parser": "^8.0.0",
|
||||||
"eslint": "9.11.1",
|
"eslint": "9.11.1",
|
||||||
@@ -65,7 +66,8 @@
|
|||||||
"ts-loader": "^9.4.3",
|
"ts-loader": "^9.4.3",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tsconfig-paths": "^4.2.0",
|
"tsconfig-paths": "^4.2.0",
|
||||||
"typescript": "^5.1.3"
|
"typescript": "^5.1.3",
|
||||||
|
"ws": "^8.18.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
@@ -4930,6 +4932,27 @@
|
|||||||
"integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==",
|
"integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==",
|
||||||
"license": "0BSD"
|
"license": "0BSD"
|
||||||
},
|
},
|
||||||
|
"node_modules/@nestjs/graphql/node_modules/ws": {
|
||||||
|
"version": "8.17.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
||||||
|
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"bufferutil": "^4.0.1",
|
||||||
|
"utf-8-validate": ">=5.0.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"bufferutil": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"utf-8-validate": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@nestjs/jwt": {
|
"node_modules/@nestjs/jwt": {
|
||||||
"version": "10.2.0",
|
"version": "10.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nestjs/jwt/-/jwt-10.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@nestjs/jwt/-/jwt-10.2.0.tgz",
|
||||||
@@ -14846,9 +14869,9 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/ws": {
|
"node_modules/ws": {
|
||||||
"version": "8.17.1",
|
"version": "8.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||||
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
|
|||||||
@@ -40,8 +40,6 @@
|
|||||||
"@pothos/plugin-prisma-utils": "^1.2.0",
|
"@pothos/plugin-prisma-utils": "^1.2.0",
|
||||||
"@pothos/plugin-scope-auth": "^4.1.0",
|
"@pothos/plugin-scope-auth": "^4.1.0",
|
||||||
"@prisma/client": "^5.20.0",
|
"@prisma/client": "^5.20.0",
|
||||||
"@smatch-corp/nestjs-pothos": "^0.3.0",
|
|
||||||
"@smatch-corp/nestjs-pothos-apollo-driver": "^0.1.0",
|
|
||||||
"apollo-server-express": "^3.13.0",
|
"apollo-server-express": "^3.13.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
@@ -64,6 +62,7 @@
|
|||||||
"@types/node": "^20.3.1",
|
"@types/node": "^20.3.1",
|
||||||
"@types/passport-jwt": "^4.0.1",
|
"@types/passport-jwt": "^4.0.1",
|
||||||
"@types/supertest": "^6.0.0",
|
"@types/supertest": "^6.0.0",
|
||||||
|
"@types/ws": "^8.5.12",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||||
"@typescript-eslint/parser": "^8.0.0",
|
"@typescript-eslint/parser": "^8.0.0",
|
||||||
"eslint": "9.11.1",
|
"eslint": "9.11.1",
|
||||||
@@ -78,7 +77,8 @@
|
|||||||
"ts-loader": "^9.4.3",
|
"ts-loader": "^9.4.3",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tsconfig-paths": "^4.2.0",
|
"tsconfig-paths": "^4.2.0",
|
||||||
"typescript": "^5.1.3"
|
"typescript": "^5.1.3",
|
||||||
|
"ws": "^8.18.0"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"moduleFileExtensions": [
|
"moduleFileExtensions": [
|
||||||
|
|||||||
@@ -3,17 +3,17 @@ import PrismaPlugin from '@pothos/plugin-prisma';
|
|||||||
import PrismaUtils from '@pothos/plugin-prisma-utils';
|
import PrismaUtils from '@pothos/plugin-prisma-utils';
|
||||||
import { DateTimeResolver } from 'graphql-scalars';
|
import { DateTimeResolver } from 'graphql-scalars';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
import type PrismaTypes from '@pothos/plugin-prisma/generated';
|
import type PrismaTypes from '../types/pothos.generated';
|
||||||
import { getDatamodel } from '@pothos/plugin-prisma/generated';
|
import { getDatamodel } from '../types/pothos.generated';
|
||||||
|
|
||||||
export const prisma = new PrismaService();
|
export const prisma = new PrismaService({});
|
||||||
export const builder = new SchemaBuilder<{
|
export const builder = new SchemaBuilder<{
|
||||||
Scalars: {
|
Scalars: {
|
||||||
DateTime: {
|
DateTime: {
|
||||||
Input: Date;
|
Input: Date;
|
||||||
Output: Date;
|
Output: Date;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
PrismaTypes: PrismaTypes;
|
PrismaTypes: PrismaTypes;
|
||||||
}>({
|
}>({
|
||||||
plugins: [PrismaPlugin, PrismaUtils],
|
plugins: [PrismaPlugin, PrismaUtils],
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { builder, prisma } from './graphql.builder';
|
import { builder, prisma } from './graphql.builder';
|
||||||
|
import type PrismaTypes from '@pothos/plugin-prisma/generated';
|
||||||
|
|
||||||
builder.prismaObject('User', {
|
builder.prismaObject('User', {
|
||||||
fields: (t) => ({
|
fields: (t) => ({
|
||||||
@@ -9,9 +10,11 @@ builder.prismaObject('User', {
|
|||||||
role: t.exposeString('role'),
|
role: t.exposeString('role'),
|
||||||
createdAt: t.expose('createdAt', {
|
createdAt: t.expose('createdAt', {
|
||||||
type: 'DateTime',
|
type: 'DateTime',
|
||||||
|
nullable: true,
|
||||||
}),
|
}),
|
||||||
updatedAt: t.expose('updatedAt', {
|
updatedAt: t.expose('updatedAt', {
|
||||||
type: 'DateTime',
|
type: 'DateTime',
|
||||||
|
nullable: true,
|
||||||
}),
|
}),
|
||||||
order: t.relation('orders'),
|
order: t.relation('orders'),
|
||||||
serviceFeedbacks: t.relation('serviceFeedbacks'),
|
serviceFeedbacks: t.relation('serviceFeedbacks'),
|
||||||
@@ -114,4 +117,40 @@ builder.queryType({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// // Mutation section
|
||||||
|
// builder.mutationType({
|
||||||
|
// fields: (t) => ({
|
||||||
|
// createUser: t.prismaField({
|
||||||
|
// type: 'User',
|
||||||
|
// args: {
|
||||||
|
// data: t.arg({
|
||||||
|
// type: 'PrismaTypes.UserCreateInput',
|
||||||
|
// }),
|
||||||
|
// },
|
||||||
|
// resolve: (query, root, args, ctx, info) => {
|
||||||
|
// return prisma.user.create({
|
||||||
|
// data: args.data,
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// }),
|
||||||
|
// }),
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // Subscription section
|
||||||
|
// builder.subscriptionType({
|
||||||
|
// fields: (t) => ({
|
||||||
|
// userCreated: t.prismaField({
|
||||||
|
// type: 'User',
|
||||||
|
// subscribe: (query, root, args, ctx, info) => {
|
||||||
|
// return prisma.$subscribe.user({
|
||||||
|
// mutation_in: ['CREATED'],
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// resolve: (payload) => {
|
||||||
|
// return payload;
|
||||||
|
// },
|
||||||
|
// }),
|
||||||
|
// }),
|
||||||
|
// });
|
||||||
|
|
||||||
export const schema = builder.toSchema();
|
export const schema = builder.toSchema();
|
||||||
|
|||||||
595
src/types/pothos.generated.ts
Normal file
595
src/types/pothos.generated.ts
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user