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
+10 -10
View File
@@ -1,8 +1,8 @@
import { QueryResult, gql, useQuery } from '@apollo/client';
import {
Order_By,
Companies_Order_By,
Companies_Bool_Exp,
SortOrder as Order_By,
CompanyOrderByWithRelationInput as Companies_Order_By,
CompanyWhereInput as Companies_Bool_Exp,
} from '../../../generated/graphql';
import { GraphqlQueryCompany } from '../../../interfaces/entities/company.interface';
import { SelectedSortType } from '../../../interfaces/sorts/interface';
@@ -11,17 +11,17 @@ export type CompaniesSelectedSortType = SelectedSortType<Companies_Order_By>;
export const GET_COMPANIES = gql`
query GetCompanies(
$orderBy: [companies_order_by!]
$where: companies_bool_exp
$orderBy: [CompanyOrderByWithRelationInput!]
$where: CompanyWhereInput
) {
companies(order_by: $orderBy, where: $where) {
companies(orderBy: $orderBy, where: $where) {
id
domain_name
domain_name: domainName
name
created_at
created_at: createdAt
address
employees
account_owner {
account_owner: accountOwner {
id
email
displayName
@@ -41,6 +41,6 @@ export function useCompaniesQuery(
export const defaultOrderBy: Companies_Order_By[] = [
{
created_at: Order_By.Desc,
createdAt: Order_By.Desc,
},
];
+44 -56
View File
@@ -7,88 +7,76 @@ import { apiClient } from '../../../apollo';
export const UPDATE_COMPANY = gql`
mutation UpdateCompany(
$id: uuid
$id: String
$name: String
$domain_name: String
$account_owner_id: uuid
$created_at: timestamptz
$account_owner_id: String
$created_at: DateTime
$address: String
$employees: numeric
$employees: Int
) {
update_companies(
where: { id: { _eq: $id } }
_set: {
account_owner_id: $account_owner_id
address: $address
domain_name: $domain_name
employees: $employees
name: $name
created_at: $created_at
updateOneCompany(
where: { id: $id }
data: {
accountOwner: { connect: { id: $account_owner_id } }
address: { set: $address }
domainName: { set: $domain_name }
employees: { set: $employees }
name: { set: $name }
createdAt: { set: $created_at }
}
) {
affected_rows
returning {
account_owner {
id
email
displayName
}
address
created_at
domain_name
employees
accountOwner {
id
name
email
display_name: displayName
}
address
created_at: createdAt
domain_name: domainName
employees
id
name
}
}
`;
export const INSERT_COMPANY = gql`
mutation InsertCompany(
$id: uuid
$name: String
$domain_name: String
$account_owner_id: uuid
$created_at: timestamptz
$address: String
$employees: numeric
$id: String!
$name: String!
$domain_name: String!
$account_owner_id: String
$created_at: DateTime
$address: String!
$employees: Int
) {
insert_companies(
objects: {
createOneCompany(
data: {
id: $id
name: $name
domain_name: $domain_name
account_owner_id: $account_owner_id
created_at: $created_at
domainName: $domain_name
accountOwner: { connect: { id: $account_owner_id } }
createdAt: $created_at
address: $address
employees: $employees
workspace: { connect: { id: "il faut rajouter l'id du workspace" } }
}
) {
affected_rows
returning {
address
created_at
domain_name
employees
id
name
}
address
created_at: createdAt
domain_name: domainName
employees
id
name
}
}
`;
export const DELETE_COMPANIES = gql`
mutation DeleteCompanies($ids: [uuid!]) {
delete_companies(where: { id: { _in: $ids } }) {
returning {
address
created_at
domain_name
employees
id
name
}
mutation DeleteCompanies($ids: [String!]) {
deleteManyCompany(where: { id: { in: $ids } }) {
count
}
}
`;
+9 -9
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,
},
];
+50 -67
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
}
}
`;
+8 -8
View File
@@ -7,22 +7,22 @@ import {
} from '../../../interfaces/entities/generic.interface';
export const SEARCH_PEOPLE_QUERY = gql`
query SearchPeopleQuery($where: people_bool_exp, $limit: Int) {
searchResults: people(where: $where, limit: $limit) {
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
searchResults: people(where: $where, take: $limit) {
id
phone
email
city
firstname
lastname
created_at
createdAt
}
}
`;
export const SEARCH_USER_QUERY = gql`
query SearchUserQuery($where: users_bool_exp, $limit: Int) {
searchResults: users(where: $where, limit: $limit) {
query SearchUserQuery($where: UserWhereInput, $limit: Int) {
searchResults: users(where: $where, take: $limit) {
id
email
displayName
@@ -39,11 +39,11 @@ export const EMPTY_QUERY = gql`
`;
export const SEARCH_COMPANY_QUERY = gql`
query SearchQuery($where: companies_bool_exp, $limit: Int) {
searchResults: companies(where: $where, limit: $limit) {
query SearchQuery($where: CompanyWhereInput, $limit: Int) {
searchResults: companies(where: $where, take: $limit) {
id
name
domain_name
domain_name: domainName
}
}
`;
+5 -6
View File
@@ -2,17 +2,16 @@ import { QueryResult, gql, useQuery } from '@apollo/client';
import { GraphqlQueryUser } from '../../../interfaces/entities/user.interface';
export const GET_CURRENT_USER = gql`
query GetCurrentUser($uuid: uuid) {
users(where: { id: { _eq: $uuid } }) {
query GetCurrentUser($uuid: String) {
users(where: { id: { equals: $uuid } }) {
id
email
displayName
workspace_member {
workspace_member: workspaceMember {
workspace {
id
domain_name
display_name
logo
domain_name: domainName
display_name: displayName
}
}
}
+9
View File
@@ -0,0 +1,9 @@
import { gql } from '@apollo/client';
export const GET_CURRENT_USER = gql`
query getUsers {
users {
id
}
}
`;