fix: add firstName and lastName to user model (#473)
* fix: add firstname and lastanme to user model * fix: avoid undefined in displayName resolve field * fix: user firstName and lastName instead of firstname lastname * fix: person table proper naming firstName lastName * fix: migrate front with firstName and lastName * fix: make front-graphql-generate not working
This commit is contained in:
@ -109,14 +109,14 @@ export function CommentThreadRelationPicker({ commentThread }: OwnProps) {
|
||||
|
||||
const personsForMultiSelect = useFilteredSearchEntityQuery({
|
||||
queryHook: useSearchPeopleQuery,
|
||||
searchOnFields: ['firstname', 'lastname'],
|
||||
orderByField: 'lastname',
|
||||
searchOnFields: ['firstName', 'lastName'],
|
||||
orderByField: 'lastName',
|
||||
selectedIds: peopleIds,
|
||||
mappingFunction: (entity) =>
|
||||
({
|
||||
id: entity.id,
|
||||
entityType: CommentableType.Person,
|
||||
name: `${entity.firstname} ${entity.lastname}`,
|
||||
name: `${entity.firstName} ${entity.lastName}`,
|
||||
avatarType: 'rounded',
|
||||
} as CommentableEntityForSelect),
|
||||
searchFilter,
|
||||
|
||||
@ -9,8 +9,8 @@ import { CommentableType, Person } from '~/generated/graphql';
|
||||
import { PersonChip } from './PersonChip';
|
||||
|
||||
type OwnProps = {
|
||||
person: Pick<Person, 'id' | 'firstname' | 'lastname' | '_commentCount'>;
|
||||
onChange: (firstname: string, lastname: string) => void;
|
||||
person: Pick<Person, 'id' | 'firstName' | 'lastName' | '_commentCount'>;
|
||||
onChange: (firstName: string, lastName: string) => void;
|
||||
};
|
||||
|
||||
const NoEditModeContainer = styled.div`
|
||||
@ -25,16 +25,16 @@ const RightContainer = styled.div`
|
||||
`;
|
||||
|
||||
export function EditablePeopleFullName({ person, onChange }: OwnProps) {
|
||||
const [firstnameValue, setFirstnameValue] = useState(person.firstname ?? '');
|
||||
const [lastnameValue, setLastnameValue] = useState(person.lastname ?? '');
|
||||
const [firstNameValue, setFirstNameValue] = useState(person.firstName ?? '');
|
||||
const [lastNameValue, setLastNameValue] = useState(person.lastName ?? '');
|
||||
const openCommentRightDrawer = useOpenCommentRightDrawer();
|
||||
|
||||
function handleDoubleTextChange(
|
||||
firstValue: string,
|
||||
secondValue: string,
|
||||
): void {
|
||||
setFirstnameValue(firstValue);
|
||||
setLastnameValue(secondValue);
|
||||
setFirstNameValue(firstValue);
|
||||
setLastNameValue(secondValue);
|
||||
|
||||
onChange(firstValue, secondValue);
|
||||
}
|
||||
@ -53,14 +53,14 @@ export function EditablePeopleFullName({ person, onChange }: OwnProps) {
|
||||
|
||||
return (
|
||||
<EditableDoubleText
|
||||
firstValue={firstnameValue}
|
||||
secondValue={lastnameValue}
|
||||
firstValue={firstNameValue}
|
||||
secondValue={lastNameValue}
|
||||
firstValuePlaceholder="First name"
|
||||
secondValuePlaceholder="Last name"
|
||||
onChange={handleDoubleTextChange}
|
||||
nonEditModeContent={
|
||||
<NoEditModeContainer>
|
||||
<PersonChip name={person.firstname + ' ' + person.lastname} />
|
||||
<PersonChip name={person.firstName + ' ' + person.lastName} />
|
||||
<RightContainer>
|
||||
<CellCommentChip
|
||||
count={person._commentCount ?? 0}
|
||||
|
||||
@ -6,19 +6,19 @@ describe('reduceSortsToOrderBy', () => {
|
||||
it('should return an array of objects with the id as key and the order as value', () => {
|
||||
const sorts = [
|
||||
{
|
||||
key: 'firstname',
|
||||
label: 'firstname',
|
||||
key: 'firstName',
|
||||
label: 'firstName',
|
||||
order: 'asc',
|
||||
_type: 'default_sort',
|
||||
},
|
||||
{
|
||||
key: 'lastname',
|
||||
label: 'lastname',
|
||||
key: 'lastName',
|
||||
label: 'lastName',
|
||||
order: 'desc',
|
||||
_type: 'default_sort',
|
||||
},
|
||||
] satisfies PeopleSelectedSortType[];
|
||||
const result = reduceSortsToOrderBy(sorts);
|
||||
expect(result).toEqual([{ firstname: 'asc' }, { lastname: 'desc' }]);
|
||||
expect(result).toEqual([{ firstName: 'asc' }, { lastName: 'desc' }]);
|
||||
});
|
||||
});
|
||||
|
||||
@ -21,8 +21,8 @@ export const GET_PEOPLE = gql`
|
||||
phone
|
||||
email
|
||||
city
|
||||
firstname
|
||||
lastname
|
||||
firstName
|
||||
lastName
|
||||
createdAt
|
||||
_commentCount
|
||||
company {
|
||||
|
||||
@ -3,8 +3,8 @@ import { gql } from '@apollo/client';
|
||||
export const UPDATE_PERSON = gql`
|
||||
mutation UpdatePeople(
|
||||
$id: String
|
||||
$firstname: String
|
||||
$lastname: String
|
||||
$firstName: String
|
||||
$lastName: String
|
||||
$phone: String
|
||||
$city: String
|
||||
$companyId: String
|
||||
@ -17,13 +17,14 @@ export const UPDATE_PERSON = gql`
|
||||
city: { set: $city }
|
||||
company: { connect: { id: $companyId } }
|
||||
email: { set: $email }
|
||||
firstname: { set: $firstname }
|
||||
firstName: { set: $firstName }
|
||||
id: { set: $id }
|
||||
lastname: { set: $lastname }
|
||||
lastName: { set: $lastName }
|
||||
phone: { set: $phone }
|
||||
createdAt: { set: $createdAt }
|
||||
}
|
||||
) {
|
||||
id
|
||||
city
|
||||
company {
|
||||
domainName
|
||||
@ -31,9 +32,8 @@ export const UPDATE_PERSON = gql`
|
||||
id
|
||||
}
|
||||
email
|
||||
firstname
|
||||
id
|
||||
lastname
|
||||
firstName
|
||||
lastName
|
||||
phone
|
||||
createdAt
|
||||
}
|
||||
@ -43,8 +43,8 @@ export const UPDATE_PERSON = gql`
|
||||
export const INSERT_PERSON = gql`
|
||||
mutation InsertPerson(
|
||||
$id: String!
|
||||
$firstname: String!
|
||||
$lastname: String!
|
||||
$firstName: String!
|
||||
$lastName: String!
|
||||
$phone: String!
|
||||
$city: String!
|
||||
$email: String!
|
||||
@ -53,14 +53,15 @@ export const INSERT_PERSON = gql`
|
||||
createOnePerson(
|
||||
data: {
|
||||
id: $id
|
||||
firstname: $firstname
|
||||
lastname: $lastname
|
||||
firstName: $firstName
|
||||
lastName: $lastName
|
||||
phone: $phone
|
||||
city: $city
|
||||
email: $email
|
||||
createdAt: $createdAt
|
||||
}
|
||||
) {
|
||||
id
|
||||
city
|
||||
company {
|
||||
domainName
|
||||
@ -68,9 +69,8 @@ export const INSERT_PERSON = gql`
|
||||
id
|
||||
}
|
||||
email
|
||||
firstname
|
||||
id
|
||||
lastname
|
||||
firstName
|
||||
lastName
|
||||
phone
|
||||
createdAt
|
||||
}
|
||||
|
||||
@ -20,8 +20,8 @@ export const SEARCH_PEOPLE_QUERY = gql`
|
||||
phone
|
||||
email
|
||||
city
|
||||
firstname
|
||||
lastname
|
||||
firstName
|
||||
lastName
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user