feat: rename comment thread into activity (#939)
* feat: rename commentThread into activity server * feat: rename commentThread into activity front * feat: migration only create tables feat: migration only create tables * Update activities * fix: rebase partial fix * fix: all rebase problems and drop activity target alter * fix: lint * Update migration * Update migration * Fix conflicts * Fix conflicts --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import { CommentThreadService } from 'src/core/comment/services/comment-thread.service';
|
||||
import { CommentService } from 'src/core/comment/services/comment.service';
|
||||
import { CommentService } from 'src/core/comment/comment.service';
|
||||
import { ActivityService } from 'src/core/activity/services/activity.service';
|
||||
|
||||
import { PersonRelationsResolver } from './person-relations.resolver';
|
||||
import { PersonService } from './person.service';
|
||||
@ -18,7 +18,7 @@ describe('PersonRelationsResolver', () => {
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
provide: CommentThreadService,
|
||||
provide: ActivityService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,36 +1,36 @@
|
||||
import { Resolver, Root, ResolveField, Int } from '@nestjs/graphql';
|
||||
|
||||
import { CommentThread } from 'src/core/@generated/comment-thread/comment-thread.model';
|
||||
import { Comment } from 'src/core/@generated/comment/comment.model';
|
||||
import { Person } from 'src/core/@generated/person/person.model';
|
||||
import { CommentThreadService } from 'src/core/comment/services/comment-thread.service';
|
||||
import { CommentService } from 'src/core/comment/services/comment.service';
|
||||
import { CommentService } from 'src/core/comment/comment.service';
|
||||
import {
|
||||
PrismaSelect,
|
||||
PrismaSelector,
|
||||
} from 'src/decorators/prisma-select.decorator';
|
||||
import { Activity } from 'src/core/@generated/activity/activity.model';
|
||||
import { ActivityService } from 'src/core/activity/services/activity.service';
|
||||
|
||||
@Resolver(() => Person)
|
||||
export class PersonRelationsResolver {
|
||||
constructor(
|
||||
private readonly commentThreadService: CommentThreadService,
|
||||
private readonly activityService: ActivityService,
|
||||
private readonly commentService: CommentService,
|
||||
) {}
|
||||
|
||||
@ResolveField(() => [CommentThread], {
|
||||
@ResolveField(() => [Activity], {
|
||||
nullable: false,
|
||||
})
|
||||
async commentThreads(
|
||||
async activities(
|
||||
@Root() person: Person,
|
||||
@PrismaSelector({ modelName: 'CommentThread' })
|
||||
prismaSelect: PrismaSelect<'CommentThread'>,
|
||||
): Promise<Partial<CommentThread>[]> {
|
||||
return await this.commentThreadService.findMany({
|
||||
@PrismaSelector({ modelName: 'Activity' })
|
||||
prismaSelect: PrismaSelect<'Activity'>,
|
||||
): Promise<Partial<Activity>[]> {
|
||||
return await this.activityService.findMany({
|
||||
where: {
|
||||
commentThreadTargets: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableId: person.id,
|
||||
commentableType: 'Person',
|
||||
commentableId: person.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -48,11 +48,11 @@ export class PersonRelationsResolver {
|
||||
): Promise<Partial<Comment>[]> {
|
||||
return this.commentService.findMany({
|
||||
where: {
|
||||
commentThread: {
|
||||
commentThreadTargets: {
|
||||
activity: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableId: person.id,
|
||||
commentableType: 'Person',
|
||||
commentableId: person.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -64,13 +64,13 @@ export class PersonRelationsResolver {
|
||||
@ResolveField(() => Int, {
|
||||
nullable: false,
|
||||
})
|
||||
async _commentThreadCount(@Root() person: Person): Promise<number> {
|
||||
return this.commentThreadService.count({
|
||||
async _activityCount(@Root() person: Person): Promise<number> {
|
||||
return this.activityService.count({
|
||||
where: {
|
||||
commentThreadTargets: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableId: person.id,
|
||||
commentableType: 'Person',
|
||||
commentableId: person.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { CommentModule } from 'src/core/comment/comment.module';
|
||||
import { ActivityModule } from 'src/core/activity/activity.module';
|
||||
|
||||
import { PersonService } from './person.service';
|
||||
import { PersonResolver } from './person.resolver';
|
||||
import { PersonRelationsResolver } from './person-relations.resolver';
|
||||
|
||||
@Module({
|
||||
imports: [CommentModule, CommentModule],
|
||||
imports: [CommentModule, ActivityModule],
|
||||
providers: [PersonService, PersonResolver, PersonRelationsResolver],
|
||||
exports: [PersonService],
|
||||
})
|
||||
|
||||
@ -18,7 +18,6 @@ import { UpdateOnePersonArgs } from 'src/core/@generated/person/update-one-perso
|
||||
import { CreateOnePersonArgs } from 'src/core/@generated/person/create-one-person.args';
|
||||
import { AffectedRows } from 'src/core/@generated/prisma/affected-rows.output';
|
||||
import { DeleteManyPersonArgs } from 'src/core/@generated/person/delete-many-person.args';
|
||||
import { Workspace } from 'src/core/@generated/workspace/workspace.model';
|
||||
import { AuthWorkspace } from 'src/decorators/auth-workspace.decorator';
|
||||
import {
|
||||
PrismaSelect,
|
||||
@ -34,6 +33,7 @@ import {
|
||||
} from 'src/ability/handlers/person.ability-handler';
|
||||
import { UserAbility } from 'src/decorators/user-ability.decorator';
|
||||
import { AppAbility } from 'src/ability/ability.factory';
|
||||
import { Workspace } from 'src/core/@generated/workspace/workspace.model';
|
||||
|
||||
import { PersonService } from './person.service';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user