folderStructure.json refactor (#8088)
#7911 If you encounter any issues or have any questions regarding the library, feel free to write [here](https://github.com/Igorkowalski94/eslint-plugin-project-structure/discussions/new?category=help), I’d be happy to help.
This commit is contained in:
@ -45,7 +45,7 @@ export const PERSON_FRAGMENT_WITH_DEPTH_ZERO_RELATIONS = `
|
||||
primaryLinkLabel
|
||||
secondaryLinks
|
||||
}
|
||||
`
|
||||
`;
|
||||
|
||||
export const PERSON_FRAGMENT_WITH_DEPTH_ONE_RELATIONS = `
|
||||
__typename
|
||||
@ -324,4 +324,4 @@ export const PERSON_FRAGMENT_WITH_DEPTH_ONE_RELATIONS = `
|
||||
primaryLinkLabel
|
||||
secondaryLinks
|
||||
}
|
||||
`
|
||||
`;
|
||||
|
||||
@ -3,10 +3,19 @@ import { gql } from '@apollo/client';
|
||||
|
||||
import { peopleQueryResult } from '~/testing/mock-data/people';
|
||||
|
||||
|
||||
export const query = gql`
|
||||
query FindManyPeople($filter: PersonFilterInput, $orderBy: [PersonOrderByInput], $lastCursor: String, $limit: Int) {
|
||||
people(filter: $filter, orderBy: $orderBy, first: $limit, after: $lastCursor){
|
||||
query FindManyPeople(
|
||||
$filter: PersonFilterInput
|
||||
$orderBy: [PersonOrderByInput]
|
||||
$lastCursor: String
|
||||
$limit: Int
|
||||
) {
|
||||
people(
|
||||
filter: $filter
|
||||
orderBy: $orderBy
|
||||
first: $limit
|
||||
after: $lastCursor
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
@ -27,38 +36,51 @@ export const query = gql`
|
||||
|
||||
export const mockPageSize = 2;
|
||||
|
||||
export const peopleMockWithIdsOnly: RecordGqlConnection = { ...peopleQueryResult.people,edges: peopleQueryResult.people.edges.map((edge) => ({ ...edge, node: { __typename: 'Person', id: edge.node.id } })) };
|
||||
export const peopleMockWithIdsOnly: RecordGqlConnection = {
|
||||
...peopleQueryResult.people,
|
||||
edges: peopleQueryResult.people.edges.map((edge) => ({
|
||||
...edge,
|
||||
node: { __typename: 'Person', id: edge.node.id },
|
||||
})),
|
||||
};
|
||||
|
||||
export const firstRequestLastCursor = peopleMockWithIdsOnly.edges[mockPageSize].cursor;
|
||||
export const secondRequestLastCursor = peopleMockWithIdsOnly.edges[mockPageSize * 2].cursor;
|
||||
export const thirdRequestLastCursor = peopleMockWithIdsOnly.edges[mockPageSize * 3].cursor;
|
||||
export const firstRequestLastCursor =
|
||||
peopleMockWithIdsOnly.edges[mockPageSize].cursor;
|
||||
export const secondRequestLastCursor =
|
||||
peopleMockWithIdsOnly.edges[mockPageSize * 2].cursor;
|
||||
export const thirdRequestLastCursor =
|
||||
peopleMockWithIdsOnly.edges[mockPageSize * 3].cursor;
|
||||
|
||||
export const variablesFirstRequest = {
|
||||
filter: undefined,
|
||||
limit: mockPageSize,
|
||||
orderBy: undefined
|
||||
orderBy: undefined,
|
||||
};
|
||||
|
||||
export const variablesSecondRequest = {
|
||||
filter: undefined,
|
||||
limit: mockPageSize,
|
||||
orderBy: undefined,
|
||||
lastCursor: firstRequestLastCursor
|
||||
lastCursor: firstRequestLastCursor,
|
||||
};
|
||||
|
||||
export const variablesThirdRequest = {
|
||||
filter: undefined,
|
||||
limit: mockPageSize,
|
||||
orderBy: undefined,
|
||||
lastCursor: secondRequestLastCursor
|
||||
}
|
||||
lastCursor: secondRequestLastCursor,
|
||||
};
|
||||
|
||||
const paginateRequestResponse = (response: RecordGqlConnection, start: number, end: number, hasNextPage: boolean, totalCount: number) => {
|
||||
const paginateRequestResponse = (
|
||||
response: RecordGqlConnection,
|
||||
start: number,
|
||||
end: number,
|
||||
hasNextPage: boolean,
|
||||
totalCount: number,
|
||||
) => {
|
||||
return {
|
||||
...response,
|
||||
edges: [
|
||||
...response.edges.slice(start, end)
|
||||
],
|
||||
edges: [...response.edges.slice(start, end)],
|
||||
pageInfo: {
|
||||
...response.pageInfo,
|
||||
startCursor: response.edges[start].cursor,
|
||||
@ -66,17 +88,35 @@ const paginateRequestResponse = (response: RecordGqlConnection, start: number, e
|
||||
hasNextPage,
|
||||
} satisfies RecordGqlConnection['pageInfo'],
|
||||
totalCount,
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const responseFirstRequest = {
|
||||
people: paginateRequestResponse(peopleMockWithIdsOnly, 0, mockPageSize, true, 6),
|
||||
people: paginateRequestResponse(
|
||||
peopleMockWithIdsOnly,
|
||||
0,
|
||||
mockPageSize,
|
||||
true,
|
||||
6,
|
||||
),
|
||||
};
|
||||
|
||||
export const responseSecondRequest = {
|
||||
people: paginateRequestResponse(peopleMockWithIdsOnly, mockPageSize, mockPageSize * 2, true, 6),
|
||||
people: paginateRequestResponse(
|
||||
peopleMockWithIdsOnly,
|
||||
mockPageSize,
|
||||
mockPageSize * 2,
|
||||
true,
|
||||
6,
|
||||
),
|
||||
};
|
||||
|
||||
export const responseThirdRequest = {
|
||||
people: paginateRequestResponse(peopleMockWithIdsOnly, mockPageSize * 2, mockPageSize * 3, false, 6),
|
||||
people: paginateRequestResponse(
|
||||
peopleMockWithIdsOnly,
|
||||
mockPageSize * 2,
|
||||
mockPageSize * 3,
|
||||
false,
|
||||
6,
|
||||
),
|
||||
};
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
FieldFullNameMetadata,
|
||||
FieldRatingMetadata,
|
||||
FieldSelectMetadata,
|
||||
FieldTextMetadata
|
||||
FieldTextMetadata,
|
||||
} from '@/object-record/record-field/types/FieldMetadata';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
|
||||
@ -29,7 +29,6 @@ if (!mockedPersonObjectMetadataItem) {
|
||||
throw new Error('Person object metadata item not found');
|
||||
}
|
||||
|
||||
|
||||
const relationFieldMetadataItem = mockedPersonObjectMetadataItem?.fields?.find(
|
||||
({ name }) => name === 'company',
|
||||
);
|
||||
@ -110,4 +109,4 @@ export const actorFieldDefinition: FieldDefinition<FieldActorMetadata> = {
|
||||
metadata: {
|
||||
fieldName: 'actor',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@ -15,7 +15,7 @@ export const recordTableRow: RecordTableRowContextProps = {
|
||||
isPendingRow: false,
|
||||
};
|
||||
|
||||
export const recordTableCell:RecordTableCellContextProps= {
|
||||
export const recordTableCell: RecordTableCellContextProps = {
|
||||
columnIndex: 3,
|
||||
columnDefinition: {
|
||||
size: 1,
|
||||
|
||||
Reference in New Issue
Block a user