Implemented comment thread target picker with new dropdown components (#295)
* First draft of new relation picker and usage in comments --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -65,15 +65,6 @@ export class CommentThreadResolver {
|
||||
}
|
||||
|
||||
return createdCommentThread;
|
||||
|
||||
// return this.prismaService.commentThread.create({
|
||||
// data: {
|
||||
// ...args.data,
|
||||
// ...{ commentThreadTargets: undefined },
|
||||
// ...{ comments: { createMany: { data: newCommentData } } },
|
||||
// ...{ workspace: { connect: { id: workspace.id } } },
|
||||
// },
|
||||
// });
|
||||
}
|
||||
|
||||
@Query(() => [CommentThread])
|
||||
@ -86,6 +77,7 @@ export class CommentThreadResolver {
|
||||
args,
|
||||
workspace,
|
||||
);
|
||||
|
||||
const result = await this.prismaService.commentThread.findMany(
|
||||
preparedArgs,
|
||||
);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import * as TypeGraphQL from '@nestjs/graphql';
|
||||
import { CommentThreadTarget } from 'src/api/@generated/comment-thread-target/comment-thread-target.model';
|
||||
import { CommentThread } from 'src/api/@generated/comment-thread/comment-thread.model';
|
||||
import { Comment } from 'src/api/@generated/comment/comment.model';
|
||||
import { PrismaService } from 'src/database/prisma.service';
|
||||
@ -23,4 +24,21 @@ export class CommentThreadRelationsResolver {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@TypeGraphQL.ResolveField(() => [CommentThreadTarget], {
|
||||
nullable: true,
|
||||
})
|
||||
async commentThreadTargets(
|
||||
@TypeGraphQL.Root() commentThread: CommentThread,
|
||||
): Promise<CommentThreadTarget[]> {
|
||||
return this.prismaService.commentThreadTarget.findMany({
|
||||
where: {
|
||||
commentThreadId: commentThread.id,
|
||||
},
|
||||
orderBy: {
|
||||
// TODO: find a way to pass it in the query
|
||||
createdAt: 'desc',
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user