Removing Prisma and Grapql-nestjs-prisma resolvers (#2574)

* Some cleaning

* Fix seeds

* Fix all sign in, sign up flow and apiKey optimistic rendering

* Fix
This commit is contained in:
Charles Bochet
2023-11-19 18:25:47 +01:00
committed by GitHub
parent 18dac1a2b6
commit f5e1d7825a
616 changed files with 2220 additions and 23073 deletions

View File

@ -3,143 +3,19 @@ import { graphql } from 'msw';
import { CREATE_EVENT } from '@/analytics/graphql/queries/createEvent';
import { GET_CLIENT_CONFIG } from '@/client-config/graphql/queries/getClientConfig';
import { INSERT_ONE_COMPANY } from '@/companies/graphql/mutations/insertOneCompany';
import { GET_COMPANIES } from '@/companies/graphql/queries/getCompanies';
import { FIND_MANY_METADATA_OBJECTS } from '@/object-metadata/graphql/queries';
import { INSERT_ONE_PERSON } from '@/people/graphql/mutations/insertOnePerson';
import { UPDATE_ONE_PERSON } from '@/people/graphql/mutations/updateOnePerson';
import { GET_PEOPLE } from '@/people/graphql/queries/getPeople';
import { GET_PERSON } from '@/people/graphql/queries/getPerson';
import { SEARCH_ACTIVITY_QUERY } from '@/search/graphql/queries/searchActivityQuery';
import { SEARCH_COMPANY_QUERY } from '@/search/graphql/queries/searchCompanyQuery';
import { SEARCH_PEOPLE_QUERY } from '@/search/graphql/queries/searchPeopleQuery';
import { SEARCH_USER_QUERY } from '@/search/graphql/queries/searchUserQuery';
import { GET_API_KEY } from '@/settings/developers/graphql/queries/getApiKey';
import { GET_API_KEYS } from '@/settings/developers/graphql/queries/getApiKeys';
import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';
import {
GetCompaniesQuery,
GetPeopleQuery,
GetPersonQuery,
SearchActivityQuery,
SearchCompanyQuery,
SearchPeopleQuery,
SearchUserQuery,
} from '~/generated/graphql';
import { mockedApiKeys } from '~/testing/mock-data/api-keys';
import { mockedActivities } from './mock-data/activities';
import {
mockedCompaniesData,
mockedEmptyCompanyData,
} from './mock-data/companies';
import { mockedObjectMetadataItems } from './mock-data/metadata';
import { mockedEmptyPersonData, mockedPeopleData } from './mock-data/people';
import { mockedUsersData } from './mock-data/users';
import { mockedViewFieldsData } from './mock-data/view-fields';
import { mockedViewsData } from './mock-data/views';
import {
fetchOneFromData,
filterAndSortData,
updateOneFromData,
} from './mock-data';
import { createEvent } from '@storybook/testing-library';
const metadataGraphql = graphql.link(
`${process.env.REACT_APP_SERVER_BASE_URL}/metadata`,
);
export const graphqlMocks = [
graphql.query(getOperationName(GET_COMPANIES) ?? '', (req, res, ctx) => {
const returnedMockedData = filterAndSortData<
GetCompaniesQuery['companies'][0]
>(
mockedCompaniesData,
req.variables.where,
req.variables.orderBy,
req.variables.limit,
);
return res(
ctx.data({
companies: returnedMockedData,
}),
);
}),
graphql.query(
getOperationName(SEARCH_COMPANY_QUERY) ?? '',
(req, res, ctx) => {
const returnedMockedData = filterAndSortData<
SearchCompanyQuery['searchResults'][0]
>(
mockedCompaniesData,
req.variables.where,
!req.variables.orderBy || Array.isArray(req.variables.orderBy)
? req.variables.orderBy
: [req.variables.orderBy],
req.variables.limit,
);
return res(
ctx.data({
searchResults: returnedMockedData,
}),
);
},
),
graphql.query(
getOperationName(SEARCH_PEOPLE_QUERY) ?? '',
(req, res, ctx) => {
const returnedMockedData = filterAndSortData<
SearchPeopleQuery['searchResults'][0]
>(
mockedPeopleData,
req.variables.where,
!req.variables.orderBy || Array.isArray(req.variables.orderBy)
? req.variables.orderBy
: [req.variables.orderBy],
req.variables.limit,
);
return res(
ctx.data({
searchResults: returnedMockedData,
}),
);
},
),
graphql.query(getOperationName(SEARCH_USER_QUERY) ?? '', (req, res, ctx) => {
const returnedMockedData = filterAndSortData<
SearchUserQuery['searchResults'][0]
>(
mockedUsersData,
req.variables.where,
req.variables.orderBy,
req.variables.limit,
);
return res(
ctx.data({
searchResults: returnedMockedData,
}),
);
}),
graphql.query(
getOperationName(SEARCH_ACTIVITY_QUERY) ?? '',
(req, res, ctx) => {
const returnedMockedData = filterAndSortData<
SearchActivityQuery['searchResults'][0]
>(
mockedActivities,
req.variables.where,
!req.variables.orderBy || Array.isArray(req.variables.orderBy)
? req.variables.orderBy
: [req.variables.orderBy],
req.variables.limit,
);
return res(
ctx.data({
searchResults: returnedMockedData,
}),
);
},
),
graphql.query(getOperationName(GET_CURRENT_USER) ?? '', (req, res, ctx) => {
return res(
ctx.data({
@ -147,62 +23,6 @@ export const graphqlMocks = [
}),
);
}),
graphql.query(getOperationName(GET_PERSON) ?? '', (req, res, ctx) => {
const returnedMockedData = fetchOneFromData<
GetPersonQuery['findUniquePerson']
>(mockedPeopleData, req.variables.id);
return res(
ctx.data({
findUniquePerson: returnedMockedData,
}),
);
}),
graphql.query(getOperationName(GET_PEOPLE) ?? '', (req, res, ctx) => {
const returnedMockedData = filterAndSortData<GetPeopleQuery['people'][0]>(
mockedPeopleData,
req.variables.where,
req.variables.orderBy,
req.variables.limit,
);
return res(
ctx.data({
people: returnedMockedData,
}),
);
}),
graphql.mutation(
getOperationName(UPDATE_ONE_PERSON) ?? '',
(req, res, ctx) => {
const updatedCompanyId = req.variables.data?.company?.connect?.id;
const updatedCompany = mockedCompaniesData.find(
({ id }) => id === updatedCompanyId,
);
const updatedCompanyData = updatedCompany
? {
companyId: updatedCompany.id,
company: {
id: updatedCompany.id,
name: updatedCompany.name,
domainName: updatedCompany.domainName,
__typename: 'Company',
},
}
: {};
return res(
ctx.data({
updateOnePerson: {
...updateOneFromData(
mockedPeopleData,
req.variables.where.id,
req.variables,
),
...updatedCompanyData,
},
}),
);
},
),
graphql.mutation(getOperationName(CREATE_EVENT) ?? '', (req, res, ctx) => {
return res(
ctx.data({
@ -228,55 +48,13 @@ export const graphqlMocks = [
}),
);
}),
graphql.query(getOperationName(GET_API_KEY) ?? '', (req, res, ctx) => {
return res(
ctx.data({
findManyApiKey: [mockedApiKeys[0]],
}),
);
}),
graphql.query(getOperationName(GET_API_KEYS) ?? '', (req, res, ctx) => {
return res(
ctx.data({
findManyApiKey: mockedApiKeys,
}),
);
}),
graphql.mutation(
getOperationName(INSERT_ONE_COMPANY) ?? '',
(req, res, ctx) => {
return res(
ctx.data({
createOneCompany: {
...mockedEmptyCompanyData,
...req.variables.data,
},
}),
);
},
),
graphql.mutation(
getOperationName(INSERT_ONE_PERSON) ?? '',
(req, res, ctx) => {
return res(
ctx.data({
createOnePerson: {
...mockedEmptyPersonData,
...req.variables.data,
},
}),
);
},
),
metadataGraphql.query(
getOperationName(FIND_MANY_METADATA_OBJECTS) ?? '',
(req, res, ctx) => {
return res(ctx.data({ objects: mockedObjectMetadataItems }));
},
),
graphql.query('FindManyViewsV2', (req, res, ctx) => {
graphql.query('FindManyViews', (req, res, ctx) => {
const objectMetadataId = req.variables.filter.objectMetadataId.eq;
const viewType = req.variables.filter.type.eq;
@ -303,7 +81,7 @@ export const graphqlMocks = [
}),
);
}),
graphql.query('FindManyViewFieldsV2', (req, res, ctx) => {
graphql.query('FindManyViewFields', (req, res, ctx) => {
const viewId = req.variables.filter.view.eq;
return res(

View File

@ -1,8 +1,9 @@
import { Activity } from '@/activities/types/Activity';
import { ActivityTarget } from '@/activities/types/ActivityTarget';
import { Comment } from '@/activities/types/Comment';
import { Company } from '@/companies/types/Company';
import { Person } from '@/people/types/Person';
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
import { Company, Person } from '~/generated/graphql';
type MockedActivity = Pick<
Activity,
@ -32,7 +33,7 @@ type MockedActivity = Pick<
| 'companyId'
> & {
activity: Pick<Activity, 'id' | 'createdAt' | 'updatedAt'>;
person?: Pick<Person, 'id' | 'displayName' | 'avatarUrl'> | null;
person?: Pick<Person, 'id' | 'name' | 'avatarUrl'> | null;
company?: Pick<Company, 'id' | 'name' | 'domainName'> | null;
}
>;
@ -178,7 +179,10 @@ export const mockedActivities: Array<MockedActivity> = [
personId: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b', // Alexandre
person: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
displayName: 'Alexandre Test',
name: {
firstName: 'Alexandre',
lastName: 'Test',
},
avatarUrl: '',
},
company: null,
@ -200,7 +204,10 @@ export const mockedActivities: Array<MockedActivity> = [
company: null,
person: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
displayName: "Jean d'Eau",
name: {
firstName: 'Jean',
lastName: "d'Eau",
},
avatarUrl: '',
},
activityId: '89bb825c-171e-4bcc-9cf7-43448d6fb278a',

View File

@ -1,8 +1,8 @@
import { ApiKey } from '~/generated/graphql';
import { ApiKey } from '@/settings/developers/types/ApiKey';
type MockedApiKey = Pick<
ApiKey,
'id' | 'name' | 'createdAt' | 'updatedAt' | 'expiresAt' | '__typename'
'id' | 'name' | 'createdAt' | 'updatedAt' | 'expiresAt'
>;
export const mockedApiKeys: Array<MockedApiKey> = [
{
@ -11,15 +11,13 @@ export const mockedApiKeys: Array<MockedApiKey> = [
createdAt: '2023-04-26T10:12:42.33625+00:00',
updatedAt: '2023-04-26T10:23:42.33625+00:00',
expiresAt: '2100-11-06T23:59:59.825Z',
__typename: 'ApiKey',
},
{
id: 'f7c6d736-8fcd-4e9c-ab99-28f6a9031571',
name: 'Gmail Integration',
createdAt: '2023-04-26T10:12:42.33625+00:00',
updatedAt: '2023-04-26T10:23:42.33625+00:00',
expiresAt: null,
__typename: 'ApiKey',
expiresAt: '2100-11-06T23:59:59.825Z',
},
{
id: 'f7c6d736-8fcd-4e9c-ab99-28f6a9031572',
@ -27,6 +25,5 @@ export const mockedApiKeys: Array<MockedApiKey> = [
createdAt: '2023-04-26T10:12:42.33625+00:00',
updatedAt: '2023-04-26T10:23:42.33625+00:00',
expiresAt: '2022-11-06T23:59:59.825Z',
__typename: 'ApiKey',
},
];

View File

@ -1,4 +1,6 @@
import { Company, Favorite, User } from '~/generated/graphql';
import { Company } from '@/companies/types/Company';
import { Favorite } from '@/favorites/types/Favorite';
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
import { mockedUsersData } from './users';
@ -7,7 +9,6 @@ type MockedCompany = Pick<
| 'id'
| 'name'
| 'domainName'
| '__typename'
| 'createdAt'
| 'address'
| 'employees'
@ -15,19 +16,9 @@ type MockedCompany = Pick<
| 'xUrl'
| 'annualRecurringRevenue'
| 'idealCustomerProfile'
| '_activityCount'
| 'accountOwnerId'
> & {
accountOwner: Pick<
User,
| 'id'
| 'email'
| 'displayName'
| 'avatarUrl'
| '__typename'
| 'firstName'
| 'lastName'
> | null;
accountOwner: Pick<WorkspaceMember, 'id' | 'avatarUrl' | 'name'> | null;
Favorite: Pick<Favorite, 'id'> | null;
};
@ -39,23 +30,26 @@ export const mockedCompaniesData: Array<MockedCompany> = [
createdAt: '2023-04-26T10:08:54.724515+00:00',
address: '17 rue de clignancourt',
employees: 12,
linkedinUrl: 'https://www.linkedin.com/company/airbnb/',
xUrl: 'https://twitter.com/airbnb',
annualRecurringRevenue: 500000,
linkedinUrl: {
url: 'https://www.linkedin.com/company/airbnb/',
label: 'https://www.linkedin.com/company/airbnb/',
},
xUrl: {
url: 'https://twitter.com/airbnb',
label: 'https://twitter.com/airbnb',
},
annualRecurringRevenue: { amountMicros: 5000000, currencyCode: 'USD' },
idealCustomerProfile: true,
_activityCount: 1,
Favorite: null,
accountOwnerId: mockedUsersData[0].id,
accountOwner: {
email: 'charles@test.com',
displayName: 'Charles Test',
firstName: 'Charles',
lastName: 'Test',
name: {
firstName: 'Charles',
lastName: 'Test',
},
avatarUrl: null,
id: mockedUsersData[0].id,
__typename: 'User',
},
__typename: 'Company',
},
{
id: 'b396e6b9-dc5c-4643-bcff-61b6cf7523ae',
@ -64,14 +58,19 @@ export const mockedCompaniesData: Array<MockedCompany> = [
createdAt: '2023-04-26T10:12:42.33625+00:00',
address: '',
employees: 1,
linkedinUrl: 'https://www.linkedin.com/company/aircall/',
xUrl: 'https://twitter.com/aircall',
annualRecurringRevenue: 50000,
accountOwnerId: null,
linkedinUrl: {
url: 'https://www.linkedin.com/company/aircall/',
label: 'https://www.linkedin.com/company/aircall/',
},
xUrl: {
url: 'https://twitter.com/aircall',
label: 'https://twitter.com/aircall',
},
annualRecurringRevenue: { amountMicros: 500000, currencyCode: 'USD' },
idealCustomerProfile: false,
_activityCount: 1,
accountOwner: null,
Favorite: null,
__typename: 'Company',
},
{
id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
@ -80,14 +79,19 @@ export const mockedCompaniesData: Array<MockedCompany> = [
createdAt: '2023-04-26T10:10:32.530184+00:00',
address: '',
employees: 1,
linkedinUrl: 'https://www.linkedin.com/company/algolia/',
xUrl: 'https://twitter.com/algolia',
annualRecurringRevenue: 500000,
linkedinUrl: {
url: 'https://www.linkedin.com/company/algolia/',
label: 'https://www.linkedin.com/company/algolia/',
},
xUrl: {
url: 'https://twitter.com/algolia',
label: 'https://twitter.com/algolia',
},
annualRecurringRevenue: { amountMicros: 5000000, currencyCode: 'USD' },
idealCustomerProfile: true,
_activityCount: 1,
accountOwner: null,
Favorite: null,
__typename: 'Company',
accountOwnerId: null,
},
{
id: 'b1cfd51b-a831-455f-ba07-4e30671e1dc3',
@ -96,14 +100,19 @@ export const mockedCompaniesData: Array<MockedCompany> = [
createdAt: '2023-03-21T06:30:25.39474+00:00',
address: '',
employees: 10,
linkedinUrl: 'https://www.linkedin.com/company/apple/',
xUrl: 'https://twitter.com/apple',
annualRecurringRevenue: 5000000,
linkedinUrl: {
url: 'https://www.linkedin.com/company/apple/',
label: 'https://www.linkedin.com/company/apple/',
},
xUrl: {
url: 'https://twitter.com/apple',
label: 'https://twitter.com/apple',
},
annualRecurringRevenue: { amountMicros: 1000000, currencyCode: 'USD' },
idealCustomerProfile: false,
_activityCount: 0,
accountOwner: null,
Favorite: null,
__typename: 'Company',
accountOwnerId: null,
},
{
id: '5c21e19e-e049-4393-8c09-3e3f8fb09ecb',
@ -112,14 +121,19 @@ export const mockedCompaniesData: Array<MockedCompany> = [
createdAt: '2023-04-26T10:13:29.712485+00:00',
address: '10 rue de la Paix',
employees: 1,
linkedinUrl: 'https://www.linkedin.com/company/qonto/',
xUrl: 'https://twitter.com/qonto',
annualRecurringRevenue: 500000,
linkedinUrl: {
url: 'https://www.linkedin.com/company/qonto/',
label: 'https://www.linkedin.com/company/qonto/',
},
xUrl: {
url: 'https://twitter.com/qonto',
label: 'https://twitter.com/qonto',
},
annualRecurringRevenue: { amountMicros: 5000000, currencyCode: 'USD' },
idealCustomerProfile: false,
_activityCount: 2,
accountOwner: null,
Favorite: null,
__typename: 'Company',
accountOwnerId: null,
},
{
id: '9d162de6-cfbf-4156-a790-e39854dcd4eb',
@ -128,14 +142,19 @@ export const mockedCompaniesData: Array<MockedCompany> = [
createdAt: '2023-04-26T10:09:25.656555+00:00',
address: '',
employees: 1,
linkedinUrl: 'https://www.linkedin.com/company/facebook/',
xUrl: 'https://twitter.com/facebook',
annualRecurringRevenue: 5000000,
linkedinUrl: {
url: 'https://www.linkedin.com/company/facebook/',
label: 'https://www.linkedin.com/company/facebook/',
},
xUrl: {
url: 'https://twitter.com/facebook',
label: 'https://twitter.com/facebook',
},
annualRecurringRevenue: { amountMicros: 5000000, currencyCode: 'USD' },
idealCustomerProfile: true,
_activityCount: 13,
accountOwner: null,
Favorite: null,
__typename: 'Company',
accountOwnerId: null,
},
{
id: '9d162de6-cfbf-4156-a790-e39854dcd4ef',
@ -144,14 +163,19 @@ export const mockedCompaniesData: Array<MockedCompany> = [
createdAt: '2023-04-26T10:09:25.656555+00:00',
address: '',
employees: 1,
linkedinUrl: 'https://www.linkedin.com/company/sequoia/',
xUrl: 'https://twitter.com/sequoia',
annualRecurringRevenue: 500000,
linkedinUrl: {
url: 'https://www.linkedin.com/company/sequoia/',
label: 'https://www.linkedin.com/company/sequoia/',
},
xUrl: {
url: 'https://twitter.com/sequoia',
label: 'https://twitter.com/sequoia',
},
annualRecurringRevenue: { amountMicros: 5000000, currencyCode: 'USD' },
idealCustomerProfile: true,
_activityCount: 1,
accountOwner: null,
Favorite: null,
__typename: 'Company',
accountOwnerId: null,
},
];

View File

@ -1,15 +1,15 @@
import { isObject, isString } from '@sniptt/guards';
import { GraphQLVariables } from 'msw';
import {
CompanyOrderByWithRelationInput,
PersonOrderByWithRelationInput,
StringFilter,
UserOrderByWithRelationInput,
} from '~/generated/graphql';
import { isDefined } from '../../utils/isDefined';
type StringFilter = {
equals?: string;
contains?: string;
in?: Array<string>;
notIn?: Array<string>;
};
const filterData = <DataT>(
data: Array<DataT>,
where: Record<string, any>,
@ -90,11 +90,7 @@ const filterData = <DataT>(
export const filterAndSortData = <DataT>(
data: Array<DataT>,
where?: Record<string, any>,
orderBy?: Array<
PersonOrderByWithRelationInput &
CompanyOrderByWithRelationInput &
UserOrderByWithRelationInput
>,
orderBy?: Array<any>,
limit?: number,
): Array<DataT> => {
let filteredData = data;

View File

@ -188,8 +188,8 @@ export const mockedObjectMetadataItems = {
node: {
id: 'b25eb5e6-9fdc-4df2-a039-40ccea4c8032',
dataSourceId: '',
nameSingular: 'viewV2',
namePlural: 'viewsV2',
nameSingular: 'view',
namePlural: 'views',
labelSingular: 'View',
labelPlural: 'Views',
description: '(System) Views',
@ -269,8 +269,8 @@ export const mockedObjectMetadataItems = {
node: {
id: 'c419540f-ff6e-47bf-9d87-3aa366afd8e4',
dataSourceId: '',
nameSingular: 'viewFieldV2',
namePlural: 'viewFieldsV2',
nameSingular: 'viewField',
namePlural: 'viewFields',
labelSingular: 'View Field',
labelPlural: 'View Fields',
description: '(System) View Fields',

View File

@ -1,4 +1,5 @@
import { Company, Person } from '~/generated/graphql';
import { Company } from '@/companies/types/Company';
import { Person } from '@/people/types/Person';
type RequiredAndNotNull<T> = {
[P in keyof T]-?: Exclude<T[P], null | undefined>;
@ -8,35 +9,37 @@ type MockedPerson = RequiredAndNotNull<
Pick<
Person,
| 'id'
| 'firstName'
| 'lastName'
| 'displayName'
| 'linkedinUrl'
| 'xUrl'
| 'name'
| 'linkedinLink'
| 'xLink'
| 'jobTitle'
| 'email'
| '__typename'
| 'phone'
| 'city'
| 'avatarUrl'
| '_activityCount'
| 'createdAt'
| 'companyId'
> & {
company: Pick<Company, 'id' | 'name' | 'domainName' | '__typename'>;
company: Pick<Company, 'id' | 'name' | 'domainName'>;
}
>;
export const mockedPeopleData: MockedPerson[] = [
{
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
__typename: 'Person',
firstName: 'Alexandre',
lastName: 'Prot',
displayName: 'Alexandre Prot',
name: {
firstName: 'Alexandre',
lastName: 'Prot',
},
email: 'alexandre@qonto.com',
linkedinUrl: 'https://www.linkedin.com/in/alexandreprot/',
xUrl: 'https://twitter.com/alexandreprot',
linkedinLink: {
url: 'https://www.linkedin.com/in/alexandreprot/',
label: 'https://www.linkedin.com/in/alexandreprot/',
},
xLink: {
url: 'https://twitter.com/alexandreprot',
label: 'https://twitter.com/alexandreprot',
},
avatarUrl:
'data:image/jpeg;base64,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',
jobTitle: 'CEO',
@ -45,21 +48,22 @@ export const mockedPeopleData: MockedPerson[] = [
id: '5c21e19e-e049-4393-8c09-3e3f8fb09ecb',
name: 'Qonto',
domainName: 'qonto.com',
__typename: 'Company',
},
phone: '06 12 34 56 78',
_activityCount: 1,
createdAt: '2023-04-20T13:20:09.158312+00:00',
city: 'Paris',
},
{
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
__typename: 'Person',
firstName: 'John',
lastName: 'Doe',
displayName: 'John Doe',
linkedinUrl: 'https://www.linkedin.com/in/johndoe/',
xUrl: 'https://twitter.com/johndoe',
name: { firstName: 'John', lastName: 'Doe' },
linkedinLink: {
url: 'https://www.linkedin.com/in/johndoe/',
label: 'https://www.linkedin.com/in/johndoe/',
},
xLink: {
url: 'https://twitter.com/johndoe',
label: 'https://twitter.com/johndoe',
},
avatarUrl: '',
jobTitle: 'CTO',
email: 'john@linkedin.com',
@ -68,21 +72,25 @@ export const mockedPeopleData: MockedPerson[] = [
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6e',
name: 'LinkedIn',
domainName: 'linkedin.com',
__typename: 'Company',
},
phone: '06 12 34 56 78',
_activityCount: 1,
createdAt: '2023-04-20T13:20:09.158312+00:00',
city: 'Paris',
},
{
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6f',
__typename: 'Person',
firstName: 'Jane',
lastName: 'Doe',
displayName: 'Jane Doe',
linkedinUrl: 'https://www.linkedin.com/in/janedoe/',
xUrl: 'https://twitter.com/janedoe',
name: {
firstName: 'Jane',
lastName: 'Doe',
},
linkedinLink: {
url: 'https://www.linkedin.com/in/janedoe/',
label: 'https://www.linkedin.com/in/janedoe/',
},
xLink: {
url: 'https://twitter.com/janedoe',
label: 'https://twitter.com/janedoe',
},
avatarUrl: '',
jobTitle: 'Investor',
email: 'jane@sequoiacap.com',
@ -91,22 +99,26 @@ export const mockedPeopleData: MockedPerson[] = [
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6g',
name: 'Sequoia',
domainName: 'sequoiacap.com',
__typename: 'Company',
},
phone: '06 12 34 56 78',
_activityCount: 1,
createdAt: '2023-04-20T13:20:09.158312+00:00',
city: 'Paris',
},
{
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6h',
__typename: 'Person',
firstName: 'Janice',
lastName: 'Dane',
displayName: 'Janice Dane',
name: {
firstName: 'Janice',
lastName: 'Dane',
},
email: 'janice@facebook.com',
linkedinUrl: 'https://www.linkedin.com/in/janicedane/',
xUrl: 'https://twitter.com/janicedane',
linkedinLink: {
url: 'https://www.linkedin.com/in/janicedane/',
label: 'https://www.linkedin.com/in/janicedane/',
},
xLink: {
url: 'https://twitter.com/janicedane',
label: 'https://twitter.com/janicedane',
},
avatarUrl: '',
jobTitle: 'CEO',
companyId: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6i',
@ -114,10 +126,8 @@ export const mockedPeopleData: MockedPerson[] = [
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6i',
name: 'Facebook',
domainName: 'facebook.com',
__typename: 'Company',
},
phone: '06 12 34 56 78',
_activityCount: 2,
createdAt: '2023-04-20T13:20:09.158312+00:00',
city: 'Paris',
},

View File

@ -1,72 +0,0 @@
import { PipelineProgress, User } from '../../generated/graphql';
type MockedPipelineProgress = Pick<
PipelineProgress,
| 'id'
| 'amount'
| 'closeDate'
| 'companyId'
| 'pipelineStageId'
| 'probability'
| 'pointOfContact'
| 'pointOfContactId'
| 'personId'
> & {
accountOwner: Pick<
User,
| 'id'
| 'email'
| 'displayName'
| 'avatarUrl'
| '__typename'
| 'firstName'
| 'lastName'
> | null;
};
const accountOwner = {
email: 'charles@test.com',
displayName: 'Charles Test',
firstName: 'Charles',
lastName: 'Test',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
};
export const mockedPipelineProgressData: Array<MockedPipelineProgress> = [
{
id: '0ac8761c-1ad6-11ee-be56-0242ac120002',
amount: 78,
closeDate: '2021-10-01T00:00:00.000Z',
companyId: '0',
accountOwner: accountOwner,
pipelineStageId: 'another-pipeline-stage-1',
probability: null,
pointOfContact: null,
pointOfContactId: null,
personId: null,
},
{
id: 'fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
companyId: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
pipelineStageId: 'fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
amount: 7,
closeDate: '2021-10-01T00:00:00.000Z',
accountOwner,
probability: null,
pointOfContact: null,
pointOfContactId: null,
personId: null,
},
{
id: '4a886c90-f4f2-4984-8222-882ebbb905d6',
companyId: 'b396e6b9-dc5c-4643-bcff-61b6cf7523ae',
amount: 100,
closeDate: '2021-10-01T00:00:00.000Z',
accountOwner,
pipelineStageId: 'fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
probability: null,
pointOfContact: null,
pointOfContactId: null,
personId: null,
},
];

View File

@ -1,88 +0,0 @@
import {
Pipeline,
PipelineProgress,
PipelineProgressableType,
PipelineStage,
} from '../../generated/graphql';
type MockedPipeline = Pick<
Pipeline,
'id' | 'name' | 'pipelineProgressableType' | '__typename'
> & {
pipelineStages: Array<
Pick<PipelineStage, 'id' | 'name' | 'color' | 'position' | '__typename'> & {
pipelineProgresses: Array<
Pick<
PipelineProgress,
'id' | 'companyId' | 'amount' | 'closeDate' | '__typename'
>
>;
}
>;
};
export const mockedPipelinesData: Array<MockedPipeline> = [
{
id: 'fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
name: 'Sales pipeline',
pipelineProgressableType: PipelineProgressableType.Company,
pipelineStages: [
{
id: 'fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
name: 'New',
color: 'red',
position: 0,
pipelineProgresses: [
{
id: 'fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
companyId: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
amount: null,
closeDate: null,
__typename: 'PipelineProgress',
},
{
id: '4a886c90-f4f2-4984-8222-882ebbb905d6',
companyId: 'b396e6b9-dc5c-4643-bcff-61b6cf7523ae',
amount: null,
closeDate: null,
__typename: 'PipelineProgress',
},
],
__typename: 'PipelineStage',
},
{
id: 'fe256b39-3ec3-4fe4-8998-b76aa0bfb600',
name: 'Screening',
color: 'purple',
position: 1,
pipelineProgresses: [],
__typename: 'PipelineStage',
},
{
id: 'fe256b39-3ec3-4fe5-8998-b76aa0bfb600',
name: 'Meeting',
color: 'sky',
position: 2,
pipelineProgresses: [],
__typename: 'PipelineStage',
},
{
id: 'fe256b39-3ec3-4fe6-8998-b76aa0bfb600',
name: 'Proposal',
color: 'turquoise',
position: 3,
pipelineProgresses: [],
__typename: 'PipelineStage',
},
{
id: 'fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
name: 'Customer',
color: 'yellow',
position: 4,
pipelineProgresses: [],
__typename: 'PipelineStage',
},
],
__typename: 'Pipeline',
},
];

View File

@ -1,45 +1,24 @@
import {
Activity,
Attachment,
ColorScheme,
Company,
User,
UserSettings,
Workspace,
WorkspaceMember,
} from '~/generated/graphql';
import { Activity } from '@/activities/types/Activity';
import { Attachment } from '@/attachments/types/Attachment';
import { Company } from '@/companies/types/Company';
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
import { User, Workspace } from '~/generated/graphql';
type MockedUser = Pick<
User,
| 'id'
| 'email'
| 'displayName'
| 'firstName'
| 'lastName'
| 'avatarUrl'
| 'canImpersonate'
| 'supportUserHash'
| '__typename'
'id' | 'email' | 'firstName' | 'lastName' | 'canImpersonate' | '__typename'
> & {
workspaceMember: Pick<
WorkspaceMember,
'id' | 'allowImpersonation' | '__typename'
> & {
workspaceMember: Pick<WorkspaceMember, 'id' | 'allowImpersonation'> & {
workspace: Pick<
Workspace,
'id' | 'displayName' | 'domainName' | 'inviteHash' | 'logo' | '__typename'
>;
settings: Pick<
UserSettings,
'id' | 'colorScheme' | 'locale' | '__typename'
>;
assignedActivities: Array<Activity>;
authoredActivities: Array<Activity>;
authoredAttachments: Array<Attachment>;
companies: Array<Company>;
comments: Array<Comment>;
};
settings: Pick<UserSettings, 'id' | 'colorScheme' | 'locale' | '__typename'>;
};
export const avatarUrl =
@ -52,14 +31,10 @@ export const mockedUsersData: Array<MockedUser> = [
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
__typename: 'User',
email: 'charles@test.com',
displayName: 'Charles Test',
firstName: 'Charles',
lastName: 'Test',
avatarUrl: null,
canImpersonate: false,
supportUserHash: '',
workspaceMember: {
__typename: 'WorkspaceMember',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
allowImpersonation: true,
workspace: {
@ -70,36 +45,21 @@ export const mockedUsersData: Array<MockedUser> = [
inviteHash: 'twenty.com-invite-hash',
logo: workspaceLogoUrl,
},
settings: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
__typename: 'UserSettings',
locale: 'en',
colorScheme: ColorScheme.System,
},
authoredAttachments: [],
assignedActivities: [],
authoredActivities: [],
companies: [],
comments: [],
},
settings: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
__typename: 'UserSettings',
locale: 'en',
colorScheme: ColorScheme.System,
},
},
{
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6c',
__typename: 'User',
email: 'felix@test.com',
displayName: 'Felix Test',
firstName: 'Felix',
lastName: 'Test',
canImpersonate: false,
supportUserHash: '',
workspaceMember: {
__typename: 'WorkspaceMember',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
allowImpersonation: true,
workspace: {
@ -110,24 +70,12 @@ export const mockedUsersData: Array<MockedUser> = [
inviteHash: 'twenty.com-invite-hash',
logo: workspaceLogoUrl,
},
settings: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
__typename: 'UserSettings',
locale: 'en',
colorScheme: ColorScheme.System,
},
authoredAttachments: [],
assignedActivities: [],
authoredActivities: [],
companies: [],
comments: [],
},
settings: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdt7a',
__typename: 'UserSettings',
locale: 'en',
colorScheme: ColorScheme.System,
},
},
];
@ -136,14 +84,10 @@ export const mockedOnboardingUsersData: Array<MockedUser> = [
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
__typename: 'User',
email: 'workspace-onboarding@test.com',
displayName: '',
firstName: '',
lastName: '',
avatarUrl: null,
canImpersonate: false,
supportUserHash: '',
workspaceMember: {
__typename: 'WorkspaceMember',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
allowImpersonation: true,
workspace: {
@ -154,37 +98,21 @@ export const mockedOnboardingUsersData: Array<MockedUser> = [
inviteHash: 'twenty.com-invite-hash-1',
logo: '',
},
settings: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
__typename: 'UserSettings',
locale: 'en',
colorScheme: ColorScheme.System,
},
authoredAttachments: [],
assignedActivities: [],
authoredActivities: [],
companies: [],
comments: [],
},
settings: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
__typename: 'UserSettings',
locale: 'en',
colorScheme: ColorScheme.System,
},
},
{
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
__typename: 'User',
email: 'profile-onboarding@test.com',
displayName: '',
firstName: '',
lastName: '',
avatarUrl: null,
canImpersonate: false,
supportUserHash: '',
workspaceMember: {
__typename: 'WorkspaceMember',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
allowImpersonation: true,
workspace: {
@ -195,23 +123,11 @@ export const mockedOnboardingUsersData: Array<MockedUser> = [
inviteHash: 'twenty.com-invite-hash-2',
logo: '',
},
settings: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
__typename: 'UserSettings',
locale: 'en',
colorScheme: ColorScheme.System,
},
authoredAttachments: [],
assignedActivities: [],
authoredActivities: [],
companies: [],
comments: [],
},
settings: {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
__typename: 'UserSettings',
locale: 'en',
colorScheme: ColorScheme.System,
},
},
];