add centerstaff mutation
This commit is contained in:
@@ -10,7 +10,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./src:/app/src
|
- ./src:/app/src
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=development
|
||||||
- DATABASE_URL=postgresql://your_username:your_password@10.0.27.1:5432/epess
|
- DATABASE_URL=postgresql://your_username:your_password@10.0.27.1:5432/epess
|
||||||
- CLERK_PUBLISHABLE_KEY=pk_test_aW4tY2hpbXAtOTcuY2xlcmsuYWNjb3VudHMuZGV2JA
|
- CLERK_PUBLISHABLE_KEY=pk_test_aW4tY2hpbXAtOTcuY2xlcmsuYWNjb3VudHMuZGV2JA
|
||||||
- CLERK_SECRET_KEY=sk_test_sA5lsb1GHwUNXWQCp5ev70QkaoF5EmdAHNWiCGwZF6
|
- CLERK_SECRET_KEY=sk_test_sA5lsb1GHwUNXWQCp5ev70QkaoF5EmdAHNWiCGwZF6
|
||||||
@@ -18,6 +18,9 @@ services:
|
|||||||
- LISTEN_PORT=3069
|
- LISTEN_PORT=3069
|
||||||
- SWAGGER_PATH=/swagger
|
- SWAGGER_PATH=/swagger
|
||||||
- API_PATH=/v1
|
- API_PATH=/v1
|
||||||
|
- MINIO_API_URL=https://objects.epess.org
|
||||||
|
- MINIO_ACCESS_KEY=71dNgJtzkelXtG3R6IVt
|
||||||
|
- MINIO_SECRET_KEY=53LmFiDCZxvflJIOsVF9cf0aqkIjNU2oOWtLzGsf
|
||||||
labels:
|
labels:
|
||||||
- 'traefik.enable=true'
|
- 'traefik.enable=true'
|
||||||
- 'traefik.http.routers.api.rule=Host(`api.epess.org`)'
|
- 'traefik.http.routers.api.rule=Host(`api.epess.org`)'
|
||||||
|
|||||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -42,6 +42,7 @@
|
|||||||
"graphql-tools": "^9.0.1",
|
"graphql-tools": "^9.0.1",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"minio": "^8.0.1",
|
"minio": "^8.0.1",
|
||||||
|
"nestjs-minio": "^2.6.2",
|
||||||
"passport-jwt": "^4.0.1",
|
"passport-jwt": "^4.0.1",
|
||||||
"reflect-metadata": "^0.2.0",
|
"reflect-metadata": "^0.2.0",
|
||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1",
|
||||||
@@ -11865,6 +11866,19 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/nestjs-minio": {
|
||||||
|
"version": "2.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/nestjs-minio/-/nestjs-minio-2.6.2.tgz",
|
||||||
|
"integrity": "sha512-RRrOyt0mZi6VOgm0KZSkeYRnFWMr1z+aaKzmnB/eOwBT11XGjqeY9aNEkPCMjBe+PFd6rethMV+bLtO9YXMsSA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"minio": "^8.0.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@nestjs/common": ">7.0.0",
|
||||||
|
"@nestjs/core": ">7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/no-case": {
|
"node_modules/no-case": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz",
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
"graphql-tools": "^9.0.1",
|
"graphql-tools": "^9.0.1",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"minio": "^8.0.1",
|
"minio": "^8.0.1",
|
||||||
|
"nestjs-minio": "^2.6.2",
|
||||||
"passport-jwt": "^4.0.1",
|
"passport-jwt": "^4.0.1",
|
||||||
"reflect-metadata": "^0.2.0",
|
"reflect-metadata": "^0.2.0",
|
||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1",
|
||||||
|
|||||||
@@ -49,5 +49,61 @@ export class CenterStaffSchema extends PothosSchema {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// mutations
|
||||||
|
this.builder.mutationFields((t) => ({
|
||||||
|
createCenterStaff: t.prismaField({
|
||||||
|
type: this.centerStaff(),
|
||||||
|
args: {
|
||||||
|
data: t.arg({
|
||||||
|
type: this.builder.generator.getCreateInput('CenterStaff'),
|
||||||
|
required: true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
|
return await this.prisma.centerStaff.create({
|
||||||
|
...query,
|
||||||
|
data: args.data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
updateCenterStaff: t.prismaField({
|
||||||
|
type: this.centerStaff(),
|
||||||
|
args: {
|
||||||
|
where: t.arg({
|
||||||
|
type: this.builder.generator.getWhereUnique('CenterStaff'),
|
||||||
|
required: true,
|
||||||
|
}),
|
||||||
|
data: t.arg({
|
||||||
|
type: this.builder.generator.getUpdateInput('CenterStaff'),
|
||||||
|
required: true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
|
return await this.prisma.centerStaff.update({
|
||||||
|
...query,
|
||||||
|
where: args.where,
|
||||||
|
data: args.data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
deleteCenterStaff: t.prismaField({
|
||||||
|
type: this.centerStaff(),
|
||||||
|
args: {
|
||||||
|
where: t.arg({
|
||||||
|
type: this.builder.generator.getWhereUnique('CenterStaff'),
|
||||||
|
required: true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
|
return await this.prisma.centerStaff.delete({
|
||||||
|
...query,
|
||||||
|
where: args.where,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
// import { Injectable } from '@nestjs/common';
|
||||||
|
// import { NestMinioService } from 'nestjs-minio';
|
||||||
|
// import { ConfigService } from '@nestjs/config';
|
||||||
// @Injectable()
|
// @Injectable()
|
||||||
// export class MinioService {
|
// export class MinioService extends NestMinioService {
|
||||||
// constructor(
|
// constructor(configService: ConfigService) {
|
||||||
// @Inject(forwardRef(() => ConfigService))
|
// super(configService);
|
||||||
// private configService: ConfigService,
|
// }
|
||||||
// ) {}
|
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -63,20 +63,23 @@ export class UserSchema extends PothosSchema {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
// userByToken: t.prismaField({
|
userBySession: t.prismaField({
|
||||||
// type: this.user(),
|
type: this.user(),
|
||||||
// args: this.builder.args({
|
args: {
|
||||||
// oauthToken: t.arg.string({ required: true }),
|
sessionId: t.arg({ type: 'String', required: true }),
|
||||||
// }),
|
},
|
||||||
// resolve: async (query, root, args, ctx, info) => {
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
// // check if the token is valid
|
// check if the token is valid
|
||||||
// const { user } = await clerkClient.verifyToken
|
const session = await clerkClient.sessions.getSession(args.sessionId);
|
||||||
// return await this.prisma.user.findFirst({
|
console.log(session);
|
||||||
// ...query,
|
return await this.prisma.user.findFirst({
|
||||||
// where: args.where,
|
...query,
|
||||||
// });
|
where: {
|
||||||
// },
|
id: session.userId,
|
||||||
// }),
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Mutation section
|
// Mutation section
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ async function bootstrap() {
|
|||||||
|
|
||||||
const document = SwaggerModule.createDocument(app, config);
|
const document = SwaggerModule.createDocument(app, config);
|
||||||
SwaggerModule.setup(process.env.SWAGGER_PATH ?? 'v1', app, document);
|
SwaggerModule.setup(process.env.SWAGGER_PATH ?? 'v1', app, document);
|
||||||
console.log(process.env.API_PATH);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
document.paths[process.env.API_PATH + '/graphql'] = {
|
document.paths[process.env.API_PATH + '/graphql'] = {
|
||||||
get: {
|
get: {
|
||||||
|
|||||||
Reference in New Issue
Block a user