Refactor code structure and dependencies

- Remove unused files and modules
- Update submodule URL for epess-database
- Update DATABASE_URL in compose.yaml
- Update CI workflow to fetch submodules during checkout and fix GITHUB_TOKEN issue
- Enable strict mode in tsconfig.json
- Add UsersService and UsersResolver in users module
- Remove AppService and AppController
- Update main.ts to remove unused imports and log statement
- Add PrismaModule and PrismaService
- Add PrismaContextMiddleware
- Update GraphQL module to use schema and PrismaService
- Update package.json dependencies and devDependencies
This commit is contained in:
2024-09-27 06:21:04 +07:00
parent 8fe5e62870
commit 258a35d364
23 changed files with 4751 additions and 894 deletions

4697
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,20 +23,34 @@
},
"dependencies": {
"@apollo/server": "^4.11.0",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/typescript": "^4.0.9",
"@graphql-codegen/typescript-operations": "^4.2.3",
"@graphql-codegen/typescript-resolvers": "^4.2.1",
"@nestjs/apollo": "^12.2.0",
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^3.2.3",
"@nestjs/core": "^10.0.0",
"@nestjs/graphql": "^12.2.0",
"@nestjs/jwt": "^10.2.0",
"@nestjs/platform-express": "^10.0.0",
"@pothos/core": "^4.2.0",
"@pothos/plugin-add-graphql": "^4.1.0",
"@pothos/plugin-prisma": "^4.2.1",
"@prisma/client": "^5.19.1",
"@pothos/plugin-prisma-utils": "^1.2.0",
"@pothos/plugin-scope-auth": "^4.1.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",
"bcryptjs": "^2.4.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"graphql": "^16.9.0",
"prisma": "^5.19.1",
"graphql-scalars": "^1.23.0",
"graphql-tools": "^9.0.1",
"jsonwebtoken": "^9.0.2",
"passport-jwt": "^4.0.1",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"
},
@@ -44,9 +58,11 @@
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@types/bcryptjs": "^2.4.6",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/passport-jwt": "^4.0.1",
"@types/supertest": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
@@ -55,6 +71,7 @@
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"prisma": "^5.20.0",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.1.0",

View File

@@ -1,22 +0,0 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AppController } from './app.controller';
import { AppService } from './app.service';
describe('AppController', () => {
let appController: AppController;
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [AppController],
providers: [AppService],
}).compile();
appController = app.get<AppController>(AppController);
});
describe('root', () => {
it('should return "Hello World!"', () => {
expect(appController.getHello()).toBe('Hello World!');
});
});
});

View File

@@ -1,12 +0,0 @@
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getHello(): string {
return this.appService.getHello();
}
}

View File

@@ -1,8 +1,11 @@
import { Module } from '@nestjs/common';
import { GraphqlModule } from './graphql/graphql.module';
import { PrismaModule } from './prisma/prisma.module';
import { UsersModule } from './users/users.module';
@Module({
imports: [PrismaModule, GraphqlModule],
imports: [
GraphqlModule, // GraphQL setup
],
})
export class AppModule {}

View File

@@ -1,8 +0,0 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
getHello(): string {
return 'Hello World!';
}
}

View File

@@ -0,0 +1,28 @@
import SchemaBuilder from '@pothos/core';
import PrismaPlugin from '@pothos/plugin-prisma';
import PrismaUtils from '@pothos/plugin-prisma-utils';
import { DateTimeResolver } from 'graphql-scalars';
import { PrismaService } from '../prisma/prisma.service';
import type PrismaTypes from '@pothos/plugin-prisma/generated';
import { getDatamodel } from '@pothos/plugin-prisma/generated';
export const prisma = new PrismaService();
export const builder = new SchemaBuilder<{
Scalars: {
DateTime: {
Input: Date;
Output: Date;
};
};
PrismaTypes: PrismaTypes;
}>({
plugins: [PrismaPlugin, PrismaUtils],
prisma: {
client: prisma,
exposeDescriptions: true,
filterConnectionTotalCount: true,
onUnusedQuery: process.env.NODE_ENV === 'production' ? null : 'warn',
dmmf: getDatamodel(),
},
});
builder.addScalarType('DateTime', DateTimeResolver, {});

View File

@@ -1,48 +1,18 @@
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
const subOperationHandler = (message: any, params: any, webSocket: any) => {
console.log('onOperation');
return params;
};
import { PrismaService } from '../prisma/prisma.service';
import { schema } from './schema';
@Module({
imports: [
GraphQLModule.forRoot<ApolloDriverConfig>({
driver: ApolloDriver, // Specify the driver
buildSchemaOptions: {
numberScalarMode: 'integer',
},
subscriptions: {
'subscriptions-transport-ws': {
keepAlive: 5000,
path: '/graphql-sub',
onOperation: (message: any, params: any, webSocket: any) => {
subOperationHandler(message, params, webSocket);
return params;
},
onConnect: (connectionParams: any, webSocket: any) => {
console.log('onConnect');
return connectionParams;
},
onDisconnect: (webSocket: any) => {
console.log('onDisconnect');
},
},
},
playground: {
workspaceName: 'EPESS',
tabs: [
{
endpoint: '/graphql',
query: `# Welcome to the EPESS GraphQL API
`,
},
],
},
introspection: true,
driver: ApolloDriver,
schema: schema,
debug: true,
allowBatchedHttpRequests: true,
introspection: true,
}),
],
providers: [PrismaService],
})
export class GraphqlModule {}

View File

@@ -1,28 +0,0 @@
import SchemaBuilder from '@pothos/core';
import { PrismaClient, Prisma } from '@prisma/client';
import PrismaPlugin from '@pothos/plugin-prisma';
import type PrismaTypes from '../types/pothos.type';
const prisma = new PrismaClient({});
const readOnlyPrisma = new PrismaClient({
datasources: {
db: {
url: process.env.READ_ONLY_REPLICA_URL,
},
},
});
const builder = new SchemaBuilder<{
Context: { user: { isAdmin: boolean } };
PrismaTypes: PrismaTypes;
}>({
plugins: [PrismaPlugin],
prisma: {
client: (ctx) => (ctx.user.isAdmin ? prisma : readOnlyPrisma),
// Because the prisma client is loaded dynamically, we need to explicitly provide the some information about the prisma schema
dmmf: Prisma.dmmf,
},
});
export default builder;

View File

@@ -1,18 +0,0 @@
import { Test, TestingModule } from '@nestjs/testing';
import { GraphqlService } from './graphql.service';
describe('GraphqlService', () => {
let service: GraphqlService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [GraphqlService],
}).compile();
service = module.get<GraphqlService>(GraphqlService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});

117
src/graphql/schema.ts Normal file
View File

@@ -0,0 +1,117 @@
import { builder, prisma } from './graphql.builder';
builder.prismaObject('User', {
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
email: t.exposeString('email'),
phoneNumber: t.exposeString('phoneNumber'),
role: t.exposeString('role'),
createdAt: t.expose('createdAt', {
type: 'DateTime',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
}),
order: t.relation('orders'),
serviceFeedbacks: t.relation('serviceFeedbacks'),
documents: t.relation('documents'),
sendingMessage: t.relation('sendingMessage'),
Service: t.relation('Service'),
center: t.relation('center'),
customerChatRoom: t.relation('customerChatRoom'),
centerStaffChatRoom: t.relation('centerStaffChatRoom'),
CenterStaff: t.relation('CenterStaff'),
WorkshopSubscription: t.relation('WorkshopSubscription'),
}),
});
builder.prismaObject('Order', {
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
}),
});
builder.prismaObject('ServiceFeedback', {
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
}),
});
builder.prismaObject('UploadedDocument', {
name: 'documents',
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
}),
});
builder.prismaObject('Message', {
name: 'sendingMessage',
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('senderId'),
}),
});
builder.prismaObject('Service', {
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
}),
});
builder.prismaObject('Center', {
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('centerOwnerId'),
}),
});
builder.prismaObject('ChatRoom', {
fields: (t) => ({
id: t.exposeID('id'),
}),
});
builder.prismaObject('CenterStaff', {
fields: (t) => ({
staffId: t.exposeID('staffId'),
centerId: t.exposeID('centerId'),
serviceId: t.exposeID('serviceId'),
}),
});
builder.prismaObject('WorkshopSubscription', {
fields: (t) => ({
userId: t.exposeID('userId'),
workshopId: t.exposeID('workshopId'),
user: t.relation('user'),
workshop: t.relation('workshop'),
}),
});
builder.prismaObject('Workshop', {
fields: (t) => ({
id: t.exposeID('id'),
}),
});
// Query section
builder.queryType({
fields: (t) => ({
users: t.prismaField({
type: ['User'], // Return type is a list of 'User'
resolve: (query, root, args, ctx, info) => {
return prisma.user.findMany({
...query,
// Include related posts in the query
});
},
}),
}),
});
export const schema = builder.toSchema();

View File

@@ -1,11 +1,9 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Logger } from '@nestjs/common';
// init log for bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
Logger.log(`Server running on http://localhost:3000`, 'Bootstrap');
}
bootstrap();

View File

@@ -0,0 +1,12 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
@Injectable()
export class PrismaContextMiddleware implements NestMiddleware {
constructor(private readonly prisma: PrismaService) {}
use(req: any, res: any, next: () => void) {
req.prisma = this.prisma; // Attach Prisma client to request object
next();
}
}

View File

@@ -1,9 +1,8 @@
import { Global, Module } from '@nestjs/common';
import { Module } from '@nestjs/common';
import { PrismaService } from './prisma.service';
@Global()
@Module({
providers: [PrismaService],
exports: [PrismaService],
exports: [PrismaService], // Export PrismaService so other modules can use it
})
export class PrismaModule {}

View File

@@ -2,10 +2,7 @@ import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService
extends PrismaClient
implements OnModuleInit, OnModuleDestroy
{
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
async onModuleInit() {
await this.$connect();
}

View File

@@ -1,593 +0,0 @@
/* eslint-disable */
import type { Prisma, User, Center, CenterStaff, Service, ServiceAndCategory, Category, ServiceFeedback, Milestone, Schedule, ChatRoom, Message, Order, RefundTicket, Payment, Workshop, WorkshopSubscription, WorkshopOrganization, UploadedDocument, ServiceMeetingRoom, WorkshopMeetingRoom } from "@prisma/client";
export default interface PrismaTypes {
User: {
Name: "User";
Shape: User;
Include: Prisma.UserInclude;
Select: Prisma.UserSelect;
OrderBy: Prisma.UserOrderByWithRelationInput;
WhereUnique: Prisma.UserWhereUniqueInput;
Where: Prisma.UserWhereInput;
Create: {};
Update: {};
RelationName: "orders" | "serviceFeedbacks" | "documents" | "sendingMessage" | "Service" | "center" | "customerChatRoom" | "centerStaffChatRoom" | "CenterStaff" | "WorkshopSubscription";
ListRelations: "orders" | "serviceFeedbacks" | "documents" | "sendingMessage" | "Service" | "customerChatRoom" | "centerStaffChatRoom" | "WorkshopSubscription";
Relations: {
orders: {
Shape: Order[];
Name: "Order";
Nullable: false;
};
serviceFeedbacks: {
Shape: ServiceFeedback[];
Name: "ServiceFeedback";
Nullable: false;
};
documents: {
Shape: UploadedDocument[];
Name: "UploadedDocument";
Nullable: false;
};
sendingMessage: {
Shape: Message[];
Name: "Message";
Nullable: false;
};
Service: {
Shape: Service[];
Name: "Service";
Nullable: false;
};
center: {
Shape: Center | null;
Name: "Center";
Nullable: true;
};
customerChatRoom: {
Shape: ChatRoom[];
Name: "ChatRoom";
Nullable: false;
};
centerStaffChatRoom: {
Shape: ChatRoom[];
Name: "ChatRoom";
Nullable: false;
};
CenterStaff: {
Shape: CenterStaff | null;
Name: "CenterStaff";
Nullable: true;
};
WorkshopSubscription: {
Shape: WorkshopSubscription[];
Name: "WorkshopSubscription";
Nullable: false;
};
};
};
Center: {
Name: "Center";
Shape: Center;
Include: Prisma.CenterInclude;
Select: Prisma.CenterSelect;
OrderBy: Prisma.CenterOrderByWithRelationInput;
WhereUnique: Prisma.CenterWhereUniqueInput;
Where: Prisma.CenterWhereInput;
Create: {};
Update: {};
RelationName: "services" | "centerOwner" | "chatRoom" | "CenterStaff";
ListRelations: "services" | "chatRoom" | "CenterStaff";
Relations: {
services: {
Shape: Service[];
Name: "Service";
Nullable: false;
};
centerOwner: {
Shape: User;
Name: "User";
Nullable: false;
};
chatRoom: {
Shape: ChatRoom[];
Name: "ChatRoom";
Nullable: false;
};
CenterStaff: {
Shape: CenterStaff[];
Name: "CenterStaff";
Nullable: false;
};
};
};
CenterStaff: {
Name: "CenterStaff";
Shape: CenterStaff;
Include: Prisma.CenterStaffInclude;
Select: Prisma.CenterStaffSelect;
OrderBy: Prisma.CenterStaffOrderByWithRelationInput;
WhereUnique: Prisma.CenterStaffWhereUniqueInput;
Where: Prisma.CenterStaffWhereInput;
Create: {};
Update: {};
RelationName: "staff" | "center" | "service" | "createdWorkshop";
ListRelations: "createdWorkshop";
Relations: {
staff: {
Shape: User;
Name: "User";
Nullable: false;
};
center: {
Shape: Center;
Name: "Center";
Nullable: false;
};
service: {
Shape: Service;
Name: "Service";
Nullable: false;
};
createdWorkshop: {
Shape: Workshop[];
Name: "Workshop";
Nullable: false;
};
};
};
Service: {
Name: "Service";
Shape: Service;
Include: Prisma.ServiceInclude;
Select: Prisma.ServiceSelect;
OrderBy: Prisma.ServiceOrderByWithRelationInput;
WhereUnique: Prisma.ServiceWhereUniqueInput;
Where: Prisma.ServiceWhereInput;
Create: {};
Update: {};
RelationName: "managedBy" | "feedbacks" | "order" | "center" | "workshop" | "milestone" | "schedule" | "serviceAndCategory" | "workshopOrganization" | "user";
ListRelations: "managedBy" | "feedbacks" | "order" | "workshop" | "milestone" | "schedule" | "serviceAndCategory" | "workshopOrganization";
Relations: {
managedBy: {
Shape: CenterStaff[];
Name: "CenterStaff";
Nullable: false;
};
feedbacks: {
Shape: ServiceFeedback[];
Name: "ServiceFeedback";
Nullable: false;
};
order: {
Shape: Order[];
Name: "Order";
Nullable: false;
};
center: {
Shape: Center;
Name: "Center";
Nullable: false;
};
workshop: {
Shape: Workshop[];
Name: "Workshop";
Nullable: false;
};
milestone: {
Shape: Milestone[];
Name: "Milestone";
Nullable: false;
};
schedule: {
Shape: Schedule[];
Name: "Schedule";
Nullable: false;
};
serviceAndCategory: {
Shape: ServiceAndCategory[];
Name: "ServiceAndCategory";
Nullable: false;
};
workshopOrganization: {
Shape: WorkshopOrganization[];
Name: "WorkshopOrganization";
Nullable: false;
};
user: {
Shape: User | null;
Name: "User";
Nullable: true;
};
};
};
ServiceAndCategory: {
Name: "ServiceAndCategory";
Shape: ServiceAndCategory;
Include: Prisma.ServiceAndCategoryInclude;
Select: Prisma.ServiceAndCategorySelect;
OrderBy: Prisma.ServiceAndCategoryOrderByWithRelationInput;
WhereUnique: Prisma.ServiceAndCategoryWhereUniqueInput;
Where: Prisma.ServiceAndCategoryWhereInput;
Create: {};
Update: {};
RelationName: "service" | "category";
ListRelations: never;
Relations: {
service: {
Shape: Service;
Name: "Service";
Nullable: false;
};
category: {
Shape: Category;
Name: "Category";
Nullable: false;
};
};
};
Category: {
Name: "Category";
Shape: Category;
Include: Prisma.CategoryInclude;
Select: Prisma.CategorySelect;
OrderBy: Prisma.CategoryOrderByWithRelationInput;
WhereUnique: Prisma.CategoryWhereUniqueInput;
Where: Prisma.CategoryWhereInput;
Create: {};
Update: {};
RelationName: "serviceAndCategory";
ListRelations: "serviceAndCategory";
Relations: {
serviceAndCategory: {
Shape: ServiceAndCategory[];
Name: "ServiceAndCategory";
Nullable: false;
};
};
};
ServiceFeedback: {
Name: "ServiceFeedback";
Shape: ServiceFeedback;
Include: Prisma.ServiceFeedbackInclude;
Select: Prisma.ServiceFeedbackSelect;
OrderBy: Prisma.ServiceFeedbackOrderByWithRelationInput;
WhereUnique: Prisma.ServiceFeedbackWhereUniqueInput;
Where: Prisma.ServiceFeedbackWhereInput;
Create: {};
Update: {};
RelationName: "user" | "service";
ListRelations: never;
Relations: {
user: {
Shape: User;
Name: "User";
Nullable: false;
};
service: {
Shape: Service;
Name: "Service";
Nullable: false;
};
};
};
Milestone: {
Name: "Milestone";
Shape: Milestone;
Include: Prisma.MilestoneInclude;
Select: Prisma.MilestoneSelect;
OrderBy: Prisma.MilestoneOrderByWithRelationInput;
WhereUnique: Prisma.MilestoneWhereUniqueInput;
Where: Prisma.MilestoneWhereInput;
Create: {};
Update: {};
RelationName: "service";
ListRelations: never;
Relations: {
service: {
Shape: Service;
Name: "Service";
Nullable: false;
};
};
};
Schedule: {
Name: "Schedule";
Shape: Schedule;
Include: Prisma.ScheduleInclude;
Select: Prisma.ScheduleSelect;
OrderBy: Prisma.ScheduleOrderByWithRelationInput;
WhereUnique: Prisma.ScheduleWhereUniqueInput;
Where: Prisma.ScheduleWhereInput;
Create: {};
Update: {};
RelationName: "service";
ListRelations: never;
Relations: {
service: {
Shape: Service;
Name: "Service";
Nullable: false;
};
};
};
ChatRoom: {
Name: "ChatRoom";
Shape: ChatRoom;
Include: Prisma.ChatRoomInclude;
Select: Prisma.ChatRoomSelect;
OrderBy: Prisma.ChatRoomOrderByWithRelationInput;
WhereUnique: Prisma.ChatRoomWhereUniqueInput;
Where: Prisma.ChatRoomWhereInput;
Create: {};
Update: {};
RelationName: "message" | "customer" | "center" | "centerStaff" | "meetingRoom";
ListRelations: "message";
Relations: {
message: {
Shape: Message[];
Name: "Message";
Nullable: false;
};
customer: {
Shape: User;
Name: "User";
Nullable: false;
};
center: {
Shape: Center;
Name: "Center";
Nullable: false;
};
centerStaff: {
Shape: User | null;
Name: "User";
Nullable: true;
};
meetingRoom: {
Shape: ServiceMeetingRoom | null;
Name: "ServiceMeetingRoom";
Nullable: true;
};
};
};
Message: {
Name: "Message";
Shape: Message;
Include: Prisma.MessageInclude;
Select: Prisma.MessageSelect;
OrderBy: Prisma.MessageOrderByWithRelationInput;
WhereUnique: Prisma.MessageWhereUniqueInput;
Where: Prisma.MessageWhereInput;
Create: {};
Update: {};
RelationName: "sender" | "chatRoom";
ListRelations: never;
Relations: {
sender: {
Shape: User;
Name: "User";
Nullable: false;
};
chatRoom: {
Shape: ChatRoom;
Name: "ChatRoom";
Nullable: false;
};
};
};
Order: {
Name: "Order";
Shape: Order;
Include: Prisma.OrderInclude;
Select: Prisma.OrderSelect;
OrderBy: Prisma.OrderOrderByWithRelationInput;
WhereUnique: Prisma.OrderWhereUniqueInput;
Where: Prisma.OrderWhereInput;
Create: {};
Update: {};
RelationName: "user" | "payment" | "service" | "refundTicket";
ListRelations: never;
Relations: {
user: {
Shape: User;
Name: "User";
Nullable: false;
};
payment: {
Shape: Payment;
Name: "Payment";
Nullable: false;
};
service: {
Shape: Service;
Name: "Service";
Nullable: false;
};
refundTicket: {
Shape: RefundTicket | null;
Name: "RefundTicket";
Nullable: true;
};
};
};
RefundTicket: {
Name: "RefundTicket";
Shape: RefundTicket;
Include: Prisma.RefundTicketInclude;
Select: Prisma.RefundTicketSelect;
OrderBy: Prisma.RefundTicketOrderByWithRelationInput;
WhereUnique: Prisma.RefundTicketWhereUniqueInput;
Where: Prisma.RefundTicketWhereInput;
Create: {};
Update: {};
RelationName: "order";
ListRelations: never;
Relations: {
order: {
Shape: Order;
Name: "Order";
Nullable: false;
};
};
};
Payment: {
Name: "Payment";
Shape: Payment;
Include: Prisma.PaymentInclude;
Select: Prisma.PaymentSelect;
OrderBy: Prisma.PaymentOrderByWithRelationInput;
WhereUnique: Prisma.PaymentWhereUniqueInput;
Where: Prisma.PaymentWhereInput;
Create: {};
Update: {};
RelationName: "Order";
ListRelations: never;
Relations: {
Order: {
Shape: Order | null;
Name: "Order";
Nullable: true;
};
};
};
Workshop: {
Name: "Workshop";
Shape: Workshop;
Include: Prisma.WorkshopInclude;
Select: Prisma.WorkshopSelect;
OrderBy: Prisma.WorkshopOrderByWithRelationInput;
WhereUnique: Prisma.WorkshopWhereUniqueInput;
Where: Prisma.WorkshopWhereInput;
Create: {};
Update: {};
RelationName: "service" | "workshopOrganization" | "workshopSubscription" | "staff";
ListRelations: "workshopOrganization" | "workshopSubscription";
Relations: {
service: {
Shape: Service;
Name: "Service";
Nullable: false;
};
workshopOrganization: {
Shape: WorkshopOrganization[];
Name: "WorkshopOrganization";
Nullable: false;
};
workshopSubscription: {
Shape: WorkshopSubscription[];
Name: "WorkshopSubscription";
Nullable: false;
};
staff: {
Shape: CenterStaff;
Name: "CenterStaff";
Nullable: false;
};
};
};
WorkshopSubscription: {
Name: "WorkshopSubscription";
Shape: WorkshopSubscription;
Include: Prisma.WorkshopSubscriptionInclude;
Select: Prisma.WorkshopSubscriptionSelect;
OrderBy: Prisma.WorkshopSubscriptionOrderByWithRelationInput;
WhereUnique: Prisma.WorkshopSubscriptionWhereUniqueInput;
Where: Prisma.WorkshopSubscriptionWhereInput;
Create: {};
Update: {};
RelationName: "user" | "workshop";
ListRelations: never;
Relations: {
user: {
Shape: User;
Name: "User";
Nullable: false;
};
workshop: {
Shape: Workshop;
Name: "Workshop";
Nullable: false;
};
};
};
WorkshopOrganization: {
Name: "WorkshopOrganization";
Shape: WorkshopOrganization;
Include: Prisma.WorkshopOrganizationInclude;
Select: Prisma.WorkshopOrganizationSelect;
OrderBy: Prisma.WorkshopOrganizationOrderByWithRelationInput;
WhereUnique: Prisma.WorkshopOrganizationWhereUniqueInput;
Where: Prisma.WorkshopOrganizationWhereInput;
Create: {};
Update: {};
RelationName: "workshop" | "service";
ListRelations: never;
Relations: {
workshop: {
Shape: Workshop;
Name: "Workshop";
Nullable: false;
};
service: {
Shape: Service;
Name: "Service";
Nullable: false;
};
};
};
UploadedDocument: {
Name: "UploadedDocument";
Shape: UploadedDocument;
Include: Prisma.UploadedDocumentInclude;
Select: Prisma.UploadedDocumentSelect;
OrderBy: Prisma.UploadedDocumentOrderByWithRelationInput;
WhereUnique: Prisma.UploadedDocumentWhereUniqueInput;
Where: Prisma.UploadedDocumentWhereInput;
Create: {};
Update: {};
RelationName: "user";
ListRelations: never;
Relations: {
user: {
Shape: User;
Name: "User";
Nullable: false;
};
};
};
ServiceMeetingRoom: {
Name: "ServiceMeetingRoom";
Shape: ServiceMeetingRoom;
Include: Prisma.ServiceMeetingRoomInclude;
Select: Prisma.ServiceMeetingRoomSelect;
OrderBy: Prisma.ServiceMeetingRoomOrderByWithRelationInput;
WhereUnique: Prisma.ServiceMeetingRoomWhereUniqueInput;
Where: Prisma.ServiceMeetingRoomWhereInput;
Create: {};
Update: {};
RelationName: "chattingRoom";
ListRelations: never;
Relations: {
chattingRoom: {
Shape: ChatRoom;
Name: "ChatRoom";
Nullable: false;
};
};
};
WorkshopMeetingRoom: {
Name: "WorkshopMeetingRoom";
Shape: WorkshopMeetingRoom;
Include: never;
Select: Prisma.WorkshopMeetingRoomSelect;
OrderBy: Prisma.WorkshopMeetingRoomOrderByWithRelationInput;
WhereUnique: Prisma.WorkshopMeetingRoomWhereUniqueInput;
Where: Prisma.WorkshopMeetingRoomWhereInput;
Create: {};
Update: {};
RelationName: never;
ListRelations: never;
Relations: {};
};
}

View File

10
src/users/users.module.ts Normal file
View File

@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { UsersService } from './users.service';
import { UsersResolver } from './users.resolver';
import { PrismaModule } from '../prisma/prisma.module'; // PrismaModule to access database
@Module({
imports: [PrismaModule],
providers: [UsersService, UsersResolver],
})
export class UsersModule {}

View File

@@ -0,0 +1,7 @@
import { Resolver, Query } from '@nestjs/graphql';
import { UsersService } from './users.service';
@Resolver('User')
export class UsersResolver {
constructor(private readonly usersService: UsersService) {}
}

View File

@@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class UsersService {}

View File

@@ -16,6 +16,7 @@
"noImplicitAny": true,
"strictBindCallApply": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"strict": true,
}
}