Skip to content

Commit

Permalink
Merge pull request #112 from zhumeisongsong/feature/check-graphql-fed…
Browse files Browse the repository at this point in the history
…eration-serve

fix: 🐛 error when generating the graphQL schema
  • Loading branch information
zhumeisongsong authored Dec 10, 2024
2 parents 6db9607 + c89b354 commit be93772
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 21 deletions.
4 changes: 1 addition & 3 deletions apps/tasks/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
tasksAppConfig,
} from '@shared/config';
import { TasksModule } from '@tasks/interface-adapters';
import { AuthModule } from '@auth/interface-adapters';

import { AppController } from './app.controller';
import { AppService } from './app.service';
Expand All @@ -32,8 +31,7 @@ import { AppService } from './app.service';
sortSchema: true,
plugins: [ApolloServerPluginInlineTrace()],
}),
TasksModule,
AuthModule,
TasksModule
],
controllers: [AppController],
providers: [AppService],
Expand Down
4 changes: 1 addition & 3 deletions apps/users/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
authConfig,
} from '@shared/config';
import { UsersModule } from '@users/interface-adapters';
import { AuthModule } from '@auth/interface-adapters';

import { AppController } from './app.controller';
import { AppService } from './app.service';
Expand All @@ -38,8 +37,7 @@ import { AppService } from './app.service';
sortSchema: true,
plugins: [ApolloServerPluginInlineTrace()],
}),
UsersModule,
AuthModule,
UsersModule
],
controllers: [AppController],
providers: [AppService],
Expand Down
2 changes: 1 addition & 1 deletion apps/users/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule);

const configService = app.get(ConfigService);
const config = configService.get('userApp');
const config = configService.get('usersApp');

await app.listen(config.port);
Logger.log(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ describe('UserTaskDto', () => {
updatedAt,
taskId,
task,
userId,
user,
userId
);

expect(userTaskDto.id).toBe(id);
Expand All @@ -28,7 +27,6 @@ describe('UserTaskDto', () => {
expect(userTaskDto.taskId).toBe(taskId);
expect(userTaskDto.task).toBe(task);
expect(userTaskDto.userId).toBe(userId);
expect(userTaskDto.user).toBe(user);
});

it('should create a UserTaskDto instance with null values', () => {
Expand All @@ -46,8 +44,7 @@ describe('UserTaskDto', () => {
updatedAt,
taskId,
task,
userId,
user,
userId
);

expect(userTaskDto.id).toBe(id);
Expand All @@ -56,6 +53,5 @@ describe('UserTaskDto', () => {
expect(userTaskDto.taskId).toBe(taskId);
expect(userTaskDto.task).toBeNull();
expect(userTaskDto.userId).toBe(userId);
expect(userTaskDto.user).toBeNull();
});
});
9 changes: 1 addition & 8 deletions libs/tasks/interface-adapters/src/lib/dto/user-task.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Field, ID, ObjectType } from '@nestjs/graphql';
import { UserDto } from '@users/interface-adapters';
import { IsDate, IsNotEmpty, IsOptional, IsUUID } from 'class-validator';

import { TaskDto } from './task.dto';
Expand Down Expand Up @@ -35,25 +34,19 @@ export class UserTaskDto {
@IsUUID()
userId: string;

@Field(() => UserDto, { nullable: true })
@IsOptional()
user: UserDto | null;

constructor(
id: string,
createdAt: Date,
updatedAt: Date | null,
taskId: string,
task: TaskDto | null,
userId: string,
user: UserDto | null,
userId: string
) {
this.id = id;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
this.taskId = taskId;
this.task = task;
this.userId = userId;
this.user = user;
}
}

0 comments on commit be93772

Please sign in to comment.