Remove old body on note and tasks (#13290)
Fixes: https://github.com/twentyhq/twenty/issues/13110 I'm deprecating note.body and task.body to remove confusion between body and bodyV2 What will be left but should be done later to avoid breaking changes: - re-add a body field in the graphql API only that points to the same bodyV2 field in SQL (need to be handled in fields and filter for note and task) - (wait some time) - remove bodyV2 field
This commit is contained in:
@ -13,7 +13,7 @@ export const createOneActivityOperationSignatureFactory: RecordGqlOperationSigna
|
|||||||
createdAt: true,
|
createdAt: true,
|
||||||
updatedAt: true,
|
updatedAt: true,
|
||||||
attachments: true,
|
attachments: true,
|
||||||
body: true,
|
bodyV2: true,
|
||||||
title: true,
|
title: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ export const createOneActivityOperationSignatureFactory: RecordGqlOperationSigna
|
|||||||
__typename: true,
|
__typename: true,
|
||||||
},
|
},
|
||||||
attachments: true,
|
attachments: true,
|
||||||
body: true,
|
bodyV2: true,
|
||||||
title: true,
|
title: true,
|
||||||
status: true,
|
status: true,
|
||||||
dueAt: true,
|
dueAt: true,
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { ReactNode } from 'react';
|
|||||||
import { RecoilRoot } from 'recoil';
|
import { RecoilRoot } from 'recoil';
|
||||||
|
|
||||||
import { useActivities } from '@/activities/hooks/useActivities';
|
import { useActivities } from '@/activities/hooks/useActivities';
|
||||||
|
import { Task } from '@/activities/types/Task';
|
||||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
jest.mock('@/activities/hooks/useActivityTargetsForTargetableObjects', () => ({
|
jest.mock('@/activities/hooks/useActivityTargetsForTargetableObjects', () => ({
|
||||||
@ -24,17 +25,20 @@ const mockActivityTarget = {
|
|||||||
|
|
||||||
const mockActivity = {
|
const mockActivity = {
|
||||||
__typename: 'Task',
|
__typename: 'Task',
|
||||||
companyId: '123',
|
|
||||||
updatedAt: '2021-08-03T19:20:06.000Z',
|
updatedAt: '2021-08-03T19:20:06.000Z',
|
||||||
createdAt: '2021-08-03T19:20:06.000Z',
|
createdAt: '2021-08-03T19:20:06.000Z',
|
||||||
status: 'DONE',
|
status: 'DONE',
|
||||||
reminderAt: '2021-08-03T19:20:06.000Z',
|
|
||||||
title: 'title',
|
title: 'title',
|
||||||
body: 'body',
|
|
||||||
dueAt: '2021-08-03T19:20:06.000Z',
|
dueAt: '2021-08-03T19:20:06.000Z',
|
||||||
assigneeId: '1',
|
assigneeId: '1',
|
||||||
id: '234',
|
id: '234',
|
||||||
};
|
bodyV2: {
|
||||||
|
blocknote: 'My Body',
|
||||||
|
markdown: 'My Body',
|
||||||
|
},
|
||||||
|
assignee: null,
|
||||||
|
taskTargets: [],
|
||||||
|
} satisfies Task;
|
||||||
|
|
||||||
const Wrapper = ({ children }: { children: ReactNode }) => (
|
const Wrapper = ({ children }: { children: ReactNode }) => (
|
||||||
<RecoilRoot>{children}</RecoilRoot>
|
<RecoilRoot>{children}</RecoilRoot>
|
||||||
|
|||||||
@ -39,7 +39,10 @@ const taskTarget = {
|
|||||||
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
||||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||||
dueAt: null,
|
dueAt: null,
|
||||||
body: '{}',
|
bodyV2: {
|
||||||
|
blocknote: '',
|
||||||
|
markdown: '',
|
||||||
|
},
|
||||||
title: 'Task title',
|
title: 'Task title',
|
||||||
assigneeId: null,
|
assigneeId: null,
|
||||||
__typename: 'Task',
|
__typename: 'Task',
|
||||||
@ -95,7 +98,6 @@ const task = {
|
|||||||
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
||||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||||
title: 'Task title',
|
title: 'Task title',
|
||||||
body: '',
|
|
||||||
bodyV2: {
|
bodyV2: {
|
||||||
blocknote: null,
|
blocknote: null,
|
||||||
markdown: null,
|
markdown: null,
|
||||||
|
|||||||
@ -13,7 +13,7 @@ const toISOStringMock = jest.fn(() => mockedDate);
|
|||||||
global.Date.prototype.toISOString = toISOStringMock;
|
global.Date.prototype.toISOString = toISOStringMock;
|
||||||
|
|
||||||
const mockedActivity = {
|
const mockedActivity = {
|
||||||
...pick(mockedTasks[0], ['id', 'title', 'body', 'type', 'status', 'dueAt']),
|
...pick(mockedTasks[0], ['id', 'title', 'bodyV2', 'type', 'status', 'dueAt']),
|
||||||
updatedAt: mockedDate,
|
updatedAt: mockedDate,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,7 +56,10 @@ const mocks: MockedResponse[] = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body
|
bodyV2 {
|
||||||
|
blocknote
|
||||||
|
markdown
|
||||||
|
}
|
||||||
createdAt
|
createdAt
|
||||||
dueAt
|
dueAt
|
||||||
id
|
id
|
||||||
|
|||||||
@ -17,7 +17,7 @@ const toISOStringMock = jest.fn(() => mockedDate);
|
|||||||
global.Date.prototype.toISOString = toISOStringMock;
|
global.Date.prototype.toISOString = toISOStringMock;
|
||||||
|
|
||||||
const mockedActivity = {
|
const mockedActivity = {
|
||||||
...pick(mockedTasks[0], ['id', 'title', 'body', 'type', 'status', 'dueAt']),
|
...pick(mockedTasks[0], ['id', 'title', 'bodyV2', 'type', 'status', 'dueAt']),
|
||||||
updatedAt: mockedDate,
|
updatedAt: mockedDate,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,6 @@ const mocks: MockedResponse[] = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body
|
|
||||||
bodyV2 {
|
bodyV2 {
|
||||||
blocknote
|
blocknote
|
||||||
markdown
|
markdown
|
||||||
@ -181,7 +180,6 @@ const mocks: MockedResponse[] = [
|
|||||||
assignee: null,
|
assignee: null,
|
||||||
assigneeId: '123',
|
assigneeId: '123',
|
||||||
attachments: { edges: [] },
|
attachments: { edges: [] },
|
||||||
body: 'Test',
|
|
||||||
bodyV2: {
|
bodyV2: {
|
||||||
blocknote: 'Test',
|
blocknote: 'Test',
|
||||||
markdown: 'Test',
|
markdown: 'Test',
|
||||||
|
|||||||
@ -197,7 +197,6 @@ const UPDATE_ONE_FAVORITE_MUTATION = gql`
|
|||||||
id
|
id
|
||||||
note {
|
note {
|
||||||
__typename
|
__typename
|
||||||
body
|
|
||||||
bodyV2 {
|
bodyV2 {
|
||||||
blocknote
|
blocknote
|
||||||
markdown
|
markdown
|
||||||
@ -393,7 +392,6 @@ const UPDATE_ONE_FAVORITE_MUTATION = gql`
|
|||||||
task {
|
task {
|
||||||
__typename
|
__typename
|
||||||
assigneeId
|
assigneeId
|
||||||
body
|
|
||||||
bodyV2 {
|
bodyV2 {
|
||||||
blocknote
|
blocknote
|
||||||
markdown
|
markdown
|
||||||
@ -592,7 +590,6 @@ export const mocks = [
|
|||||||
id
|
id
|
||||||
note {
|
note {
|
||||||
__typename
|
__typename
|
||||||
body
|
|
||||||
bodyV2 {
|
bodyV2 {
|
||||||
blocknote
|
blocknote
|
||||||
markdown
|
markdown
|
||||||
@ -788,7 +785,6 @@ export const mocks = [
|
|||||||
task {
|
task {
|
||||||
__typename
|
__typename
|
||||||
assigneeId
|
assigneeId
|
||||||
body
|
|
||||||
bodyV2 {
|
bodyV2 {
|
||||||
blocknote
|
blocknote
|
||||||
markdown
|
markdown
|
||||||
|
|||||||
@ -128,7 +128,6 @@ const mocks: MockedResponse[] = [
|
|||||||
id
|
id
|
||||||
note {
|
note {
|
||||||
__typename
|
__typename
|
||||||
body
|
|
||||||
bodyV2 {
|
bodyV2 {
|
||||||
blocknote
|
blocknote
|
||||||
markdown
|
markdown
|
||||||
@ -571,7 +570,6 @@ const mocks: MockedResponse[] = [
|
|||||||
task {
|
task {
|
||||||
__typename
|
__typename
|
||||||
assigneeId
|
assigneeId
|
||||||
body
|
|
||||||
bodyV2 {
|
bodyV2 {
|
||||||
blocknote
|
blocknote
|
||||||
markdown
|
markdown
|
||||||
|
|||||||
@ -7197,27 +7197,6 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
|||||||
"description": "Task title",
|
"description": "Task title",
|
||||||
"icon": "IconNotes"
|
"icon": "IconNotes"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__typename": "Field",
|
|
||||||
"id": "7fd11cd9-16c5-4b29-aa2d-8b4796fc07dd",
|
|
||||||
"type": "RICH_TEXT",
|
|
||||||
"name": "body",
|
|
||||||
"isCustom": false,
|
|
||||||
"isActive": true,
|
|
||||||
"isSystem": false,
|
|
||||||
"isNullable": true,
|
|
||||||
"isUnique": false,
|
|
||||||
"createdAt": "2025-06-09T18:53:47.000Z",
|
|
||||||
"updatedAt": "2025-06-09T18:53:47.000Z",
|
|
||||||
"defaultValue": null,
|
|
||||||
"options": null,
|
|
||||||
"settings": null,
|
|
||||||
"isLabelSyncedWithName": false,
|
|
||||||
"relation": null,
|
|
||||||
"label": "Body (deprecated)",
|
|
||||||
"description": "Task body",
|
|
||||||
"icon": "IconFilePencil"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__typename": "Field",
|
"__typename": "Field",
|
||||||
"id": "9b83c867-18c1-4c25-bd45-2d3a38ebdbb3",
|
"id": "9b83c867-18c1-4c25-bd45-2d3a38ebdbb3",
|
||||||
@ -13000,27 +12979,6 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
|||||||
"description": "Note title",
|
"description": "Note title",
|
||||||
"icon": "IconNotes"
|
"icon": "IconNotes"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__typename": "Field",
|
|
||||||
"id": "21285048-5fd7-4d15-bf60-aec6762cf591",
|
|
||||||
"type": "RICH_TEXT",
|
|
||||||
"name": "body",
|
|
||||||
"isCustom": false,
|
|
||||||
"isActive": true,
|
|
||||||
"isSystem": false,
|
|
||||||
"isNullable": true,
|
|
||||||
"isUnique": false,
|
|
||||||
"createdAt": "2025-06-09T18:53:47.000Z",
|
|
||||||
"updatedAt": "2025-06-09T18:53:47.000Z",
|
|
||||||
"defaultValue": null,
|
|
||||||
"options": null,
|
|
||||||
"settings": null,
|
|
||||||
"isLabelSyncedWithName": false,
|
|
||||||
"relation": null,
|
|
||||||
"label": "Body (deprecated)",
|
|
||||||
"description": "Note body",
|
|
||||||
"icon": "IconFilePencil"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__typename": "Field",
|
"__typename": "Field",
|
||||||
"id": "b44eecda-a7e8-44ff-8db1-4ce2ca80f34c",
|
"id": "b44eecda-a7e8-44ff-8db1-4ce2ca80f34c",
|
||||||
|
|||||||
@ -2832,7 +2832,6 @@ export const oneSucceededWorkflowRunQueryResult = {
|
|||||||
},
|
},
|
||||||
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
|
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
|
||||||
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
|
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
|
||||||
body: null,
|
|
||||||
title: 'Proposal for ',
|
title: 'Proposal for ',
|
||||||
bodyV2: {
|
bodyV2: {
|
||||||
markdown: '',
|
markdown: '',
|
||||||
@ -2968,13 +2967,6 @@ export const oneSucceededWorkflowRunQueryResult = {
|
|||||||
value: '123e4567-e89b-12d3-a456-426614174000',
|
value: '123e4567-e89b-12d3-a456-426614174000',
|
||||||
isLeaf: true,
|
isLeaf: true,
|
||||||
},
|
},
|
||||||
body: {
|
|
||||||
icon: 'IconFilePencil',
|
|
||||||
type: 'RICH_TEXT',
|
|
||||||
label: 'Body (deprecated)',
|
|
||||||
value: 'My rich text',
|
|
||||||
isLeaf: true,
|
|
||||||
},
|
|
||||||
title: {
|
title: {
|
||||||
icon: 'IconNotes',
|
icon: 'IconNotes',
|
||||||
type: 'TEXT',
|
type: 'TEXT',
|
||||||
@ -4436,7 +4428,6 @@ export const oneSucceededWorkflowRunQueryResult = {
|
|||||||
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
|
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
|
||||||
result: {
|
result: {
|
||||||
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
|
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
|
||||||
body: null,
|
|
||||||
title: 'Proposal for ',
|
title: 'Proposal for ',
|
||||||
bodyV2: {
|
bodyV2: {
|
||||||
markdown: '',
|
markdown: '',
|
||||||
@ -4573,13 +4564,6 @@ export const oneSucceededWorkflowRunQueryResult = {
|
|||||||
value: '123e4567-e89b-12d3-a456-426614174000',
|
value: '123e4567-e89b-12d3-a456-426614174000',
|
||||||
isLeaf: true,
|
isLeaf: true,
|
||||||
},
|
},
|
||||||
body: {
|
|
||||||
icon: 'IconFilePencil',
|
|
||||||
type: 'RICH_TEXT',
|
|
||||||
label: 'Body (deprecated)',
|
|
||||||
value: 'My rich text',
|
|
||||||
isLeaf: true,
|
|
||||||
},
|
|
||||||
title: {
|
title: {
|
||||||
icon: 'IconNotes',
|
icon: 'IconNotes',
|
||||||
type: 'TEXT',
|
type: 'TEXT',
|
||||||
@ -8889,7 +8873,6 @@ export const oneSucceededWorkflowRunQueryResult = {
|
|||||||
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
|
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
|
||||||
result: {
|
result: {
|
||||||
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
|
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
|
||||||
body: null,
|
|
||||||
title: 'Proposal for ',
|
title: 'Proposal for ',
|
||||||
bodyV2: {
|
bodyV2: {
|
||||||
markdown: '',
|
markdown: '',
|
||||||
@ -9056,13 +9039,6 @@ export const oneSucceededWorkflowRunQueryResult = {
|
|||||||
value: '123e4567-e89b-12d3-a456-426614174000',
|
value: '123e4567-e89b-12d3-a456-426614174000',
|
||||||
isLeaf: true,
|
isLeaf: true,
|
||||||
},
|
},
|
||||||
body: {
|
|
||||||
icon: 'IconFilePencil',
|
|
||||||
type: 'RICH_TEXT',
|
|
||||||
label: 'Body (deprecated)',
|
|
||||||
value: 'My rich text',
|
|
||||||
isLeaf: true,
|
|
||||||
},
|
|
||||||
title: {
|
title: {
|
||||||
icon: 'IconNotes',
|
icon: 'IconNotes',
|
||||||
type: 'TEXT',
|
type: 'TEXT',
|
||||||
|
|||||||
@ -13,7 +13,6 @@ const baseNote = {
|
|||||||
},
|
},
|
||||||
position: 1,
|
position: 1,
|
||||||
title: 'Test',
|
title: 'Test',
|
||||||
body: 'Test',
|
|
||||||
createdBy: {
|
createdBy: {
|
||||||
name: 'Test',
|
name: 'Test',
|
||||||
source: FieldActorSource.MANUAL,
|
source: FieldActorSource.MANUAL,
|
||||||
|
|||||||
@ -41,6 +41,7 @@ import { TransientTokenService } from 'src/engine/core-modules/auth/token/servic
|
|||||||
import { WorkspaceAgnosticTokenService } from 'src/engine/core-modules/auth/token/services/workspace-agnostic-token.service';
|
import { WorkspaceAgnosticTokenService } from 'src/engine/core-modules/auth/token/services/workspace-agnostic-token.service';
|
||||||
import { JwtTokenTypeEnum } from 'src/engine/core-modules/auth/types/auth-context.type';
|
import { JwtTokenTypeEnum } from 'src/engine/core-modules/auth/types/auth-context.type';
|
||||||
import { CaptchaGuard } from 'src/engine/core-modules/captcha/captcha.guard';
|
import { CaptchaGuard } from 'src/engine/core-modules/captcha/captcha.guard';
|
||||||
|
import { CaptchaGraphqlApiExceptionFilter } from 'src/engine/core-modules/captcha/filters/captcha-graphql-api-exception.filter';
|
||||||
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/services/domain-manager.service';
|
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/services/domain-manager.service';
|
||||||
import { EmailVerificationExceptionFilter } from 'src/engine/core-modules/email-verification/email-verification-exception-filter.util';
|
import { EmailVerificationExceptionFilter } from 'src/engine/core-modules/email-verification/email-verification-exception-filter.util';
|
||||||
import { EmailVerificationService } from 'src/engine/core-modules/email-verification/services/email-verification.service';
|
import { EmailVerificationService } from 'src/engine/core-modules/email-verification/services/email-verification.service';
|
||||||
@ -78,6 +79,7 @@ import { AuthService } from './services/auth.service';
|
|||||||
@UsePipes(ResolverValidationPipe)
|
@UsePipes(ResolverValidationPipe)
|
||||||
@Resolver()
|
@Resolver()
|
||||||
@UseFilters(
|
@UseFilters(
|
||||||
|
CaptchaGraphqlApiExceptionFilter,
|
||||||
AuthGraphqlApiExceptionFilter,
|
AuthGraphqlApiExceptionFilter,
|
||||||
PermissionsGraphqlApiExceptionFilter,
|
PermissionsGraphqlApiExceptionFilter,
|
||||||
EmailVerificationExceptionFilter,
|
EmailVerificationExceptionFilter,
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
import { CustomException } from 'src/utils/custom-exception';
|
||||||
|
|
||||||
|
export class CaptchaException extends CustomException {
|
||||||
|
declare code: CaptchaExceptionCode;
|
||||||
|
constructor(
|
||||||
|
message: string,
|
||||||
|
code: CaptchaExceptionCode,
|
||||||
|
{ userFriendlyMessage }: { userFriendlyMessage?: string } = {},
|
||||||
|
) {
|
||||||
|
super(message, code, userFriendlyMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum CaptchaExceptionCode {
|
||||||
|
INVALID_CAPTCHA = 'INVALID_CAPTCHA',
|
||||||
|
}
|
||||||
@ -1,11 +1,12 @@
|
|||||||
import {
|
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
|
||||||
BadRequestException,
|
|
||||||
CanActivate,
|
|
||||||
ExecutionContext,
|
|
||||||
Injectable,
|
|
||||||
} from '@nestjs/common';
|
|
||||||
import { GqlExecutionContext } from '@nestjs/graphql';
|
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||||
|
|
||||||
|
import { t } from '@lingui/core/macro';
|
||||||
|
|
||||||
|
import {
|
||||||
|
CaptchaException,
|
||||||
|
CaptchaExceptionCode,
|
||||||
|
} from 'src/engine/core-modules/captcha/captcha.exception';
|
||||||
import { CaptchaService } from 'src/engine/core-modules/captcha/captcha.service';
|
import { CaptchaService } from 'src/engine/core-modules/captcha/captcha.service';
|
||||||
import { MetricsService } from 'src/engine/core-modules/metrics/metrics.service';
|
import { MetricsService } from 'src/engine/core-modules/metrics/metrics.service';
|
||||||
import { MetricsKeys } from 'src/engine/core-modules/metrics/types/metrics-keys.type';
|
import { MetricsKeys } from 'src/engine/core-modules/metrics/types/metrics-keys.type';
|
||||||
@ -33,8 +34,10 @@ export class CaptchaGuard implements CanActivate {
|
|||||||
...(result.error ? { attributes: { error: result.error } } : {}),
|
...(result.error ? { attributes: { error: result.error } } : {}),
|
||||||
});
|
});
|
||||||
|
|
||||||
throw new BadRequestException(
|
throw new CaptchaException(
|
||||||
'Invalid Captcha, please try another device',
|
'Invalid Captcha, please try another device',
|
||||||
|
CaptchaExceptionCode.INVALID_CAPTCHA,
|
||||||
|
{ userFriendlyMessage: t`Invalid Captcha, please try another device` },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
import { Catch, ExceptionFilter } from '@nestjs/common';
|
||||||
|
|
||||||
|
import { CaptchaException } from 'src/engine/core-modules/captcha/captcha.exception';
|
||||||
|
import { captchaGraphqlApiExceptionHandler } from 'src/engine/core-modules/captcha/utils/captcha-graphql-api-exception-handler.util';
|
||||||
|
|
||||||
|
@Catch(CaptchaException)
|
||||||
|
export class CaptchaGraphqlApiExceptionFilter implements ExceptionFilter {
|
||||||
|
catch(exception: CaptchaException) {
|
||||||
|
return captchaGraphqlApiExceptionHandler(exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
import {
|
||||||
|
CaptchaException,
|
||||||
|
CaptchaExceptionCode,
|
||||||
|
} from 'src/engine/core-modules/captcha/captcha.exception';
|
||||||
|
import { UserInputError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
|
||||||
|
|
||||||
|
export const captchaGraphqlApiExceptionHandler = (
|
||||||
|
exception: CaptchaException,
|
||||||
|
) => {
|
||||||
|
switch (exception.code) {
|
||||||
|
case CaptchaExceptionCode.INVALID_CAPTCHA:
|
||||||
|
throw new UserInputError(exception);
|
||||||
|
|
||||||
|
default: {
|
||||||
|
const _exhaustiveCheck: never = exception.code;
|
||||||
|
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -4,9 +4,8 @@ type NoteDataSeed = {
|
|||||||
id: string;
|
id: string;
|
||||||
position: number;
|
position: number;
|
||||||
title: string;
|
title: string;
|
||||||
body: string | null;
|
bodyV2Blocknote: string
|
||||||
bodyV2Blocknote: string | null;
|
bodyV2Markdown: string;
|
||||||
bodyV2Markdown: string | null;
|
|
||||||
createdBySource: string;
|
createdBySource: string;
|
||||||
createdByWorkspaceMemberId: string;
|
createdByWorkspaceMemberId: string;
|
||||||
createdByName: string;
|
createdByName: string;
|
||||||
@ -17,7 +16,6 @@ export const NOTE_DATA_SEED_COLUMNS: (keyof NoteDataSeed)[] = [
|
|||||||
'id',
|
'id',
|
||||||
'position',
|
'position',
|
||||||
'title',
|
'title',
|
||||||
'body',
|
|
||||||
'bodyV2Blocknote',
|
'bodyV2Blocknote',
|
||||||
'bodyV2Markdown',
|
'bodyV2Markdown',
|
||||||
'createdBySource',
|
'createdBySource',
|
||||||
@ -145,7 +143,6 @@ const GENERATE_NOTE_SEEDS = (): NoteDataSeed[] => {
|
|||||||
id: NOTE_DATA_SEED_IDS[`ID_${INDEX}`],
|
id: NOTE_DATA_SEED_IDS[`ID_${INDEX}`],
|
||||||
position: INDEX,
|
position: INDEX,
|
||||||
title: TEMPLATE.title,
|
title: TEMPLATE.title,
|
||||||
body: null,
|
|
||||||
bodyV2Blocknote: JSON.stringify([
|
bodyV2Blocknote: JSON.stringify([
|
||||||
{
|
{
|
||||||
id: `block-${INDEX}`,
|
id: `block-${INDEX}`,
|
||||||
@ -176,7 +173,6 @@ const GENERATE_NOTE_SEEDS = (): NoteDataSeed[] => {
|
|||||||
id: NOTE_DATA_SEED_IDS[`ID_${INDEX}`],
|
id: NOTE_DATA_SEED_IDS[`ID_${INDEX}`],
|
||||||
position: INDEX,
|
position: INDEX,
|
||||||
title: TEMPLATE.title,
|
title: TEMPLATE.title,
|
||||||
body: null,
|
|
||||||
bodyV2Blocknote: JSON.stringify([
|
bodyV2Blocknote: JSON.stringify([
|
||||||
{
|
{
|
||||||
id: `block-${INDEX}`,
|
id: `block-${INDEX}`,
|
||||||
|
|||||||
@ -4,7 +4,8 @@ type TaskDataSeed = {
|
|||||||
id: string;
|
id: string;
|
||||||
position: number;
|
position: number;
|
||||||
title: string;
|
title: string;
|
||||||
body: string | null;
|
bodyV2Blocknote: string;
|
||||||
|
bodyV2Markdown: string;
|
||||||
status: string;
|
status: string;
|
||||||
dueAt: string | null;
|
dueAt: string | null;
|
||||||
assigneeId: string;
|
assigneeId: string;
|
||||||
@ -17,7 +18,8 @@ export const TASK_DATA_SEED_COLUMNS: (keyof TaskDataSeed)[] = [
|
|||||||
'id',
|
'id',
|
||||||
'position',
|
'position',
|
||||||
'title',
|
'title',
|
||||||
'body',
|
'bodyV2Blocknote',
|
||||||
|
'bodyV2Markdown',
|
||||||
'status',
|
'status',
|
||||||
'dueAt',
|
'dueAt',
|
||||||
'assigneeId',
|
'assigneeId',
|
||||||
@ -188,7 +190,20 @@ const GENERATE_TASK_SEEDS = (): TaskDataSeed[] => {
|
|||||||
id: TASK_DATA_SEED_IDS[`ID_${INDEX}`],
|
id: TASK_DATA_SEED_IDS[`ID_${INDEX}`],
|
||||||
position: INDEX,
|
position: INDEX,
|
||||||
title: TEMPLATE.title,
|
title: TEMPLATE.title,
|
||||||
body: TEMPLATE.body,
|
bodyV2Blocknote: JSON.stringify([
|
||||||
|
{
|
||||||
|
id: `block-${INDEX}`,
|
||||||
|
type: 'paragraph',
|
||||||
|
props: {
|
||||||
|
textColor: 'default',
|
||||||
|
backgroundColor: 'default',
|
||||||
|
textAlignment: 'left',
|
||||||
|
},
|
||||||
|
content: [{ type: 'text', text: TEMPLATE.body, styles: {} }],
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
bodyV2Markdown: TEMPLATE.body,
|
||||||
status: TEMPLATE.status,
|
status: TEMPLATE.status,
|
||||||
dueAt: FORMAT_DUE_DATE(TEMPLATE.daysFromNow),
|
dueAt: FORMAT_DUE_DATE(TEMPLATE.daysFromNow),
|
||||||
assigneeId: GET_RANDOM_ASSIGNEE(),
|
assigneeId: GET_RANDOM_ASSIGNEE(),
|
||||||
@ -207,7 +222,20 @@ const GENERATE_TASK_SEEDS = (): TaskDataSeed[] => {
|
|||||||
id: TASK_DATA_SEED_IDS[`ID_${INDEX}`],
|
id: TASK_DATA_SEED_IDS[`ID_${INDEX}`],
|
||||||
position: INDEX,
|
position: INDEX,
|
||||||
title: TEMPLATE.title,
|
title: TEMPLATE.title,
|
||||||
body: TEMPLATE.body,
|
bodyV2Blocknote: JSON.stringify([
|
||||||
|
{
|
||||||
|
id: `block-${INDEX}`,
|
||||||
|
type: 'paragraph',
|
||||||
|
props: {
|
||||||
|
textColor: 'default',
|
||||||
|
backgroundColor: 'default',
|
||||||
|
textAlignment: 'left',
|
||||||
|
},
|
||||||
|
content: [{ type: 'text', text: TEMPLATE.body, styles: {} }],
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
bodyV2Markdown: TEMPLATE.body,
|
||||||
status: TEMPLATE.status,
|
status: TEMPLATE.status,
|
||||||
dueAt: FORMAT_DUE_DATE(TEMPLATE.daysFromNow),
|
dueAt: FORMAT_DUE_DATE(TEMPLATE.daysFromNow),
|
||||||
assigneeId: GET_RANDOM_ASSIGNEE(),
|
assigneeId: GET_RANDOM_ASSIGNEE(),
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export const tasksAssignedToMeView = (
|
|||||||
{
|
{
|
||||||
fieldMetadataId:
|
fieldMetadataId:
|
||||||
taskObjectMetadata.fields.find(
|
taskObjectMetadata.fields.find(
|
||||||
(field) => field.standardId === TASK_STANDARD_FIELD_IDS.body,
|
(field) => field.standardId === TASK_STANDARD_FIELD_IDS.bodyV2,
|
||||||
)?.id ?? '',
|
)?.id ?? '',
|
||||||
position: 7,
|
position: 7,
|
||||||
isVisible: true,
|
isVisible: true,
|
||||||
|
|||||||
@ -69,16 +69,6 @@ export class NoteWorkspaceEntity extends BaseWorkspaceEntity {
|
|||||||
})
|
})
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: NOTE_STANDARD_FIELD_IDS.body,
|
|
||||||
type: FieldMetadataType.RICH_TEXT,
|
|
||||||
label: msg`Body (deprecated)`,
|
|
||||||
description: msg`Note body`,
|
|
||||||
icon: 'IconFilePencil',
|
|
||||||
})
|
|
||||||
@WorkspaceIsNullable()
|
|
||||||
body: string | null;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
@WorkspaceField({
|
||||||
standardId: NOTE_STANDARD_FIELD_IDS.bodyV2,
|
standardId: NOTE_STANDARD_FIELD_IDS.bodyV2,
|
||||||
type: FieldMetadataType.RICH_TEXT_V2,
|
type: FieldMetadataType.RICH_TEXT_V2,
|
||||||
|
|||||||
@ -72,16 +72,6 @@ export class TaskWorkspaceEntity extends BaseWorkspaceEntity {
|
|||||||
})
|
})
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: TASK_STANDARD_FIELD_IDS.body,
|
|
||||||
type: FieldMetadataType.RICH_TEXT,
|
|
||||||
label: msg`Body (deprecated)`,
|
|
||||||
description: msg`Task body`,
|
|
||||||
icon: 'IconFilePencil',
|
|
||||||
})
|
|
||||||
@WorkspaceIsNullable()
|
|
||||||
body: string | null;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
@WorkspaceField({
|
||||||
standardId: TASK_STANDARD_FIELD_IDS.bodyV2,
|
standardId: TASK_STANDARD_FIELD_IDS.bodyV2,
|
||||||
type: FieldMetadataType.RICH_TEXT_V2,
|
type: FieldMetadataType.RICH_TEXT_V2,
|
||||||
|
|||||||
@ -12,7 +12,10 @@ describe('notesResolver (e2e)', () => {
|
|||||||
node {
|
node {
|
||||||
position
|
position
|
||||||
title
|
title
|
||||||
body
|
bodyV2 {
|
||||||
|
markdown
|
||||||
|
blocknote
|
||||||
|
}
|
||||||
id
|
id
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
@ -46,7 +49,7 @@ describe('notesResolver (e2e)', () => {
|
|||||||
|
|
||||||
expect(notes).toHaveProperty('position');
|
expect(notes).toHaveProperty('position');
|
||||||
expect(notes).toHaveProperty('title');
|
expect(notes).toHaveProperty('title');
|
||||||
expect(notes).toHaveProperty('body');
|
expect(notes).toHaveProperty('bodyV2');
|
||||||
expect(notes).toHaveProperty('id');
|
expect(notes).toHaveProperty('id');
|
||||||
expect(notes).toHaveProperty('createdAt');
|
expect(notes).toHaveProperty('createdAt');
|
||||||
expect(notes).toHaveProperty('updatedAt');
|
expect(notes).toHaveProperty('updatedAt');
|
||||||
|
|||||||
@ -12,7 +12,10 @@ describe('tasksResolver (e2e)', () => {
|
|||||||
node {
|
node {
|
||||||
position
|
position
|
||||||
title
|
title
|
||||||
body
|
bodyV2 {
|
||||||
|
markdown
|
||||||
|
blocknote
|
||||||
|
}
|
||||||
dueAt
|
dueAt
|
||||||
status
|
status
|
||||||
id
|
id
|
||||||
@ -49,7 +52,7 @@ describe('tasksResolver (e2e)', () => {
|
|||||||
|
|
||||||
expect(tasks).toHaveProperty('position');
|
expect(tasks).toHaveProperty('position');
|
||||||
expect(tasks).toHaveProperty('title');
|
expect(tasks).toHaveProperty('title');
|
||||||
expect(tasks).toHaveProperty('body');
|
expect(tasks).toHaveProperty('bodyV2');
|
||||||
expect(tasks).toHaveProperty('dueAt');
|
expect(tasks).toHaveProperty('dueAt');
|
||||||
expect(tasks).toHaveProperty('status');
|
expect(tasks).toHaveProperty('status');
|
||||||
expect(tasks).toHaveProperty('id');
|
expect(tasks).toHaveProperty('id');
|
||||||
|
|||||||
Reference in New Issue
Block a user