Skip to content

The open alternative to Salesforce, designed for AI.

Make companies employees type a number (#130)

Charles Bochet192b89a7b71b
diff --git a/front/src/generated/graphql.tsx b/front/src/generated/graphql.tsx
index f76ac47f1a6..728d1d6a42f 100644
--- a/front/src/generated/graphql.tsx
+++ b/front/src/generated/graphql.tsx
@@ -17,6 +17,7 @@ export type Scalars = {
bytea: any;
citext: any;
jsonb: any;
+ numeric: any;
timestamptz: any;
uuid: any;
};
@@ -1722,7 +1723,7 @@ export type Companies = {
created_at: Scalars['timestamptz'];
deleted_at?: Maybe<Scalars['timestamptz']>;
domain_name?: Maybe<Scalars['String']>;
- employees: Scalars['Int'];
+ employees?: Maybe<Scalars['numeric']>;
id: Scalars['uuid'];
name?: Maybe<Scalars['String']>;
updated_at: Scalars['timestamptz'];
@@ -1778,7 +1779,7 @@ export type Companies_Bool_Exp = {
created_at?: InputMaybe<Timestamptz_Comparison_Exp>;
deleted_at?: InputMaybe<Timestamptz_Comparison_Exp>;
domain_name?: InputMaybe<String_Comparison_Exp>;
- employees?: InputMaybe<Int_Comparison_Exp>;
+ employees?: InputMaybe<Numeric_Comparison_Exp>;
id?: InputMaybe<Uuid_Comparison_Exp>;
name?: InputMaybe<String_Comparison_Exp>;
updated_at?: InputMaybe<Timestamptz_Comparison_Exp>;
@@ -1794,7 +1795,7 @@ export enum Companies_Constraint {
/** input type for incrementing numeric columns in table "companies" */
export type Companies_Inc_Input = {
- employees?: InputMaybe<Scalars['Int']>;
+ employees?: InputMaybe<Scalars['numeric']>;
};
/** input type for inserting data into table "companies" */
@@ -1805,7 +1806,7 @@ export type Companies_Insert_Input = {
created_at?: InputMaybe<Scalars['timestamptz']>;
deleted_at?: InputMaybe<Scalars['timestamptz']>;
domain_name?: InputMaybe<Scalars['String']>;
- employees?: InputMaybe<Scalars['Int']>;
+ employees?: InputMaybe<Scalars['numeric']>;
id?: InputMaybe<Scalars['uuid']>;
name?: InputMaybe<Scalars['String']>;
updated_at?: InputMaybe<Scalars['timestamptz']>;
@@ -1821,7 +1822,7 @@ export type Companies_Max_Fields = {
created_at?: Maybe<Scalars['timestamptz']>;
deleted_at?: Maybe<Scalars['timestamptz']>;
domain_name?: Maybe<Scalars['String']>;
- employees?: Maybe<Scalars['Int']>;
+ employees?: Maybe<Scalars['numeric']>;
id?: Maybe<Scalars['uuid']>;
name?: Maybe<Scalars['String']>;
updated_at?: Maybe<Scalars['timestamptz']>;
@@ -1836,7 +1837,7 @@ export type Companies_Min_Fields = {
created_at?: Maybe<Scalars['timestamptz']>;
deleted_at?: Maybe<Scalars['timestamptz']>;
domain_name?: Maybe<Scalars['String']>;
- employees?: Maybe<Scalars['Int']>;
+ employees?: Maybe<Scalars['numeric']>;
id?: Maybe<Scalars['uuid']>;
name?: Maybe<Scalars['String']>;
updated_at?: Maybe<Scalars['timestamptz']>;
@@ -1918,7 +1919,7 @@ export type Companies_Set_Input = {
created_at?: InputMaybe<Scalars['timestamptz']>;
deleted_at?: InputMaybe<Scalars['timestamptz']>;
domain_name?: InputMaybe<Scalars['String']>;
- employees?: InputMaybe<Scalars['Int']>;
+ employees?: InputMaybe<Scalars['numeric']>;
id?: InputMaybe<Scalars['uuid']>;
name?: InputMaybe<Scalars['String']>;
updated_at?: InputMaybe<Scalars['timestamptz']>;
@@ -1958,7 +1959,7 @@ export type Companies_Stream_Cursor_Value_Input = {
created_at?: InputMaybe<Scalars['timestamptz']>;
deleted_at?: InputMaybe<Scalars['timestamptz']>;
domain_name?: InputMaybe<Scalars['String']>;
- employees?: InputMaybe<Scalars['Int']>;
+ employees?: InputMaybe<Scalars['numeric']>;
id?: InputMaybe<Scalars['uuid']>;
name?: InputMaybe<Scalars['String']>;
updated_at?: InputMaybe<Scalars['timestamptz']>;
@@ -1968,7 +1969,7 @@ export type Companies_Stream_Cursor_Value_Input = {
/** aggregate sum on columns */
export type Companies_Sum_Fields = {
__typename?: 'companies_sum_fields';
- employees?: Maybe<Scalars['Int']>;
+ employees?: Maybe<Scalars['numeric']>;
};
/** update columns of table "companies" */
@@ -2807,6 +2808,19 @@ export type Mutation_RootUpdate_Workspaces_ManyArgs = {
updates: Array<Workspaces_Updates>;
};
+/** Boolean expression to compare columns of type "numeric". All fields are combined with logical 'AND'. */
+export type Numeric_Comparison_Exp = {
+ _eq?: InputMaybe<Scalars['numeric']>;
+ _gt?: InputMaybe<Scalars['numeric']>;
+ _gte?: InputMaybe<Scalars['numeric']>;
+ _in?: InputMaybe<Array<Scalars['numeric']>>;
+ _is_null?: InputMaybe<Scalars['Boolean']>;
+ _lt?: InputMaybe<Scalars['numeric']>;
+ _lte?: InputMaybe<Scalars['numeric']>;
+ _neq?: InputMaybe<Scalars['numeric']>;
+ _nin?: InputMaybe<Array<Scalars['numeric']>>;
+};
+
/** column ordering options */
export enum Order_By {
/** in ascending order, nulls last */
@@ -4999,25 +5013,49 @@ export type Workspaces_Updates = {
export type GetCompaniesQueryVariables = Exact<{
orderBy?: InputMaybe<Array<Companies_Order_By> | Companies_Order_By>;
+ where?: InputMaybe<Companies_Bool_Exp>;
}>;
-export type GetCompaniesQuery = { __typename?: 'query_root', companies: Array<{ __typename?: 'companies', id: any, domain_name?: string | null, name?: string | null, created_at: any, address?: string | null, employees: number, account_owner?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null }> };
+export type GetCompaniesQuery = { __typename?: 'query_root', companies: Array<{ __typename?: 'companies', id: any, domain_name?: string | null, name?: string | null, created_at: any, address?: string | null, employees?: any | null, account_owner?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null }> };
export type UpdateCompanyMutationVariables = Exact<{
id?: InputMaybe<Scalars['uuid']>;
name?: InputMaybe<Scalars['String']>;
domain_name?: InputMaybe<Scalars['String']>;
account_owner_id?: InputMaybe<Scalars['uuid']>;
+ created_at?: InputMaybe<Scalars['timestamptz']>;
+ address?: InputMaybe<Scalars['String']>;
+ employees?: InputMaybe<Scalars['numeric']>;
+}>;
+
+
+export type UpdateCompanyMutation = { __typename?: 'mutation_root', update_companies?: { __typename?: 'companies_mutation_response', affected_rows: number, returning: Array<{ __typename?: 'companies', address?: string | null, created_at: any, domain_name?: string | null, employees?: any | null, id: any, name?: string | null, account_owner?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null }> } | null };
+
+export type InsertCompanyMutationVariables = Exact<{
+ id?: InputMaybe<Scalars['uuid']>;
+ name?: InputMaybe<Scalars['String']>;
+ domain_name?: InputMaybe<Scalars['String']>;
+ account_owner_id?: InputMaybe<Scalars['uuid']>;
+ created_at?: InputMaybe<Scalars['timestamptz']>;
address?: InputMaybe<Scalars['String']>;
- employees?: InputMaybe<Scalars['Int']>;
+ employees?: InputMaybe<Scalars['numeric']>;
}>;
-export type UpdateCompanyMutation = { __typename?: 'mutation_root', update_companies?: { __typename?: 'companies_mutation_response', affected_rows: number, returning: Array<{ __typename?: 'companies', address?: string | null, created_at: any, domain_name?: string | null, employees: number, id: any, name?: string | null, account_owner?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null }> } | null };
+export type InsertCompanyMutation = { __typename?: 'mutation_root', insert_companies?: { __typename?: 'companies_mutation_response', affected_rows: number, returning: Array<{ __typename?: 'companies', address?: string | null, created_at: any, domain_name?: string | null, employees?: any | null, id: any, name?: string | null }> } | null };
+
+export type DeleteCompaniesMutationVariables = Exact<{
+ ids?: InputMaybe<Array<Scalars['uuid']> | Scalars['uuid']>;
+}>;
+
+
+export type DeleteCompaniesMutation = { __typename?: 'mutation_root', delete_companies?: { __typename?: 'companies_mutation_response', returning: Array<{ __typename?: 'companies', address?: string | null, created_at: any, domain_name?: string | null, employees?: any | null, id: any, name?: string | null }> } | null };
export type GetPeopleQueryVariables = Exact<{
orderBy?: InputMaybe<Array<People_Order_By> | People_Order_By>;
+ where?: InputMaybe<People_Bool_Exp>;
+ limit?: InputMaybe<Scalars['Int']>;
}>;
@@ -5031,15 +5069,44 @@ export type UpdatePeopleMutationVariables = Exact<{
city?: InputMaybe<Scalars['String']>;
company_id?: InputMaybe<Scalars['uuid']>;
email?: InputMaybe<Scalars['String']>;
+ created_at?: InputMaybe<Scalars['timestamptz']>;
}>;
-export type UpdatePeopleMutation = { __typename?: 'mutation_root', update_people?: { __typename?: 'people_mutation_response', returning: Array<{ __typename?: 'people', city?: string | null, email?: string | null, firstname?: string | null, id: any, lastname?: string | null, phone?: string | null, company?: { __typename?: 'companies', domain_name?: string | null, name?: string | null, id: any } | null }> } | null };
+export type UpdatePeopleMutation = { __typename?: 'mutation_root', update_people?: { __typename?: 'people_mutation_response', returning: Array<{ __typename?: 'people', city?: string | null, email?: string | null, firstname?: string | null, id: any, lastname?: string | null, phone?: string | null, created_at: any, company?: { __typename?: 'companies', domain_name?: string | null, name?: string | null, id: any } | null }> } | null };
+
+export type InsertPersonMutationVariables = Exact<{
+ id?: InputMaybe<Scalars['uuid']>;
+ firstname?: InputMaybe<Scalars['String']>;
+ lastname?: InputMaybe<Scalars['String']>;
+ phone?: InputMaybe<Scalars['String']>;
+ city?: InputMaybe<Scalars['String']>;
+ company_id?: InputMaybe<Scalars['uuid']>;
+ email?: InputMaybe<Scalars['String']>;
+ created_at?: InputMaybe<Scalars['timestamptz']>;
+}>;
+
+
+export type InsertPersonMutation = { __typename?: 'mutation_root', insert_people?: { __typename?: 'people_mutation_response', affected_rows: number, returning: Array<{ __typename?: 'people', city?: string | null, email?: string | null, firstname?: string | null, id: any, lastname?: string | null, phone?: string | null, created_at: any, company?: { __typename?: 'companies', domain_name?: string | null, name?: string | null, id: any } | null }> } | null };
+
+export type DeletePeopleMutationVariables = Exact<{
+ ids?: InputMaybe<Array<Scalars['uuid']> | Scalars['uuid']>;
+}>;
+
+
+export type DeletePeopleMutation = { __typename?: 'mutation_root', delete_people?: { __typename?: 'people_mutation_response', returning: Array<{ __typename?: 'people', city?: string | null, email?: string | null, firstname?: string | null, id: any, lastname?: string | null, phone?: string | null, created_at: any, company?: { __typename?: 'companies', domain_name?: string | null, name?: string | null, id: any } | null }> } | null };
+
+export type GetCurrentUserQueryVariables = Exact<{
+ uuid?: InputMaybe<Scalars['uuid']>;
+}>;
+
+
+export type GetCurrentUserQuery = { __typename?: 'query_root', users: Array<{ __typename?: 'users', id: any, email?: any | null, displayName: string, workspace_member?: { __typename?: 'workspace_members', workspace: { __typename?: 'workspaces', id: any, domain_name: string, display_name: string, logo?: string | null } } | null }> };
export const GetCompaniesDocument = gql`
- query GetCompanies($orderBy: [companies_order_by!]) {
- companies(order_by: $orderBy) {
+ query GetCompanies($orderBy: [companies_order_by!], $where: companies_bool_exp) {
+ companies(order_by: $orderBy, where: $where) {
id
domain_name
name
@@ -5068,6 +5135,7 @@ export const GetCompaniesDocument = gql`
* const { data, loading, error } = useGetCompaniesQuery({
* variables: {
* orderBy: // value for 'orderBy'
+ * where: // value for 'where'
* },
* });
*/
@@ -5083,10 +5151,10 @@ export type GetCompaniesQueryHookResult = ReturnType<typeof useGetCompaniesQuery
export type GetCompaniesLazyQueryHookResult = ReturnType<typeof useGetCompaniesLazyQuery>;
export type GetCompaniesQueryResult = Apollo.QueryResult<GetCompaniesQuery, GetCompaniesQueryVariables>;
export const UpdateCompanyDocument = gql`
- mutation UpdateCompany($id: uuid, $name: String, $domain_name: String, $account_owner_id: uuid, $address: String, $employees: Int) {
+ mutation UpdateCompany($id: uuid, $name: String, $domain_name: String, $account_owner_id: uuid, $created_at: timestamptz, $address: String, $employees: numeric) {
update_companies(
where: {id: {_eq: $id}}
- _set: {account_owner_id: $account_owner_id, address: $address, domain_name: $domain_name, employees: $employees, name: $name}
+ _set: {account_owner_id: $account_owner_id, address: $address, domain_name: $domain_name, employees: $employees, name: $name, created_at: $created_at}
) {
affected_rows
returning {
@@ -5124,6 +5192,7 @@ export type UpdateCompanyMutationFn = Apollo.MutationFunction<UpdateCompanyMutat
* name: // value for 'name'
* domain_name: // value for 'domain_name'
* account_owner_id: // value for 'account_owner_id'
+ * created_at: // value for 'created_at'
* address: // value for 'address'
* employees: // value for 'employees'
* },
@@ -5136,9 +5205,98 @@ export function useUpdateCompanyMutation(baseOptions?: Apollo.MutationHookOption
export type UpdateCompanyMutationHookResult = ReturnType<typeof useUpdateCompanyMutation>;
export type UpdateCompanyMutationResult = Apollo.MutationResult<UpdateCompanyMutation>;
export type UpdateCompanyMutationOptions = Apollo.BaseMutationOptions<UpdateCompanyMutation, UpdateCompanyMutationVariables>;
+export const InsertCompanyDocument = gql`
+ mutation InsertCompany($id: uuid, $name: String, $domain_name: String, $account_owner_id: uuid, $created_at: timestamptz, $address: String, $employees: numeric) {
+ insert_companies(
+ objects: {id: $id, name: $name, domain_name: $domain_name, account_owner_id: $account_owner_id, created_at: $created_at, address: $address, employees: $employees}
+ ) {
+ affected_rows
+ returning {
+ address
+ created_at
+ domain_name
+ employees
+ id
+ name
+ }
+ }
+}
+ `;
+export type InsertCompanyMutationFn = Apollo.MutationFunction<InsertCompanyMutation, InsertCompanyMutationVariables>;
+
+/**
+ * __useInsertCompanyMutation__
+ *
+ * To run a mutation, you first call `useInsertCompanyMutation` within a React component and pass it any options that fit your needs.
+ * When your component renders, `useInsertCompanyMutation` returns a tuple that includes:
+ * - A mutate function that you can call at any time to execute the mutation
+ * - An object with fields that represent the current status of the mutation's execution
+ *
+ * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
+ *
+ * @example
+ * const [insertCompanyMutation, { data, loading, error }] = useInsertCompanyMutation({
+ * variables: {
+ * id: // value for 'id'
+ * name: // value for 'name'
+ * domain_name: // value for 'domain_name'
+ * account_owner_id: // value for 'account_owner_id'
+ * created_at: // value for 'created_at'
+ * address: // value for 'address'
+ * employees: // value for 'employees'
+ * },
+ * });
+ */
+export function useInsertCompanyMutation(baseOptions?: Apollo.MutationHookOptions<InsertCompanyMutation, InsertCompanyMutationVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useMutation<InsertCompanyMutation, InsertCompanyMutationVariables>(InsertCompanyDocument, options);
+ }
+export type InsertCompanyMutationHookResult = ReturnType<typeof useInsertCompanyMutation>;
+export type InsertCompanyMutationResult = Apollo.MutationResult<InsertCompanyMutation>;
+export type InsertCompanyMutationOptions = Apollo.BaseMutationOptions<InsertCompanyMutation, InsertCompanyMutationVariables>;
+export const DeleteCompaniesDocument = gql`
+ mutation DeleteCompanies($ids: [uuid!]) {
+ delete_companies(where: {id: {_in: $ids}}) {
+ returning {
+ address
+ created_at
+ domain_name
+ employees
+ id
+ name
+ }
+ }
+}
+ `;
+export type DeleteCompaniesMutationFn = Apollo.MutationFunction<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>;
+
+/**
+ * __useDeleteCompaniesMutation__
+ *
+ * To run a mutation, you first call `useDeleteCompaniesMutation` within a React component and pass it any options that fit your needs.
+ * When your component renders, `useDeleteCompaniesMutation` returns a tuple that includes:
+ * - A mutate function that you can call at any time to execute the mutation
+ * - An object with fields that represent the current status of the mutation's execution
+ *
+ * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
+ *
+ * @example
+ * const [deleteCompaniesMutation, { data, loading, error }] = useDeleteCompaniesMutation({
+ * variables: {
+ * ids: // value for 'ids'
+ * },
+ * });
+ */
+export function useDeleteCompaniesMutation(baseOptions?: Apollo.MutationHookOptions<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useMutation<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>(DeleteCompaniesDocument, options);
+ }
+export type DeleteCompaniesMutationHookResult = ReturnType<typeof useDeleteCompaniesMutation>;
+export type DeleteCompaniesMutationResult = Apollo.MutationResult<DeleteCompaniesMutation>;
+export type DeleteCompaniesMutationOptions = Apollo.BaseMutationOptions<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>;
export const GetPeopleDocument = gql`
- query GetPeople($orderBy: [people_order_by!]) {
- people(order_by: $orderBy) {
+ query GetPeople($orderBy: [people_order_by!], $where: people_bool_exp, $limit: Int) {
+ people(order_by: $orderBy, where: $where, limit: $limit) {
id
phone
email
@@ -5168,6 +5326,8 @@ export const GetPeopleDocument = gql`
* const { data, loading, error } = useGetPeopleQuery({
* variables: {
* orderBy: // value for 'orderBy'
+ * where: // value for 'where'
+ * limit: // value for 'limit'
* },
* });
*/
@@ -5183,10 +5343,10 @@ export type GetPeopleQueryHookResult = ReturnType<typeof useGetPeopleQuery>;
export type GetPeopleLazyQueryHookResult = ReturnType<typeof useGetPeopleLazyQuery>;
export type GetPeopleQueryResult = Apollo.QueryResult<GetPeopleQuery, GetPeopleQueryVariables>;
export const UpdatePeopleDocument = gql`
- mutation UpdatePeople($id: uuid, $firstname: String, $lastname: String, $phone: String, $city: String, $company_id: uuid, $email: String) {
+ mutation UpdatePeople($id: uuid, $firstname: String, $lastname: String, $phone: String, $city: String, $company_id: uuid, $email: String, $created_at: timestamptz) {
update_people(
where: {id: {_eq: $id}}
- _set: {city: $city, company_id: $company_id, email: $email, firstname: $firstname, id: $id, lastname: $lastname, phone: $phone}
+ _set: {city: $city, company_id: $company_id, email: $email, firstname: $firstname, id: $id, lastname: $lastname, phone: $phone, created_at: $created_at}
) {
returning {
city
@@ -5200,6 +5360,7 @@ export const UpdatePeopleDocument = gql`
id
lastname
phone
+ created_at
}
}
}
@@ -5226,6 +5387,7 @@ export type UpdatePeopleMutationFn = Apollo.MutationFunction<UpdatePeopleMutatio
* city: // value for 'city'
* company_id: // value for 'company_id'
* email: // value for 'email'
+ * created_at: // value for 'created_at'
* },
* });
*/
@@ -5235,4 +5397,151 @@ export function useUpdatePeopleMutation(baseOptions?: Apollo.MutationHookOptions
}
export type UpdatePeopleMutationHookResult = ReturnType<typeof useUpdatePeopleMutation>;
export type UpdatePeopleMutationResult = Apollo.MutationResult<UpdatePeopleMutation>;
-export type UpdatePeopleMutationOptions = Apollo.BaseMutationOptions<UpdatePeopleMutation, UpdatePeopleMutationVariables>;
\ No newline at end of file
+export type UpdatePeopleMutationOptions = Apollo.BaseMutationOptions<UpdatePeopleMutation, UpdatePeopleMutationVariables>;
+export const InsertPersonDocument = gql`
+ mutation InsertPerson($id: uuid, $firstname: String, $lastname: String, $phone: String, $city: String, $company_id: uuid, $email: String, $created_at: timestamptz) {
+ insert_people(
+ objects: {id: $id, firstname: $firstname, lastname: $lastname, phone: $phone, city: $city, company_id: $company_id, email: $email, created_at: $created_at}
+ ) {
+ affected_rows
+ returning {
+ city
+ company {
+ domain_name
+ name
+ id
+ }
+ email
+ firstname
+ id
+ lastname
+ phone
+ created_at
+ }
+ }
+}
+ `;
+export type InsertPersonMutationFn = Apollo.MutationFunction<InsertPersonMutation, InsertPersonMutationVariables>;
+
+/**
+ * __useInsertPersonMutation__
+ *
+ * To run a mutation, you first call `useInsertPersonMutation` within a React component and pass it any options that fit your needs.
+ * When your component renders, `useInsertPersonMutation` returns a tuple that includes:
+ * - A mutate function that you can call at any time to execute the mutation
+ * - An object with fields that represent the current status of the mutation's execution
+ *
+ * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
+ *
+ * @example
+ * const [insertPersonMutation, { data, loading, error }] = useInsertPersonMutation({
+ * variables: {
+ * id: // value for 'id'
+ * firstname: // value for 'firstname'
+ * lastname: // value for 'lastname'
+ * phone: // value for 'phone'
+ * city: // value for 'city'
+ * company_id: // value for 'company_id'
+ * email: // value for 'email'
+ * created_at: // value for 'created_at'
+ * },
+ * });
+ */
+export function useInsertPersonMutation(baseOptions?: Apollo.MutationHookOptions<InsertPersonMutation, InsertPersonMutationVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useMutation<InsertPersonMutation, InsertPersonMutationVariables>(InsertPersonDocument, options);
+ }
+export type InsertPersonMutationHookResult = ReturnType<typeof useInsertPersonMutation>;
+export type InsertPersonMutationResult = Apollo.MutationResult<InsertPersonMutation>;
+export type InsertPersonMutationOptions = Apollo.BaseMutationOptions<InsertPersonMutation, InsertPersonMutationVariables>;
+export const DeletePeopleDocument = gql`
+ mutation DeletePeople($ids: [uuid!]) {
+ delete_people(where: {id: {_in: $ids}}) {
+ returning {
+ city
+ company {
+ domain_name
+ name
+ id
+ }
+ email
+ firstname
+ id
+ lastname
+ phone
+ created_at
+ }
+ }
+}
+ `;
+export type DeletePeopleMutationFn = Apollo.MutationFunction<DeletePeopleMutation, DeletePeopleMutationVariables>;
+
+/**
+ * __useDeletePeopleMutation__
+ *
+ * To run a mutation, you first call `useDeletePeopleMutation` within a React component and pass it any options that fit your needs.
+ * When your component renders, `useDeletePeopleMutation` returns a tuple that includes:
+ * - A mutate function that you can call at any time to execute the mutation
+ * - An object with fields that represent the current status of the mutation's execution
+ *
+ * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
+ *
+ * @example
+ * const [deletePeopleMutation, { data, loading, error }] = useDeletePeopleMutation({
+ * variables: {
+ * ids: // value for 'ids'
+ * },
+ * });
+ */
+export function useDeletePeopleMutation(baseOptions?: Apollo.MutationHookOptions<DeletePeopleMutation, DeletePeopleMutationVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useMutation<DeletePeopleMutation, DeletePeopleMutationVariables>(DeletePeopleDocument, options);
+ }
+export type DeletePeopleMutationHookResult = ReturnType<typeof useDeletePeopleMutation>;
+export type DeletePeopleMutationResult = Apollo.MutationResult<DeletePeopleMutation>;
+export type DeletePeopleMutationOptions = Apollo.BaseMutationOptions<DeletePeopleMutation, DeletePeopleMutationVariables>;
+export const GetCurrentUserDocument = gql`
+ query GetCurrentUser($uuid: uuid) {
+ users(where: {id: {_eq: $uuid}}) {
+ id
+ email
+ displayName
+ workspace_member {
+ workspace {
+ id
+ domain_name
+ display_name
+ logo
+ }
+ }
+ }
+}
+ `;
+
+/**
+ * __useGetCurrentUserQuery__
+ *
+ * To run a query within a React component, call `useGetCurrentUserQuery` and pass it any options that fit your needs.
+ * When your component renders, `useGetCurrentUserQuery` 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 } = useGetCurrentUserQuery({
+ * variables: {
+ * uuid: // value for 'uuid'
+ * },
+ * });
+ */
+export function useGetCurrentUserQuery(baseOptions?: Apollo.QueryHookOptions<GetCurrentUserQuery, GetCurrentUserQueryVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useQuery<GetCurrentUserQuery, GetCurrentUserQueryVariables>(GetCurrentUserDocument, options);
+ }
+export function useGetCurrentUserLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetCurrentUserQuery, GetCurrentUserQueryVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useLazyQuery<GetCurrentUserQuery, GetCurrentUserQueryVariables>(GetCurrentUserDocument, options);
+ }
+export type GetCurrentUserQueryHookResult = ReturnType<typeof useGetCurrentUserQuery>;
+export type GetCurrentUserLazyQueryHookResult = ReturnType<typeof useGetCurrentUserLazyQuery>;
+export type GetCurrentUserQueryResult = Apollo.QueryResult<GetCurrentUserQuery, GetCurrentUserQueryVariables>;
\ No newline at end of file
diff --git a/front/src/interfaces/entities/__tests__/company.interface.test.ts b/front/src/interfaces/entities/__tests__/company.interface.test.ts
index cabead90be1..6f7a2d20cc8 100644
--- a/front/src/interfaces/entities/__tests__/company.interface.test.ts
+++ b/front/src/interfaces/entities/__tests__/company.interface.test.ts
@@ -15,7 +15,7 @@ describe('Company mappers', () => {
name: 'ACME',
domain_name: 'exmaple.com',
created_at: now.toUTCString(),
- employees: '10',
+ employees: 10,
address: '1 Infinite Loop, 95014 Cupertino, California, USA',
account_owner: {
id: '7af20dea-0412-4c4c-8b13-d6f0e6e09e87',
@@ -61,7 +61,7 @@ describe('Company mappers', () => {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
name: 'ACME',
domainName: 'example.com',
- employees: '10',
+ employees: 10,
address: '1 Infinite Loop, 95014 Cupertino, California, USA',
pipes: [],
accountOwner: {
diff --git a/front/src/interfaces/entities/company.interface.ts b/front/src/interfaces/entities/company.interface.ts
index 12d4d932c66..5225601b434 100644
--- a/front/src/interfaces/entities/company.interface.ts
+++ b/front/src/interfaces/entities/company.interface.ts
@@ -7,7 +7,7 @@ export type Company = {
id: string;
name?: string;
domainName?: string;
- employees?: string;
+ employees?: number | null;
address?: string;
creationDate?: Date;
@@ -20,7 +20,7 @@ export type GraphqlQueryCompany = {
id: string;
name?: string;
domain_name?: string;
- employees?: string;
+ employees?: number | null;
address?: string;
created_at?: string;
@@ -34,7 +34,7 @@ export type GraphqlMutationCompany = {
id: string;
name?: string;
domain_name?: string;
- employees?: string;
+ employees?: number | null;
address?: string;
created_at?: string;
diff --git a/front/src/pages/companies/Companies.tsx b/front/src/pages/companies/Companies.tsx
index a568d8f6d4d..e4f4987b69d 100644
--- a/front/src/pages/companies/Companies.tsx
+++ b/front/src/pages/companies/Companies.tsx
@@ -65,7 +65,7 @@ function Companies() {
id: uuidv4(),
name: '',
domainName: '',
- employees: '0',
+ employees: null,
address: '',
pipes: [],
creationDate: new Date(),
diff --git a/front/src/pages/companies/__tests__/__data__/mock-data.ts b/front/src/pages/companies/__tests__/__data__/mock-data.ts
index 45c85391e2a..18e1b944747 100644
--- a/front/src/pages/companies/__tests__/__data__/mock-data.ts
+++ b/front/src/pages/companies/__tests__/__data__/mock-data.ts
@@ -7,7 +7,7 @@ export const mockCompaniesData: Array<GraphqlQueryCompany> = [
name: 'Airbnb',
created_at: '2023-04-26T10:08:54.724515+00:00',
address: '17 rue de clignancourt',
- employees: '12',
+ employees: 12,
account_owner: null,
__typename: 'companies',
},
@@ -17,7 +17,7 @@ export const mockCompaniesData: Array<GraphqlQueryCompany> = [
name: 'Aircall',
created_at: '2023-04-26T10:12:42.33625+00:00',
address: '',
- employees: '1',
+ employees: 1,
account_owner: null,
__typename: 'companies',
},
@@ -27,7 +27,7 @@ export const mockCompaniesData: Array<GraphqlQueryCompany> = [
name: 'Algolia',
created_at: '2023-04-26T10:10:32.530184+00:00',
address: '',
- employees: '1',
+ employees: 1,
account_owner: null,
__typename: 'companies',
},
@@ -37,7 +37,7 @@ export const mockCompaniesData: Array<GraphqlQueryCompany> = [
name: 'Apple',
created_at: '2023-03-21T06:30:25.39474+00:00',
address: '',
- employees: '10',
+ employees: 10,
account_owner: null,
__typename: 'companies',
},
@@ -47,7 +47,7 @@ export const mockCompaniesData: Array<GraphqlQueryCompany> = [
name: 'BeReal',
created_at: '2023-04-26T10:13:29.712485+00:00',
address: '10 rue de la Paix',
- employees: '1',
+ employees: 1,
account_owner: null,
__typename: 'companies',
},
@@ -57,7 +57,7 @@ export const mockCompaniesData: Array<GraphqlQueryCompany> = [
name: 'Claap',
created_at: '2023-04-26T10:09:25.656555+00:00',
address: '',
- employees: '1',
+ employees: 1,
account_owner: null,
__typename: 'companies',
},
diff --git a/front/src/pages/companies/companies-columns.tsx b/front/src/pages/companies/companies-columns.tsx
index 5794d0ddb1a..93ff8fb5a5d 100644
--- a/front/src/pages/companies/companies-columns.tsx
+++ b/front/src/pages/companies/companies-columns.tsx
@@ -75,11 +75,17 @@ export const useCompaniesColumns = () => {
),
cell: (props) => (
<EditableText
- content={props.row.original.employees || ''}
+ content={props.row.original.employees?.toString() || ''}
changeHandler={(value) => {
const company = props.row.original;
- company.employees = value;
- updateCompany(company);
+
+ if (value === '') {
+ company.employees = null;
+ updateCompany(company);
+ } else if (!Number.isNaN(Number(value))) {
+ company.employees = Number(value);
+ updateCompany(company);
+ }
}}
/>
),
diff --git a/front/src/services/api/companies/update.ts b/front/src/services/api/companies/update.ts
index c7a2698148a..49013ddfb00 100644
--- a/front/src/services/api/companies/update.ts
+++ b/front/src/services/api/companies/update.ts
@@ -13,7 +13,7 @@ export const UPDATE_COMPANY = gql`
$account_owner_id: uuid
$created_at: timestamptz
$address: String
- $employees: Int
+ $employees: numeric
) {
update_companies(
where: { id: { _eq: $id } }
@@ -52,7 +52,7 @@ export const INSERT_COMPANY = gql`
$account_owner_id: uuid
$created_at: timestamptz
$address: String
- $employees: Int
+ $employees: numeric
) {
insert_companies(
objects: {
@@ -79,7 +79,7 @@ export const INSERT_COMPANY = gql`
`;
export const DELETE_COMPANIES = gql`
- mutation DeleteCompanies($ids: [uuid]) {
+ mutation DeleteCompanies($ids: [uuid!]) {
delete_companies(where: { id: { _in: $ids } }) {
returning {
address
diff --git a/front/src/services/api/people/update.ts b/front/src/services/api/people/update.ts
index 33c3d77cbe1..8f3935d05c3 100644
--- a/front/src/services/api/people/update.ts
+++ b/front/src/services/api/people/update.ts
@@ -90,7 +90,7 @@ export const INSERT_PERSON = gql`
`;
export const DELETE_PEOPLE = gql`
- mutation DeletePeople($ids: [uuid]) {
+ mutation DeletePeople($ids: [uuid!]) {
delete_people(where: { id: { _in: $ids } }) {
returning {
city
diff --git a/front/src/services/api/search/search.ts b/front/src/services/api/search/search.ts
index 43b4b188b9d..8d3d79d553b 100644
--- a/front/src/services/api/search/search.ts
+++ b/front/src/services/api/search/search.ts
@@ -4,7 +4,7 @@ import { SearchConfigType } from '../../../interfaces/search/interface';
import { AnyEntity } from '../../../interfaces/entities/generic.interface';
export const SEARCH_PEOPLE_QUERY = gql`
- query SearchQuery($where: people_bool_exp, $limit: Int) {
+ query SearchPeopleQuery($where: people_bool_exp, $limit: Int) {
searchResults: people(where: $where, limit: $limit) {
id
phone
@@ -18,7 +18,7 @@ export const SEARCH_PEOPLE_QUERY = gql`
`;
export const SEARCH_USER_QUERY = gql`
- query SearchQuery($where: users_bool_exp, $limit: Int) {
+ query SearchUserQuery($where: users_bool_exp, $limit: Int) {
searchResults: users(where: $where, limit: $limit) {
id
email
@@ -26,10 +26,12 @@ export const SEARCH_USER_QUERY = gql`
}
}
`;
-
+// TODO: remove this query
export const EMPTY_QUERY = gql`
query EmptyQuery {
- _
+ users {
+ id
+ }
}
`;
diff --git a/hasura/migrations/default/1684486726911_alter_table_public_companies_alter_column_employees/down.sql b/hasura/migrations/default/1684486726911_alter_table_public_companies_alter_column_employees/down.sql
new file mode 100644
index 00000000000..0b719974b18
--- /dev/null
+++ b/hasura/migrations/default/1684486726911_alter_table_public_companies_alter_column_employees/down.sql
@@ -0,0 +1,2 @@
+alter table "public"."companies" alter column "employees" set not null;
+alter table "public"."companies" alter column "employees" set default '1';
diff --git a/hasura/migrations/default/1684486726911_alter_table_public_companies_alter_column_employees/up.sql b/hasura/migrations/default/1684486726911_alter_table_public_companies_alter_column_employees/up.sql
new file mode 100644
index 00000000000..7fa9a2bccf0
--- /dev/null
+++ b/hasura/migrations/default/1684486726911_alter_table_public_companies_alter_column_employees/up.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "public"."companies" ALTER COLUMN "employees" drop default;
+alter table "public"."companies" alter column "employees" drop not null;
diff --git a/hasura/migrations/default/1684487555948_alter_table_public_companies_alter_column_employees/down.sql b/hasura/migrations/default/1684487555948_alter_table_public_companies_alter_column_employees/down.sql
new file mode 100644
index 00000000000..ac7b197ccd6
--- /dev/null
+++ b/hasura/migrations/default/1684487555948_alter_table_public_companies_alter_column_employees/down.sql
@@ -0,0 +1 @@
+ALTER TABLE "public"."companies" ALTER COLUMN "employees" TYPE integer;
diff --git a/hasura/migrations/default/1684487555948_alter_table_public_companies_alter_column_employees/up.sql b/hasura/migrations/default/1684487555948_alter_table_public_companies_alter_column_employees/up.sql
new file mode 100644
index 00000000000..f75910cb1a8
--- /dev/null
+++ b/hasura/migrations/default/1684487555948_alter_table_public_companies_alter_column_employees/up.sql
@@ -0,0 +1 @@
+ALTER TABLE "public"."companies" ALTER COLUMN "employees" TYPE numeric;