Remove activityType and Id (#1179)

* Remove activityType and Id

* Fix tests

* Fix tests
This commit is contained in:
Charles Bochet
2023-08-12 02:31:54 +02:00
committed by GitHub
parent a30222fe76
commit 35ea6b5a2f
37 changed files with 360 additions and 822 deletions

View File

@ -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";

View File

@ -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)

View File

@ -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',
},