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:
@ -18,7 +18,7 @@ const StyledContainer = styled.div`
|
||||
export const Favorites = () => {
|
||||
// This is only temporary and will be refactored once we have main identifiers
|
||||
const { favorites, handleReorderFavorite } = useFavorites({
|
||||
objectNamePlural: 'companiesV2',
|
||||
objectNamePlural: 'companies',
|
||||
});
|
||||
|
||||
if (!favorites || favorites.length === 0) return <></>;
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const DELETE_FAVORITE = gql`
|
||||
mutation DeleteFavorite($where: FavoriteWhereInput!) {
|
||||
deleteFavorite(where: $where) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1,14 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const INSERT_COMPANY_FAVORITE = gql`
|
||||
mutation InsertCompanyFavorite($data: FavoriteMutationForCompanyArgs!) {
|
||||
createFavoriteForCompany(data: $data) {
|
||||
id
|
||||
company {
|
||||
id
|
||||
name
|
||||
domainName
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1,15 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const INSERT_PERSON_FAVORITE = gql`
|
||||
mutation InsertPersonFavorite($data: FavoriteMutationForPersonArgs!) {
|
||||
createFavoriteForPerson(data: $data) {
|
||||
id
|
||||
person {
|
||||
id
|
||||
firstName
|
||||
lastName
|
||||
displayName
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1,28 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const UPDATE_FAVORITE = gql`
|
||||
mutation UpdateOneFavorite(
|
||||
$data: FavoriteUpdateInput!
|
||||
$where: FavoriteWhereUniqueInput!
|
||||
) {
|
||||
updateOneFavorites(data: $data, where: $where) {
|
||||
id
|
||||
person {
|
||||
id
|
||||
firstName
|
||||
lastName
|
||||
avatarUrl
|
||||
}
|
||||
company {
|
||||
id
|
||||
name
|
||||
domainName
|
||||
accountOwner {
|
||||
id
|
||||
displayName
|
||||
avatarUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1,26 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_FAVORITES = gql`
|
||||
query GetFavorites {
|
||||
findFavorites {
|
||||
id
|
||||
position
|
||||
person {
|
||||
id
|
||||
firstName
|
||||
lastName
|
||||
avatarUrl
|
||||
}
|
||||
company {
|
||||
id
|
||||
name
|
||||
domainName
|
||||
accountOwner {
|
||||
id
|
||||
displayName
|
||||
avatarUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -4,12 +4,12 @@ import { OnDragEndResponder } from '@hello-pangea/dnd';
|
||||
import { useRecoilCallback, useRecoilState, useRecoilValue } from 'recoil';
|
||||
|
||||
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
|
||||
import { Company } from '@/companies/types/Company';
|
||||
import { Favorite } from '@/favorites/types/Favorite';
|
||||
import { mapFavorites } from '@/favorites/utils/mapFavorites';
|
||||
import { useFindOneObjectMetadataItem } from '@/object-metadata/hooks/useFindOneObjectMetadataItem';
|
||||
import { useFindManyObjectRecords } from '@/object-record/hooks/useFindManyObjectRecords';
|
||||
import { PaginatedObjectTypeResults } from '@/object-record/types/PaginatedObjectTypeResults';
|
||||
import { Company } from '~/generated/graphql';
|
||||
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||
|
||||
import { favoritesState } from '../states/favoritesState';
|
||||
@ -25,7 +25,7 @@ export const useFavorites = ({
|
||||
|
||||
const { updateOneMutation, createOneMutation, deleteOneMutation } =
|
||||
useFindOneObjectMetadataItem({
|
||||
objectNamePlural: 'favoritesV2',
|
||||
objectNamePlural: 'favorites',
|
||||
});
|
||||
|
||||
const { foundObjectMetadataItem: favoriteTargetObjectMetadataItem } =
|
||||
@ -44,7 +44,7 @@ export const useFavorites = ({
|
||||
|
||||
// This is only temporary and will be refactored once we have main identifiers
|
||||
const { loading: companiesLoading } = useFindManyObjectRecords({
|
||||
objectNamePlural: 'companiesV2',
|
||||
objectNamePlural: 'companies',
|
||||
onCompleted: async (
|
||||
data: PaginatedObjectTypeResults<Required<Company>>,
|
||||
) => {
|
||||
@ -64,7 +64,7 @@ export const useFavorites = ({
|
||||
});
|
||||
|
||||
const { loading: peopleLoading } = useFindManyObjectRecords({
|
||||
objectNamePlural: 'peopleV2',
|
||||
objectNamePlural: 'people',
|
||||
onCompleted: async (data) => {
|
||||
setAllPeople(
|
||||
data.edges.reduce(
|
||||
@ -84,7 +84,7 @@ export const useFavorites = ({
|
||||
|
||||
useFindManyObjectRecords({
|
||||
skip: companiesLoading || peopleLoading,
|
||||
objectNamePlural: 'favoritesV2',
|
||||
objectNamePlural: 'favorites',
|
||||
onCompleted: useRecoilCallback(
|
||||
({ snapshot, set }) =>
|
||||
async (data: PaginatedObjectTypeResults<Required<Favorite>>) => {
|
||||
@ -112,8 +112,7 @@ export const useFavorites = ({
|
||||
const favorites = snapshot.getLoadable(favoritesState).getValue();
|
||||
|
||||
const targetObjectName =
|
||||
favoriteTargetObjectMetadataItem?.nameSingular.replace('V2', '') ??
|
||||
'';
|
||||
favoriteTargetObjectMetadataItem?.nameSingular ?? '';
|
||||
|
||||
const result = await apolloClient.mutate({
|
||||
mutation: createOneMutation,
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { Company, Person } from '~/generated/graphql';
|
||||
import { Company } from '@/companies/types/Company';
|
||||
import { Person } from '@/people/types/Person';
|
||||
import { getLogoUrlFromDomainName } from '~/utils';
|
||||
import { assertNotNull } from '~/utils/assert';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
@ -7,8 +8,8 @@ export const mapFavorites = (
|
||||
favorites: any,
|
||||
recordsDict: {
|
||||
[key: string]: {
|
||||
firstName?: Person['firstName'];
|
||||
lastName?: Person['lastName'];
|
||||
firstName?: Person['name']['firstName'];
|
||||
lastName?: Person['name']['lastName'];
|
||||
avatarUrl?: Person['avatarUrl'];
|
||||
name?: Company['name'];
|
||||
domainName?: Company['domainName'];
|
||||
|
||||
Reference in New Issue
Block a user