2929 fetch emails from backend and display them in the UI (#3092)

* sending mock data from the resolver

* add sql raw query to the resolver

* improve query

* fix email component css

* fix query

* css adjustments

* create hard limit for mail display

* fix display name ellipsis

* add service

* fetching email on company page is working

* graphql generate

* move queries into separate files

* add types

* renaming

* add early return

* modified according to comments

* graphql data generate

* fix bug after renaming

* fix issue with mock data
This commit is contained in:
bosiraphael
2023-12-21 18:21:07 +01:00
committed by GitHub
parent 7f66eb9459
commit 1b7580476d
15 changed files with 489 additions and 93 deletions

View File

@ -350,6 +350,8 @@ export type Query = {
currentUser: User;
currentWorkspace: Workspace;
findWorkspaceFromInviteHash: Workspace;
getTimelineThreadsFromCompanyId: Array<TimelineThread>;
getTimelineThreadsFromPersonId: Array<TimelineThread>;
object: Object;
objects: ObjectConnection;
};
@ -369,6 +371,16 @@ export type QueryFindWorkspaceFromInviteHashArgs = {
inviteHash: Scalars['String'];
};
export type QueryGetTimelineThreadsFromCompanyIdArgs = {
companyId: Scalars['String'];
};
export type QueryGetTimelineThreadsFromPersonIdArgs = {
personId: Scalars['String'];
};
export type RefreshToken = {
__typename?: 'RefreshToken';
createdAt: Scalars['DateTime'];
@ -438,6 +450,17 @@ export type Telemetry = {
enabled: Scalars['Boolean'];
};
export type TimelineThread = {
__typename?: 'TimelineThread';
body: Scalars['String'];
numberOfMessagesInThread: Scalars['Float'];
read: Scalars['Boolean'];
receivedAt: Scalars['DateTime'];
senderName: Scalars['String'];
senderPictureUrl: Scalars['String'];
subject: Scalars['String'];
};
export type TransientToken = {
__typename?: 'TransientToken';
transientToken: AuthToken;
@ -630,6 +653,20 @@ export type RelationEdge = {
node: Relation;
};
export type GetTimelineThreadsFromCompanyIdQueryVariables = Exact<{
companyId: Scalars['String'];
}>;
export type GetTimelineThreadsFromCompanyIdQuery = { __typename?: 'Query', getTimelineThreadsFromCompanyId: Array<{ __typename?: 'TimelineThread', body: string, numberOfMessagesInThread: number, read: boolean, receivedAt: string, senderName: string, senderPictureUrl: string, subject: string }> };
export type GetTimelineThreadsFromPersonIdQueryVariables = Exact<{
personId: Scalars['String'];
}>;
export type GetTimelineThreadsFromPersonIdQuery = { __typename?: 'Query', getTimelineThreadsFromPersonId: Array<{ __typename?: 'TimelineThread', body: string, numberOfMessagesInThread: number, read: boolean, receivedAt: string, senderName: string, senderPictureUrl: string, subject: string }> };
export type CreateEventMutationVariables = Exact<{
type: Scalars['String'];
data: Scalars['JSON'];
@ -817,6 +854,88 @@ export const UserQueryFragmentFragmentDoc = gql`
}
}
`;
export const GetTimelineThreadsFromCompanyIdDocument = gql`
query GetTimelineThreadsFromCompanyId($companyId: String!) {
getTimelineThreadsFromCompanyId(companyId: $companyId) {
body
numberOfMessagesInThread
read
receivedAt
senderName
senderPictureUrl
subject
}
}
`;
/**
* __useGetTimelineThreadsFromCompanyIdQuery__
*
* To run a query within a React component, call `useGetTimelineThreadsFromCompanyIdQuery` and pass it any options that fit your needs.
* When your component renders, `useGetTimelineThreadsFromCompanyIdQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useGetTimelineThreadsFromCompanyIdQuery({
* variables: {
* companyId: // value for 'companyId'
* },
* });
*/
export function useGetTimelineThreadsFromCompanyIdQuery(baseOptions: Apollo.QueryHookOptions<GetTimelineThreadsFromCompanyIdQuery, GetTimelineThreadsFromCompanyIdQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<GetTimelineThreadsFromCompanyIdQuery, GetTimelineThreadsFromCompanyIdQueryVariables>(GetTimelineThreadsFromCompanyIdDocument, options);
}
export function useGetTimelineThreadsFromCompanyIdLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetTimelineThreadsFromCompanyIdQuery, GetTimelineThreadsFromCompanyIdQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<GetTimelineThreadsFromCompanyIdQuery, GetTimelineThreadsFromCompanyIdQueryVariables>(GetTimelineThreadsFromCompanyIdDocument, options);
}
export type GetTimelineThreadsFromCompanyIdQueryHookResult = ReturnType<typeof useGetTimelineThreadsFromCompanyIdQuery>;
export type GetTimelineThreadsFromCompanyIdLazyQueryHookResult = ReturnType<typeof useGetTimelineThreadsFromCompanyIdLazyQuery>;
export type GetTimelineThreadsFromCompanyIdQueryResult = Apollo.QueryResult<GetTimelineThreadsFromCompanyIdQuery, GetTimelineThreadsFromCompanyIdQueryVariables>;
export const GetTimelineThreadsFromPersonIdDocument = gql`
query GetTimelineThreadsFromPersonId($personId: String!) {
getTimelineThreadsFromPersonId(personId: $personId) {
body
numberOfMessagesInThread
read
receivedAt
senderName
senderPictureUrl
subject
}
}
`;
/**
* __useGetTimelineThreadsFromPersonIdQuery__
*
* To run a query within a React component, call `useGetTimelineThreadsFromPersonIdQuery` and pass it any options that fit your needs.
* When your component renders, `useGetTimelineThreadsFromPersonIdQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useGetTimelineThreadsFromPersonIdQuery({
* variables: {
* personId: // value for 'personId'
* },
* });
*/
export function useGetTimelineThreadsFromPersonIdQuery(baseOptions: Apollo.QueryHookOptions<GetTimelineThreadsFromPersonIdQuery, GetTimelineThreadsFromPersonIdQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<GetTimelineThreadsFromPersonIdQuery, GetTimelineThreadsFromPersonIdQueryVariables>(GetTimelineThreadsFromPersonIdDocument, options);
}
export function useGetTimelineThreadsFromPersonIdLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetTimelineThreadsFromPersonIdQuery, GetTimelineThreadsFromPersonIdQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<GetTimelineThreadsFromPersonIdQuery, GetTimelineThreadsFromPersonIdQueryVariables>(GetTimelineThreadsFromPersonIdDocument, options);
}
export type GetTimelineThreadsFromPersonIdQueryHookResult = ReturnType<typeof useGetTimelineThreadsFromPersonIdQuery>;
export type GetTimelineThreadsFromPersonIdLazyQueryHookResult = ReturnType<typeof useGetTimelineThreadsFromPersonIdLazyQuery>;
export type GetTimelineThreadsFromPersonIdQueryResult = Apollo.QueryResult<GetTimelineThreadsFromPersonIdQuery, GetTimelineThreadsFromPersonIdQueryVariables>;
export const CreateEventDocument = gql`
mutation CreateEvent($type: String!, $data: JSON!) {
createEvent(type: $type, data: $data) {