Remove activityType and Id (#1179)
* Remove activityType and Id * Fix tests * Fix tests
This commit is contained in:
@ -29,8 +29,7 @@ export class CompanyRelationsResolver {
|
||||
where: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableType: 'Company',
|
||||
commentableId: company.id,
|
||||
companyId: company.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -51,8 +50,7 @@ export class CompanyRelationsResolver {
|
||||
activity: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableType: 'Company',
|
||||
commentableId: company.id,
|
||||
companyId: company.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -69,8 +67,7 @@ export class CompanyRelationsResolver {
|
||||
where: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableType: 'Company',
|
||||
commentableId: company.id,
|
||||
companyId: company.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -29,8 +29,7 @@ export class PersonRelationsResolver {
|
||||
where: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableType: 'Person',
|
||||
commentableId: person.id,
|
||||
personId: person.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -51,8 +50,7 @@ export class PersonRelationsResolver {
|
||||
activity: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableType: 'Person',
|
||||
commentableId: person.id,
|
||||
personId: person.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -69,8 +67,7 @@ export class PersonRelationsResolver {
|
||||
where: {
|
||||
activityTargets: {
|
||||
some: {
|
||||
commentableType: 'Person',
|
||||
commentableId: person.id,
|
||||
personId: person.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `commentableId` on the `activity_targets` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `commentableType` on the `activity_targets` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "activity_targets" DROP COLUMN "commentableId",
|
||||
DROP COLUMN "commentableType";
|
||||
|
||||
-- DropEnum
|
||||
DROP TYPE "CommentableType";
|
||||
@ -364,11 +364,6 @@ model Activity {
|
||||
@@map("activities")
|
||||
}
|
||||
|
||||
enum CommentableType {
|
||||
Person
|
||||
Company
|
||||
}
|
||||
|
||||
model Comment {
|
||||
/// @Validator.IsString()
|
||||
/// @Validator.IsOptional()
|
||||
@ -400,14 +395,12 @@ model ActivityTarget {
|
||||
/// @Validator.IsOptional()
|
||||
id String @id @default(uuid())
|
||||
|
||||
activity Activity @relation(fields: [activityId], references: [id], onDelete: Cascade)
|
||||
activityId String
|
||||
commentableType CommentableType?
|
||||
commentableId String?
|
||||
activity Activity @relation(fields: [activityId], references: [id], onDelete: Cascade)
|
||||
activityId String
|
||||
/// @TypeGraphQL.omit(input: true, output: true)
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||
/// @TypeGraphQL.omit(input: true, output: true)
|
||||
workspaceId String
|
||||
workspaceId String
|
||||
|
||||
personId String?
|
||||
person Person? @relation(fields: [personId], references: [id], onDelete: Cascade)
|
||||
|
||||
@ -18,8 +18,8 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb600',
|
||||
commentableType: 'Company',
|
||||
commentableId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
personId: null,
|
||||
companyId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
activityId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
@ -71,8 +71,8 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-a76aa0bfb600',
|
||||
commentableType: 'Person',
|
||||
commentableId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
|
||||
personId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
|
||||
companyId: null,
|
||||
activityId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
@ -108,8 +108,8 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-a76aa0bfba00',
|
||||
commentableType: 'Company',
|
||||
commentableId: 'twenty-dev-a674fa6c-1455-4c57-afaf-dd5dc086361e',
|
||||
personId: null,
|
||||
companyId: 'twenty-dev-a674fa6c-1455-4c57-afaf-dd5dc086361e',
|
||||
activityId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b76aaabfb408',
|
||||
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user