Enforce front project structure through ESLINT (#7863)

Fixes: https://github.com/twentyhq/twenty/issues/7329
This commit is contained in:
Charles Bochet
2024-10-20 20:20:19 +02:00
committed by GitHub
parent f801f3aa9f
commit eccf0bf8ba
260 changed files with 500 additions and 290 deletions

View File

@ -0,0 +1,16 @@
import { gql } from '@apollo/client';
import { getTimelineThreadsFromCompanyId } from '../getTimelineThreadsFromCompanyId';
jest.mock('@apollo/client', () => ({
gql: jest.fn().mockImplementation((strings) => {
return strings.map((str: string) => str.trim()).join(' ');
}),
}));
describe('getTimelineThreadsFromCompanyId query', () => {
test('should construct the query correctly', () => {
expect(gql).toHaveBeenCalled();
expect(getTimelineThreadsFromCompanyId).toBeDefined();
});
});

View File

@ -0,0 +1,16 @@
import { gql } from '@apollo/client';
import { getTimelineThreadsFromPersonId } from '../getTimelineThreadsFromPersonId';
jest.mock('@apollo/client', () => ({
gql: jest.fn().mockImplementation((strings) => {
return strings.map((str: string) => str.trim()).join(' ');
}),
}));
describe('getTimelineThreadsFromPersonId query', () => {
test('should construct the query correctly', () => {
expect(gql).toHaveBeenCalled();
expect(getTimelineThreadsFromPersonId).toBeDefined();
});
});

View File

@ -0,0 +1,13 @@
import { gql } from '@apollo/client';
export const participantFragment = gql`
fragment ParticipantFragment on TimelineThreadParticipant {
personId
workspaceMemberId
firstName
lastName
displayName
avatarUrl
handle
}
`;

View File

@ -0,0 +1,23 @@
import { gql } from '@apollo/client';
import { participantFragment } from '@/activities/emails/graphql/queries/fragments/participantFragment';
export const timelineThreadFragment = gql`
fragment TimelineThreadFragment on TimelineThread {
id
read
visibility
firstParticipant {
...ParticipantFragment
}
lastTwoParticipants {
...ParticipantFragment
}
lastMessageReceivedAt
lastMessageBody
subject
numberOfMessagesInThread
participantCount
}
${participantFragment}
`;

View File

@ -0,0 +1,12 @@
import { timelineThreadFragment } from '@/activities/emails/graphql/queries/fragments/timelineThreadFragment';
import { gql } from '@apollo/client';
export const timelineThreadWithTotalFragment = gql`
fragment TimelineThreadsWithTotalFragment on TimelineThreadsWithTotal {
totalNumberOfThreads
timelineThreads {
...TimelineThreadFragment
}
}
${timelineThreadFragment}
`;

View File

@ -0,0 +1,19 @@
import { timelineThreadWithTotalFragment } from '@/activities/emails/graphql/queries/fragments/timelineThreadWithTotalFragment';
import { gql } from '@apollo/client';
export const getTimelineThreadsFromCompanyId = gql`
query GetTimelineThreadsFromCompanyId(
$companyId: UUID!
$page: Int!
$pageSize: Int!
) {
getTimelineThreadsFromCompanyId(
companyId: $companyId
page: $page
pageSize: $pageSize
) {
...TimelineThreadsWithTotalFragment
}
}
${timelineThreadWithTotalFragment}
`;

View File

@ -0,0 +1,20 @@
import { gql } from '@apollo/client';
import { timelineThreadWithTotalFragment } from '@/activities/emails/graphql/queries/fragments/timelineThreadWithTotalFragment';
export const getTimelineThreadsFromPersonId = gql`
query GetTimelineThreadsFromPersonId(
$personId: UUID!
$page: Int!
$pageSize: Int!
) {
getTimelineThreadsFromPersonId(
personId: $personId
page: $page
pageSize: $pageSize
) {
...TimelineThreadsWithTotalFragment
}
}
${timelineThreadWithTotalFragment}
`;