Remove hasura and hasura-auth (#134)

* Remove hasura and hasura-auth

* Move all models to prisma

* Start implementing graphql

* chore: clean package json

* chore: make the code build

* chore: get initial graphql.tsx file

* feature: use typegql as qgl server

* refactor: small refactoring

* refactor: clean tests

* bugfix: make all filters not case sensitive

* chore: remove unused imports

---------

Co-authored-by: Sammy Teillet <sammy.teillet@gmail.com>
This commit is contained in:
Charles Bochet
2023-05-24 17:20:15 +02:00
committed by GitHub
parent 7192457d0a
commit 5d06398d2e
177 changed files with 12215 additions and 7040 deletions

View File

@ -1,9 +1,9 @@
import { QueryResult, gql, useQuery } from '@apollo/client';
import { GraphqlQueryPerson } from '../../../interfaces/entities/person.interface';
import {
Order_By,
People_Bool_Exp,
People_Order_By,
PersonWhereInput as People_Bool_Exp,
PersonOrderByWithRelationInput as People_Order_By,
SortOrder,
} from '../../../generated/graphql';
import { SelectedSortType } from '../../../interfaces/sorts/interface';
@ -11,22 +11,22 @@ export type PeopleSelectedSortType = SelectedSortType<People_Order_By>;
export const GET_PEOPLE = gql`
query GetPeople(
$orderBy: [people_order_by!]
$where: people_bool_exp
$orderBy: [PersonOrderByWithRelationInput!]
$where: PersonWhereInput
$limit: Int
) {
people(order_by: $orderBy, where: $where, limit: $limit) {
people(orderBy: $orderBy, where: $where, take: $limit) {
id
phone
email
city
firstname
lastname
created_at
created_at: createdAt
company {
id
name
domain_name
domain_name: domainName
}
}
}
@ -43,6 +43,6 @@ export function usePeopleQuery(
export const defaultOrderBy: People_Order_By[] = [
{
created_at: Order_By.Desc,
createdAt: SortOrder.Desc,
},
];

View File

@ -7,105 +7,88 @@ import { apiClient } from '../../../apollo';
export const UPDATE_PERSON = gql`
mutation UpdatePeople(
$id: uuid
$id: String
$firstname: String
$lastname: String
$phone: String
$city: String
$company_id: uuid
$company_id: String
$email: String
$created_at: timestamptz
$created_at: DateTime
) {
update_people(
where: { id: { _eq: $id } }
_set: {
city: $city
company_id: $company_id
email: $email
firstname: $firstname
id: $id
lastname: $lastname
phone: $phone
created_at: $created_at
updateOnePerson(
where: { id: $id }
data: {
city: { set: $city }
company: { connect: { id: $company_id } }
email: { set: $email }
firstname: { set: $firstname }
id: { set: $id }
lastname: { set: $lastname }
phone: { set: $phone }
createdAt: { set: $created_at }
}
) {
returning {
city
company {
domain_name
name
id
}
email
firstname
city
company {
domain_name: domainName
name
id
lastname
phone
created_at
}
email
firstname
id
lastname
phone
created_at: createdAt
}
}
`;
export const INSERT_PERSON = gql`
mutation InsertPerson(
$id: uuid
$firstname: String
$lastname: String
$phone: String
$city: String
$company_id: uuid
$email: String
$created_at: timestamptz
$id: String!
$firstname: String!
$lastname: String!
$phone: String!
$city: String!
$company_id: String
$email: String!
$created_at: DateTime
) {
insert_people(
objects: {
createOnePerson(
data: {
id: $id
firstname: $firstname
lastname: $lastname
phone: $phone
city: $city
company_id: $company_id
company: { connect: { id: $company_id } }
email: $email
created_at: $created_at
createdAt: $created_at
workspace: { connect: { id: "il faut rajouter l'id du workspace" } }
}
) {
affected_rows
returning {
city
company {
domain_name
name
id
}
email
firstname
city
company {
domain_name: domainName
name
id
lastname
phone
created_at
}
email
firstname
id
lastname
phone
created_at: createdAt
}
}
`;
export const DELETE_PEOPLE = 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
}
mutation DeletePeople($ids: [String!]) {
deleteManyPerson(where: { id: { in: $ids } }) {
count
}
}
`;