mirror of
https://github.com/lingble/twenty.git
synced 2025-10-29 20:02:29 +00:00
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:
16
.vscode/up.sh
vendored
16
.vscode/up.sh
vendored
@@ -15,20 +15,4 @@ done
|
||||
|
||||
echo "Postgres is accepting connections!"
|
||||
|
||||
docker-compose up -d twenty-hasura
|
||||
|
||||
while ! curl -s http://localhost:8080/healthz > /dev/null ; do
|
||||
sleep 1
|
||||
echo "Waiting for Hasura to be ready..."
|
||||
done
|
||||
|
||||
docker-compose up -d hasura-auth
|
||||
|
||||
while ! curl -s http://localhost:4000/healthz > /dev/null ; do
|
||||
sleep 1
|
||||
echo "Waiting for Hasura Auth to be ready..."
|
||||
done
|
||||
|
||||
docker-compose exec twenty-hasura hasura deploy
|
||||
|
||||
docker-compose up -d
|
||||
|
||||
@@ -12,7 +12,6 @@ Welcome to Twenty documentation!
|
||||
Twenty development stack is composed of 3 different layers
|
||||
|
||||
- front: our frontend React app
|
||||
- hasura: our graphql engine exposing our database and server
|
||||
- server: our backend that contain endpoint, crm logic, scripts, jobs...
|
||||
- storages: postgres
|
||||
|
||||
@@ -46,7 +45,6 @@ make up
|
||||
Once this is completed you should have:
|
||||
|
||||
- front available on: http://localhost:3001
|
||||
- hasura available on: http://localhost:8080
|
||||
- server available on: http://localhost:3000/health
|
||||
- postgres: available on http://localhost:5432 that should contain `twenty` database
|
||||
|
||||
@@ -65,9 +63,3 @@ If you are using Docker install, make sure to ssh in the docker container during
|
||||
Run tests: `make front-test`
|
||||
Run coverage: `make front-coverage`
|
||||
Run storybook: `make front-storybook`
|
||||
|
||||
### Hasura development
|
||||
|
||||
Open hasura console: `make hasura-console`
|
||||
Do your changes in hasura console on http://localhost:9695
|
||||
Commit your changes in git
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
schema: [
|
||||
{
|
||||
[process.env.HASURA_GRAPHQL_ENDPOINT]: {
|
||||
'http://localhost:3000/graphql': {
|
||||
headers: {
|
||||
'x-hasura-admin-secret': process.env.HASURA_GRAPHQL_ADMIN_SECRET,
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"build-storybook": "storybook build -s public",
|
||||
"coverage": "react-scripts test --coverage --watchAll",
|
||||
"coverage-ci": "react-scripts test --coverage --watchAll=false",
|
||||
"graphql-generate": "REACT_APP_GRAPHQL_ADMIN_SECRET=$REACT_APP_GRAPHQL_ADMIN_SECRET graphql-codegen --config codegen.js"
|
||||
"graphql-codegen": "REACT_APP_GRAPHQL_ADMIN_SECRET=$REACT_APP_GRAPHQL_ADMIN_SECRET graphql-codegen --config codegen.js"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
|
||||
@@ -49,7 +49,7 @@ const mocks = [
|
||||
{
|
||||
request: {
|
||||
query: GET_PEOPLE,
|
||||
variables: { orderBy: [{ created_at: 'desc' }], where: {} },
|
||||
variables: { orderBy: [{ createdAt: 'desc' }], where: {} },
|
||||
},
|
||||
result: {
|
||||
data: {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { onError } from '@apollo/client/link/error';
|
||||
import { refreshAccessToken } from './services/auth/AuthService';
|
||||
|
||||
const apiLink = createHttpLink({
|
||||
uri: `${process.env.REACT_APP_API_URL}/v1/graphql`,
|
||||
uri: `${process.env.REACT_APP_API_URL}`,
|
||||
});
|
||||
|
||||
const withAuthHeadersLink = setContext((_, { headers }) => {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { MockedProvider } from '@apollo/client/testing';
|
||||
import { SEARCH_COMPANY_QUERY } from '../../../services/api/search/search';
|
||||
import styled from '@emotion/styled';
|
||||
import { SearchConfigType } from '../../../interfaces/search/interface';
|
||||
import { QueryMode } from '../../../generated/graphql';
|
||||
|
||||
const component = {
|
||||
title: 'editable-cell/EditableRelation',
|
||||
@@ -41,7 +42,7 @@ const mocks = [
|
||||
request: {
|
||||
query: SEARCH_COMPANY_QUERY,
|
||||
variables: {
|
||||
where: { name: { _ilike: '%%' } },
|
||||
where: { name: { contains: '%%', mode: QueryMode.Insensitive } },
|
||||
limit: 5,
|
||||
},
|
||||
},
|
||||
@@ -92,7 +93,7 @@ EditableRelationStory.args = {
|
||||
searchConfig: {
|
||||
query: SEARCH_COMPANY_QUERY,
|
||||
template: (searchInput: string) => ({
|
||||
name: { _ilike: `%${searchInput}%` },
|
||||
name: { contains: `%${searchInput}%`, mode: QueryMode.Insensitive },
|
||||
}),
|
||||
resultMapper: (company) => ({
|
||||
render: (company) => company.name,
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
SelectedFilterType,
|
||||
} from '../../../../interfaces/filters/interface';
|
||||
import { mockCompaniesData } from '../../../../pages/companies/__tests__/__data__/mock-data';
|
||||
import { QueryMode } from '../../../../generated/graphql';
|
||||
|
||||
const component = {
|
||||
title: 'FilterDropdownButton',
|
||||
@@ -28,7 +29,10 @@ const mocks = [
|
||||
{
|
||||
request: {
|
||||
query: SEARCH_COMPANY_QUERY,
|
||||
variables: { where: { name: { _ilike: '%%' } }, limit: 5 },
|
||||
variables: {
|
||||
where: { name: { contains: '%%', mode: QueryMode.Insensitive } },
|
||||
limit: 5,
|
||||
},
|
||||
},
|
||||
result: {
|
||||
data: {
|
||||
@@ -39,7 +43,10 @@ const mocks = [
|
||||
{
|
||||
request: {
|
||||
query: SEARCH_COMPANY_QUERY,
|
||||
variables: { where: { name: { _ilike: '%Airc%' } }, limit: 5 },
|
||||
variables: {
|
||||
where: { name: { contains: '%Airc%', mode: QueryMode.Insensitive } },
|
||||
limit: 5,
|
||||
},
|
||||
},
|
||||
result: {
|
||||
data: {
|
||||
|
||||
@@ -27,7 +27,7 @@ export const RegularSortAndFilterBar = ({
|
||||
label: 'Is',
|
||||
id: 'is',
|
||||
whereTemplate: (person: Person) => {
|
||||
return { email: { _eq: person.email } };
|
||||
return { email: { equals: person.email } };
|
||||
},
|
||||
},
|
||||
key: 'test_filter',
|
||||
|
||||
@@ -2,7 +2,10 @@ import { ThemeProvider } from '@emotion/react';
|
||||
import { lightTheme } from '../../../../layout/styles/themes';
|
||||
import { SortDropdownButton } from '../SortDropdownButton';
|
||||
import styled from '@emotion/styled';
|
||||
import { Order_By, People_Order_By } from '../../../../generated/graphql';
|
||||
import {
|
||||
SortOrder as Order_By,
|
||||
PersonOrderByWithRelationInput as People_Order_By,
|
||||
} from '../../../../generated/graphql';
|
||||
import { SortType } from '../../../../interfaces/sorts/interface';
|
||||
import {
|
||||
TbBuilding,
|
||||
@@ -52,7 +55,7 @@ const availableSorts = [
|
||||
_type: 'default_sort',
|
||||
},
|
||||
{
|
||||
key: 'created_at',
|
||||
key: 'createdAt',
|
||||
label: 'Created at',
|
||||
icon: <TbCalendar size={16} />,
|
||||
_type: 'default_sort',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Order_By } from '../../../generated/graphql';
|
||||
import { SortOrder as Order_By } from '../../../generated/graphql';
|
||||
import { BoolExpType } from '../../../interfaces/entities/generic.interface';
|
||||
import {
|
||||
FilterableFieldsType,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
Companies_Bool_Exp,
|
||||
People_Bool_Exp,
|
||||
Users_Bool_Exp,
|
||||
CompanyWhereInput as Companies_Bool_Exp,
|
||||
PersonWhereInput as People_Bool_Exp,
|
||||
UserWhereInput as Users_Bool_Exp,
|
||||
} from '../../generated/graphql';
|
||||
import { Company, GraphqlQueryCompany } from './company.interface';
|
||||
import { GraphqlQueryPerson, Person } from './person.interface';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { Order_By } from '../../generated/graphql';
|
||||
import { SortOrder as Order_By } from '../../generated/graphql';
|
||||
|
||||
export type SortType<OrderByTemplate> =
|
||||
| {
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
reduceFiltersToWhere,
|
||||
reduceSortsToOrderBy,
|
||||
} from '../../components/table/table-header/helpers';
|
||||
import { Companies_Order_By } from '../../generated/graphql';
|
||||
import { CompanyOrderByWithRelationInput as Companies_Order_By } from '../../generated/graphql';
|
||||
import ActionBar from '../../components/table/action-bar/ActionBar';
|
||||
import { SelectedFilterType } from '../../interfaces/filters/interface';
|
||||
import { BoolExpType } from '../../interfaces/entities/generic.interface';
|
||||
|
||||
@@ -5,6 +5,7 @@ import { lightTheme } from '../../../layout/styles/themes';
|
||||
import { GET_COMPANIES } from '../../../services/api/companies';
|
||||
import { mockCompaniesData } from '../__tests__/__data__/mock-data';
|
||||
import { MockedProvider } from '@apollo/client/testing';
|
||||
import { QueryMode } from '../../../generated/graphql';
|
||||
|
||||
const component = {
|
||||
title: 'Companies',
|
||||
@@ -18,7 +19,7 @@ const mocks = [
|
||||
request: {
|
||||
query: GET_COMPANIES,
|
||||
variables: {
|
||||
orderBy: [{ created_at: 'desc' }],
|
||||
orderBy: [{ createdAt: 'desc' }],
|
||||
where: {},
|
||||
},
|
||||
},
|
||||
@@ -32,7 +33,7 @@ const mocks = [
|
||||
request: {
|
||||
query: GET_COMPANIES,
|
||||
variables: {
|
||||
orderBy: [{ created_at: 'desc' }],
|
||||
orderBy: [{ createdAt: 'desc' }],
|
||||
where: {},
|
||||
},
|
||||
},
|
||||
@@ -46,8 +47,10 @@ const mocks = [
|
||||
request: {
|
||||
query: GET_COMPANIES,
|
||||
variables: {
|
||||
orderBy: [{ created_at: 'desc' }],
|
||||
where: { domain_name: { _ilike: '%aircal%' } },
|
||||
orderBy: [{ createdAt: 'desc' }],
|
||||
where: {
|
||||
domainName: { contains: '%aircal%', mode: QueryMode.Insensitive },
|
||||
},
|
||||
},
|
||||
},
|
||||
result: {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
exports[`Companies Filter should render the filter company_employees 1`] = `
|
||||
Object {
|
||||
"employees": Object {
|
||||
"_gte": 2,
|
||||
"gte": 2,
|
||||
},
|
||||
}
|
||||
`;
|
||||
@@ -11,7 +11,8 @@ Object {
|
||||
exports[`Companies Filter should render the filter company_name 1`] = `
|
||||
Object {
|
||||
"name": Object {
|
||||
"_ilike": "%name%",
|
||||
"contains": "%name%",
|
||||
"mode": "insensitive",
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
TbSum,
|
||||
TbUser,
|
||||
} from 'react-icons/tb';
|
||||
import { QueryMode } from '../../generated/graphql';
|
||||
|
||||
const columnHelper = createColumnHelper<Company>();
|
||||
|
||||
@@ -178,7 +179,10 @@ export const useCompaniesColumns = () => {
|
||||
{
|
||||
query: SEARCH_USER_QUERY,
|
||||
template: (searchInput: string) => ({
|
||||
displayName: { _ilike: `%${searchInput}%` },
|
||||
displayName: {
|
||||
contains: `%${searchInput}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
}),
|
||||
resultMapper: (accountOwner) => ({
|
||||
render: (accountOwner) => accountOwner.displayName,
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Company } from '../../interfaces/entities/company.interface';
|
||||
import { FilterConfigType } from '../../interfaces/filters/interface';
|
||||
import { SEARCH_USER_QUERY } from '../../services/api/search/search';
|
||||
import { User, mapToUser } from '../../interfaces/entities/user.interface';
|
||||
import { QueryMode } from '../../generated/graphql';
|
||||
|
||||
export const nameFilter = {
|
||||
key: 'company_name',
|
||||
@@ -21,14 +22,21 @@ export const nameFilter = {
|
||||
label: 'Contains',
|
||||
id: 'like',
|
||||
whereTemplate: (searchString) => ({
|
||||
name: { _ilike: `%${searchString}%` },
|
||||
name: { contains: `%${searchString}%`, mode: QueryMode.Insensitive },
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Does not contain',
|
||||
id: 'not_like',
|
||||
whereTemplate: (searchString) => ({
|
||||
_not: { name: { _ilike: `%${searchString}%` } },
|
||||
NOT: [
|
||||
{
|
||||
name: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
@@ -45,7 +53,7 @@ export const employeesFilter = {
|
||||
id: 'greater_than',
|
||||
whereTemplate: (searchString) => ({
|
||||
employees: {
|
||||
_gte: isNaN(Number(searchString)) ? undefined : Number(searchString),
|
||||
gte: isNaN(Number(searchString)) ? undefined : Number(searchString),
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -54,7 +62,7 @@ export const employeesFilter = {
|
||||
id: 'less_than',
|
||||
whereTemplate: (searchString) => ({
|
||||
employees: {
|
||||
_lte: isNaN(Number(searchString)) ? undefined : Number(searchString),
|
||||
lte: isNaN(Number(searchString)) ? undefined : Number(searchString),
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -71,14 +79,24 @@ export const urlFilter = {
|
||||
label: 'Contains',
|
||||
id: 'like',
|
||||
whereTemplate: (searchString) => ({
|
||||
domain_name: { _ilike: `%${searchString}%` },
|
||||
domainName: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Does not contain',
|
||||
id: 'not_like',
|
||||
whereTemplate: (searchString) => ({
|
||||
_not: { domain_name: { _ilike: `%${searchString}%` } },
|
||||
NOT: [
|
||||
{
|
||||
domainName: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
@@ -94,14 +112,21 @@ export const addressFilter = {
|
||||
label: 'Contains',
|
||||
id: 'like',
|
||||
whereTemplate: (searchString) => ({
|
||||
address: { _ilike: `%${searchString}%` },
|
||||
address: { contains: `%${searchString}%`, mode: QueryMode.Insensitive },
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Does not contain',
|
||||
id: 'not_like',
|
||||
whereTemplate: (searchString) => ({
|
||||
_not: { address: { _ilike: `%${searchString}%` } },
|
||||
NOT: [
|
||||
{
|
||||
address: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
@@ -117,8 +142,8 @@ export const creationDateFilter = {
|
||||
label: 'Greater than',
|
||||
id: 'greater_than',
|
||||
whereTemplate: (searchString) => ({
|
||||
created_at: {
|
||||
_gte: searchString,
|
||||
createdAt: {
|
||||
gte: searchString,
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -126,8 +151,8 @@ export const creationDateFilter = {
|
||||
label: 'Less than',
|
||||
id: 'less_than',
|
||||
whereTemplate: (searchString) => ({
|
||||
created_at: {
|
||||
_lte: searchString,
|
||||
createdAt: {
|
||||
lte: searchString,
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -142,7 +167,10 @@ export const accountOwnerFilter = {
|
||||
searchConfig: {
|
||||
query: SEARCH_USER_QUERY,
|
||||
template: (searchString: string) => ({
|
||||
displayName: { _ilike: `%${searchString}%` },
|
||||
displayName: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
}),
|
||||
resultMapper: (data) => ({
|
||||
value: mapToUser(data),
|
||||
@@ -155,14 +183,20 @@ export const accountOwnerFilter = {
|
||||
label: 'Is',
|
||||
id: 'is',
|
||||
whereTemplate: (owner) => ({
|
||||
account_owner: { displayName: { _eq: owner.displayName } },
|
||||
accountOwner: { is: { displayName: { equals: owner.displayName } } },
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Is not',
|
||||
id: 'is_not',
|
||||
whereTemplate: (owner) => ({
|
||||
_not: { account_owner: { displayName: { _eq: owner.displayName } } },
|
||||
NOT: [
|
||||
{
|
||||
accountOwner: {
|
||||
is: { displayName: { equals: owner.displayName } },
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
TbMapPin,
|
||||
TbSum,
|
||||
} from 'react-icons/tb';
|
||||
import { Companies_Order_By } from '../../generated/graphql';
|
||||
import { CompanyOrderByWithRelationInput as Companies_Order_By } from '../../generated/graphql';
|
||||
import { SortType } from '../../interfaces/sorts/interface';
|
||||
|
||||
export const availableSorts = [
|
||||
@@ -22,7 +22,7 @@ export const availableSorts = [
|
||||
_type: 'default_sort',
|
||||
},
|
||||
{
|
||||
key: 'domain_name',
|
||||
key: 'domainName',
|
||||
label: 'Url',
|
||||
icon: <TbLink size={16} />,
|
||||
_type: 'default_sort',
|
||||
@@ -34,7 +34,7 @@ export const availableSorts = [
|
||||
_type: 'default_sort',
|
||||
},
|
||||
{
|
||||
key: 'created_at',
|
||||
key: 'createdAt',
|
||||
label: 'Creation',
|
||||
icon: <TbCalendar size={16} />,
|
||||
_type: 'default_sort',
|
||||
|
||||
@@ -19,7 +19,7 @@ const mocks = [
|
||||
request: {
|
||||
query: GET_PEOPLE,
|
||||
variables: {
|
||||
orderBy: [{ created_at: 'desc' }],
|
||||
orderBy: [{ createdAt: 'desc' }],
|
||||
where: {},
|
||||
},
|
||||
},
|
||||
@@ -33,7 +33,7 @@ const mocks = [
|
||||
request: {
|
||||
query: GET_PEOPLE,
|
||||
variables: {
|
||||
orderBy: [{ created_at: 'desc' }],
|
||||
orderBy: [{ createdAt: 'desc' }],
|
||||
where: {},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
exports[`PeopleFilter should render the filter city which is text search 1`] = `
|
||||
Object {
|
||||
"city": Object {
|
||||
"_ilike": "%Paris%",
|
||||
"contains": "%Paris%",
|
||||
"mode": "insensitive",
|
||||
},
|
||||
}
|
||||
`;
|
||||
@@ -11,8 +12,10 @@ Object {
|
||||
exports[`PeopleFilter should render the filter company_name which relation search 1`] = `
|
||||
Object {
|
||||
"company": Object {
|
||||
"name": Object {
|
||||
"_eq": "test-name",
|
||||
"is": Object {
|
||||
"name": Object {
|
||||
"equals": "test-name",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
TbPhone,
|
||||
TbUser,
|
||||
} from 'react-icons/tb';
|
||||
import { QueryMode } from '../../generated/graphql';
|
||||
|
||||
const columnHelper = createColumnHelper<Person>();
|
||||
|
||||
@@ -118,7 +119,10 @@ export const usePeopleColumns = () => {
|
||||
{
|
||||
query: SEARCH_COMPANY_QUERY,
|
||||
template: (searchInput: string) => ({
|
||||
name: { _ilike: `%${searchInput}%` },
|
||||
name: {
|
||||
contains: `%${searchInput}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
}),
|
||||
resultMapper: (company) => ({
|
||||
render: (company) => company.name,
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
TbPhone,
|
||||
TbUser,
|
||||
} from 'react-icons/tb';
|
||||
import { QueryMode } from '../../generated/graphql';
|
||||
|
||||
export const fullnameFilter = {
|
||||
key: 'fullname',
|
||||
@@ -24,9 +25,19 @@ export const fullnameFilter = {
|
||||
label: 'Contains',
|
||||
id: 'like',
|
||||
whereTemplate: (searchString) => ({
|
||||
_or: [
|
||||
{ firstname: { _ilike: `%${searchString}%` } },
|
||||
{ lastname: { _ilike: `%${searchString}%` } },
|
||||
OR: [
|
||||
{
|
||||
firstname: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
{
|
||||
lastname: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
@@ -34,12 +45,24 @@ export const fullnameFilter = {
|
||||
label: 'Does not contain',
|
||||
id: 'not_like',
|
||||
whereTemplate: (searchString) => ({
|
||||
_not: {
|
||||
_and: [
|
||||
{ firstname: { _ilike: `%${searchString}%` } },
|
||||
{ lastname: { _ilike: `%${searchString}%` } },
|
||||
],
|
||||
},
|
||||
NOT: [
|
||||
{
|
||||
AND: [
|
||||
{
|
||||
firstname: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
{
|
||||
lastname: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
@@ -55,14 +78,21 @@ export const emailFilter = {
|
||||
label: 'Contains',
|
||||
id: 'like',
|
||||
whereTemplate: (searchString) => ({
|
||||
email: { _ilike: `%${searchString}%` },
|
||||
email: { contains: `%${searchString}%`, mode: QueryMode.Insensitive },
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Does not contain',
|
||||
id: 'not_like',
|
||||
whereTemplate: (searchString) => ({
|
||||
_not: { email: { _ilike: `%${searchString}%` } },
|
||||
NOT: [
|
||||
{
|
||||
email: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
@@ -76,7 +106,7 @@ export const companyFilter = {
|
||||
searchConfig: {
|
||||
query: SEARCH_COMPANY_QUERY,
|
||||
template: (searchString: string) => ({
|
||||
name: { _ilike: `%${searchString}%` },
|
||||
name: { contains: `%${searchString}%`, mode: QueryMode.Insensitive },
|
||||
}),
|
||||
resultMapper: (data) => ({
|
||||
value: mapToCompany(data),
|
||||
@@ -89,14 +119,14 @@ export const companyFilter = {
|
||||
label: 'Is',
|
||||
id: 'is',
|
||||
whereTemplate: (company) => ({
|
||||
company: { name: { _eq: company.name } },
|
||||
company: { is: { name: { equals: company.name } } },
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Is not',
|
||||
id: 'is_not',
|
||||
whereTemplate: (company) => ({
|
||||
_not: { company: { name: { _eq: company.name } } },
|
||||
NOT: [{ company: { is: { name: { equals: company.name } } } }],
|
||||
}),
|
||||
},
|
||||
],
|
||||
@@ -112,14 +142,21 @@ export const phoneFilter = {
|
||||
label: 'Contains',
|
||||
id: 'like',
|
||||
whereTemplate: (searchString) => ({
|
||||
phone: { _ilike: `%${searchString}%` },
|
||||
phone: { contains: `%${searchString}%`, mode: QueryMode.Insensitive },
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Does not contain',
|
||||
id: 'not_like',
|
||||
whereTemplate: (searchString) => ({
|
||||
_not: { phone: { _ilike: `%${searchString}%` } },
|
||||
NOT: [
|
||||
{
|
||||
phone: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
@@ -135,8 +172,8 @@ export const creationDateFilter = {
|
||||
label: 'Greater than',
|
||||
id: 'greater_than',
|
||||
whereTemplate: (searchString) => ({
|
||||
created_at: {
|
||||
_gte: searchString,
|
||||
createdAt: {
|
||||
gte: searchString,
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -144,8 +181,8 @@ export const creationDateFilter = {
|
||||
label: 'Less than',
|
||||
id: 'less_than',
|
||||
whereTemplate: (searchString) => ({
|
||||
created_at: {
|
||||
_lte: searchString,
|
||||
createdAt: {
|
||||
lte: searchString,
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -162,14 +199,21 @@ export const cityFilter = {
|
||||
label: 'Contains',
|
||||
id: 'like',
|
||||
whereTemplate: (searchString) => ({
|
||||
city: { _ilike: `%${searchString}%` },
|
||||
city: { contains: `%${searchString}%`, mode: QueryMode.Insensitive },
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Does not contain',
|
||||
id: 'not_like',
|
||||
whereTemplate: (searchString) => ({
|
||||
_not: { city: { _ilike: `%${searchString}%` } },
|
||||
NOT: [
|
||||
{
|
||||
city: {
|
||||
contains: `%${searchString}%`,
|
||||
mode: QueryMode.Insensitive,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { Order_By, People_Order_By } from '../../generated/graphql';
|
||||
import {
|
||||
SortOrder as Order_By,
|
||||
PersonOrderByWithRelationInput as People_Order_By,
|
||||
} from '../../generated/graphql';
|
||||
import { SortType } from '../../interfaces/sorts/interface';
|
||||
import {
|
||||
TbBuilding,
|
||||
@@ -40,7 +43,7 @@ export const availableSorts = [
|
||||
_type: 'default_sort',
|
||||
},
|
||||
{
|
||||
key: 'created_at',
|
||||
key: 'createdAt',
|
||||
label: 'Created at',
|
||||
icon: <TbCalendar size={16} />,
|
||||
_type: 'default_sort',
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -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
front/src/services/api/users/test.tsx
Normal file
9
front/src/services/api/users/test.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_CURRENT_USER = gql`
|
||||
query getUsers {
|
||||
users {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -1,6 +0,0 @@
|
||||
version: 3
|
||||
endpoint: http://localhost:8080
|
||||
metadata_directory: metadata
|
||||
actions:
|
||||
kind: synchronous
|
||||
handler_webhook_baseurl: http://localhost:3000
|
||||
@@ -1,6 +0,0 @@
|
||||
actions: []
|
||||
custom_types:
|
||||
enums: []
|
||||
input_objects: []
|
||||
objects: []
|
||||
scalars: []
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -1,9 +0,0 @@
|
||||
- name: default
|
||||
kind: postgres
|
||||
configuration:
|
||||
connection_info:
|
||||
database_url:
|
||||
from_env: HASURA_GRAPHQL_PG_DATABASE_URL
|
||||
isolation_level: read-committed
|
||||
use_prepared_statements: false
|
||||
tables: "!include default/tables/tables.yaml"
|
||||
@@ -1,23 +0,0 @@
|
||||
table:
|
||||
name: provider_requests
|
||||
schema: auth
|
||||
configuration:
|
||||
column_config:
|
||||
id:
|
||||
custom_name: id
|
||||
options:
|
||||
custom_name: options
|
||||
custom_column_names:
|
||||
id: id
|
||||
options: options
|
||||
custom_name: authProviderRequests
|
||||
custom_root_fields:
|
||||
delete: deleteAuthProviderRequests
|
||||
delete_by_pk: deleteAuthProviderRequest
|
||||
insert: insertAuthProviderRequests
|
||||
insert_one: insertAuthProviderRequest
|
||||
select: authProviderRequests
|
||||
select_aggregate: authProviderRequestsAggregate
|
||||
select_by_pk: authProviderRequest
|
||||
update: updateAuthProviderRequests
|
||||
update_by_pk: updateAuthProviderRequest
|
||||
@@ -1,28 +0,0 @@
|
||||
table:
|
||||
name: providers
|
||||
schema: auth
|
||||
configuration:
|
||||
column_config:
|
||||
id:
|
||||
custom_name: id
|
||||
custom_column_names:
|
||||
id: id
|
||||
custom_name: authProviders
|
||||
custom_root_fields:
|
||||
delete: deleteAuthProviders
|
||||
delete_by_pk: deleteAuthProvider
|
||||
insert: insertAuthProviders
|
||||
insert_one: insertAuthProvider
|
||||
select: authProviders
|
||||
select_aggregate: authProvidersAggregate
|
||||
select_by_pk: authProvider
|
||||
update: updateAuthProviders
|
||||
update_by_pk: updateAuthProvider
|
||||
array_relationships:
|
||||
- name: userProviders
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: provider_id
|
||||
table:
|
||||
name: user_providers
|
||||
schema: auth
|
||||
@@ -1,36 +0,0 @@
|
||||
table:
|
||||
name: refresh_tokens
|
||||
schema: auth
|
||||
configuration:
|
||||
column_config:
|
||||
created_at:
|
||||
custom_name: createdAt
|
||||
expires_at:
|
||||
custom_name: expiresAt
|
||||
refresh_token:
|
||||
custom_name: refreshToken
|
||||
refresh_token_hash:
|
||||
custom_name: refreshTokenHash
|
||||
user_id:
|
||||
custom_name: userId
|
||||
custom_column_names:
|
||||
created_at: createdAt
|
||||
expires_at: expiresAt
|
||||
refresh_token: refreshToken
|
||||
refresh_token_hash: refreshTokenHash
|
||||
user_id: userId
|
||||
custom_name: authRefreshTokens
|
||||
custom_root_fields:
|
||||
delete: deleteAuthRefreshTokens
|
||||
delete_by_pk: deleteAuthRefreshToken
|
||||
insert: insertAuthRefreshTokens
|
||||
insert_one: insertAuthRefreshToken
|
||||
select: authRefreshTokens
|
||||
select_aggregate: authRefreshTokensAggregate
|
||||
select_by_pk: authRefreshToken
|
||||
update: updateAuthRefreshTokens
|
||||
update_by_pk: updateAuthRefreshToken
|
||||
object_relationships:
|
||||
- name: user
|
||||
using:
|
||||
foreign_key_constraint_on: user_id
|
||||
@@ -1,35 +0,0 @@
|
||||
table:
|
||||
name: roles
|
||||
schema: auth
|
||||
configuration:
|
||||
column_config:
|
||||
role:
|
||||
custom_name: role
|
||||
custom_column_names:
|
||||
role: role
|
||||
custom_name: authRoles
|
||||
custom_root_fields:
|
||||
delete: deleteAuthRoles
|
||||
delete_by_pk: deleteAuthRole
|
||||
insert: insertAuthRoles
|
||||
insert_one: insertAuthRole
|
||||
select: authRoles
|
||||
select_aggregate: authRolesAggregate
|
||||
select_by_pk: authRole
|
||||
update: updateAuthRoles
|
||||
update_by_pk: updateAuthRole
|
||||
array_relationships:
|
||||
- name: userRoles
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: role
|
||||
table:
|
||||
name: user_roles
|
||||
schema: auth
|
||||
- name: usersByDefaultRole
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: default_role
|
||||
table:
|
||||
name: users
|
||||
schema: auth
|
||||
@@ -1,48 +0,0 @@
|
||||
table:
|
||||
name: user_providers
|
||||
schema: auth
|
||||
configuration:
|
||||
column_config:
|
||||
access_token:
|
||||
custom_name: accessToken
|
||||
created_at:
|
||||
custom_name: createdAt
|
||||
id:
|
||||
custom_name: id
|
||||
provider_id:
|
||||
custom_name: providerId
|
||||
provider_user_id:
|
||||
custom_name: providerUserId
|
||||
refresh_token:
|
||||
custom_name: refreshToken
|
||||
updated_at:
|
||||
custom_name: updatedAt
|
||||
user_id:
|
||||
custom_name: userId
|
||||
custom_column_names:
|
||||
access_token: accessToken
|
||||
created_at: createdAt
|
||||
id: id
|
||||
provider_id: providerId
|
||||
provider_user_id: providerUserId
|
||||
refresh_token: refreshToken
|
||||
updated_at: updatedAt
|
||||
user_id: userId
|
||||
custom_name: authUserProviders
|
||||
custom_root_fields:
|
||||
delete: deleteAuthUserProviders
|
||||
delete_by_pk: deleteAuthUserProvider
|
||||
insert: insertAuthUserProviders
|
||||
insert_one: insertAuthUserProvider
|
||||
select: authUserProviders
|
||||
select_aggregate: authUserProvidersAggregate
|
||||
select_by_pk: authUserProvider
|
||||
update: updateAuthUserProviders
|
||||
update_by_pk: updateAuthUserProvider
|
||||
object_relationships:
|
||||
- name: provider
|
||||
using:
|
||||
foreign_key_constraint_on: provider_id
|
||||
- name: user
|
||||
using:
|
||||
foreign_key_constraint_on: user_id
|
||||
@@ -1,36 +0,0 @@
|
||||
table:
|
||||
name: user_roles
|
||||
schema: auth
|
||||
configuration:
|
||||
column_config:
|
||||
created_at:
|
||||
custom_name: createdAt
|
||||
id:
|
||||
custom_name: id
|
||||
role:
|
||||
custom_name: role
|
||||
user_id:
|
||||
custom_name: userId
|
||||
custom_column_names:
|
||||
created_at: createdAt
|
||||
id: id
|
||||
role: role
|
||||
user_id: userId
|
||||
custom_name: authUserRoles
|
||||
custom_root_fields:
|
||||
delete: deleteAuthUserRoles
|
||||
delete_by_pk: deleteAuthUserRole
|
||||
insert: insertAuthUserRoles
|
||||
insert_one: insertAuthUserRole
|
||||
select: authUserRoles
|
||||
select_aggregate: authUserRolesAggregate
|
||||
select_by_pk: authUserRole
|
||||
update: updateAuthUserRoles
|
||||
update_by_pk: updateAuthUserRole
|
||||
object_relationships:
|
||||
- name: roleByRole
|
||||
using:
|
||||
foreign_key_constraint_on: role
|
||||
- name: user
|
||||
using:
|
||||
foreign_key_constraint_on: user_id
|
||||
@@ -1,33 +0,0 @@
|
||||
table:
|
||||
name: user_security_keys
|
||||
schema: auth
|
||||
configuration:
|
||||
column_config:
|
||||
credential_id:
|
||||
custom_name: credentialId
|
||||
credential_public_key:
|
||||
custom_name: credentialPublicKey
|
||||
id:
|
||||
custom_name: id
|
||||
user_id:
|
||||
custom_name: userId
|
||||
custom_column_names:
|
||||
credential_id: credentialId
|
||||
credential_public_key: credentialPublicKey
|
||||
id: id
|
||||
user_id: userId
|
||||
custom_name: authUserSecurityKeys
|
||||
custom_root_fields:
|
||||
delete: deleteAuthUserSecurityKeys
|
||||
delete_by_pk: deleteAuthUserSecurityKey
|
||||
insert: insertAuthUserSecurityKeys
|
||||
insert_one: insertAuthUserSecurityKey
|
||||
select: authUserSecurityKeys
|
||||
select_aggregate: authUserSecurityKeysAggregate
|
||||
select_by_pk: authUserSecurityKey
|
||||
update: updateAuthUserSecurityKeys
|
||||
update_by_pk: updateAuthUserSecurityKey
|
||||
object_relationships:
|
||||
- name: user
|
||||
using:
|
||||
foreign_key_constraint_on: user_id
|
||||
@@ -1,178 +0,0 @@
|
||||
table:
|
||||
name: users
|
||||
schema: auth
|
||||
configuration:
|
||||
column_config:
|
||||
active_mfa_type:
|
||||
custom_name: activeMfaType
|
||||
avatar_url:
|
||||
custom_name: avatarUrl
|
||||
created_at:
|
||||
custom_name: createdAt
|
||||
default_role:
|
||||
custom_name: defaultRole
|
||||
disabled:
|
||||
custom_name: disabled
|
||||
display_name:
|
||||
custom_name: displayName
|
||||
email:
|
||||
custom_name: email
|
||||
email_verified:
|
||||
custom_name: emailVerified
|
||||
id:
|
||||
custom_name: id
|
||||
is_anonymous:
|
||||
custom_name: isAnonymous
|
||||
last_seen:
|
||||
custom_name: lastSeen
|
||||
locale:
|
||||
custom_name: locale
|
||||
new_email:
|
||||
custom_name: newEmail
|
||||
otp_hash:
|
||||
custom_name: otpHash
|
||||
otp_hash_expires_at:
|
||||
custom_name: otpHashExpiresAt
|
||||
otp_method_last_used:
|
||||
custom_name: otpMethodLastUsed
|
||||
password_hash:
|
||||
custom_name: passwordHash
|
||||
phone_number:
|
||||
custom_name: phoneNumber
|
||||
phone_number_verified:
|
||||
custom_name: phoneNumberVerified
|
||||
ticket:
|
||||
custom_name: ticket
|
||||
ticket_expires_at:
|
||||
custom_name: ticketExpiresAt
|
||||
totp_secret:
|
||||
custom_name: totpSecret
|
||||
updated_at:
|
||||
custom_name: updatedAt
|
||||
webauthn_current_challenge:
|
||||
custom_name: currentChallenge
|
||||
custom_column_names:
|
||||
active_mfa_type: activeMfaType
|
||||
avatar_url: avatarUrl
|
||||
created_at: createdAt
|
||||
default_role: defaultRole
|
||||
disabled: disabled
|
||||
display_name: displayName
|
||||
email: email
|
||||
email_verified: emailVerified
|
||||
id: id
|
||||
is_anonymous: isAnonymous
|
||||
last_seen: lastSeen
|
||||
locale: locale
|
||||
new_email: newEmail
|
||||
otp_hash: otpHash
|
||||
otp_hash_expires_at: otpHashExpiresAt
|
||||
otp_method_last_used: otpMethodLastUsed
|
||||
password_hash: passwordHash
|
||||
phone_number: phoneNumber
|
||||
phone_number_verified: phoneNumberVerified
|
||||
ticket: ticket
|
||||
ticket_expires_at: ticketExpiresAt
|
||||
totp_secret: totpSecret
|
||||
updated_at: updatedAt
|
||||
webauthn_current_challenge: currentChallenge
|
||||
custom_name: users
|
||||
custom_root_fields:
|
||||
delete: deleteUsers
|
||||
delete_by_pk: deleteUser
|
||||
insert: insertUsers
|
||||
insert_one: insertUser
|
||||
select: users
|
||||
select_aggregate: usersAggregate
|
||||
select_by_pk: user
|
||||
update: updateUsers
|
||||
update_by_pk: updateUser
|
||||
object_relationships:
|
||||
- name: defaultRoleByRole
|
||||
using:
|
||||
foreign_key_constraint_on: default_role
|
||||
- name: workspace_member
|
||||
using:
|
||||
manual_configuration:
|
||||
column_mapping:
|
||||
id: user_id
|
||||
insertion_order: null
|
||||
remote_table:
|
||||
name: workspace_members
|
||||
schema: public
|
||||
array_relationships:
|
||||
- name: refreshTokens
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: user_id
|
||||
table:
|
||||
name: refresh_tokens
|
||||
schema: auth
|
||||
- name: roles
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: user_id
|
||||
table:
|
||||
name: user_roles
|
||||
schema: auth
|
||||
- name: securityKeys
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: user_id
|
||||
table:
|
||||
name: user_security_keys
|
||||
schema: auth
|
||||
- name: userProviders
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: user_id
|
||||
table:
|
||||
name: user_providers
|
||||
schema: auth
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- disabled
|
||||
- email_verified
|
||||
- is_anonymous
|
||||
- phone_number_verified
|
||||
- locale
|
||||
- metadata
|
||||
- active_mfa_type
|
||||
- avatar_url
|
||||
- default_role
|
||||
- display_name
|
||||
- otp_hash
|
||||
- otp_method_last_used
|
||||
- password_hash
|
||||
- phone_number
|
||||
- ticket
|
||||
- totp_secret
|
||||
- webauthn_current_challenge
|
||||
- created_at
|
||||
- last_seen
|
||||
- otp_hash_expires_at
|
||||
- ticket_expires_at
|
||||
- updated_at
|
||||
- email
|
||||
- new_email
|
||||
- id
|
||||
filter:
|
||||
workspace_member:
|
||||
workspace_id:
|
||||
_eq: X-Hasura-Workspace-Id
|
||||
event_triggers:
|
||||
- name: user-created
|
||||
definition:
|
||||
enable_manual: false
|
||||
insert:
|
||||
columns: '*'
|
||||
retry_conf:
|
||||
interval_sec: 10
|
||||
num_retries: 0
|
||||
timeout_sec: 60
|
||||
webhook: '{{HASURA_EVENT_HANDLER_URL}}'
|
||||
headers:
|
||||
- name: secret-header
|
||||
value: secret
|
||||
@@ -1,76 +0,0 @@
|
||||
table:
|
||||
name: companies
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: account_owner
|
||||
using:
|
||||
manual_configuration:
|
||||
column_mapping:
|
||||
account_owner_id: id
|
||||
insertion_order: null
|
||||
remote_table:
|
||||
name: users
|
||||
schema: auth
|
||||
- name: workspace
|
||||
using:
|
||||
foreign_key_constraint_on: workspace_id
|
||||
insert_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
check:
|
||||
workspace_id:
|
||||
_eq: x-hasura-workspace-id
|
||||
set:
|
||||
workspace_id: x-hasura-Workspace-Id
|
||||
columns:
|
||||
- id
|
||||
- workspace_id
|
||||
- account_owner_id
|
||||
- address
|
||||
- employees
|
||||
- name
|
||||
- domain_name
|
||||
- created_at
|
||||
- updated_at
|
||||
- deleted_at
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- domain_name
|
||||
- name
|
||||
- account_owner_id
|
||||
- address
|
||||
- employees
|
||||
- created_at
|
||||
- deleted_at
|
||||
- updated_at
|
||||
- id
|
||||
- workspace_id
|
||||
filter:
|
||||
workspace_id:
|
||||
_eq: x-hasura-workspace-id
|
||||
update_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- domain_name
|
||||
- name
|
||||
- employees
|
||||
- address
|
||||
- account_owner_id
|
||||
- created_at
|
||||
- deleted_at
|
||||
- updated_at
|
||||
- id
|
||||
- workspace_id
|
||||
filter:
|
||||
workspace_id:
|
||||
_eq: x-hasura-workspace-id
|
||||
check: null
|
||||
delete_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
filter:
|
||||
workspace_id:
|
||||
_eq: x-hasura-workspace-id
|
||||
@@ -1,73 +0,0 @@
|
||||
table:
|
||||
name: people
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: company
|
||||
using:
|
||||
foreign_key_constraint_on: company_id
|
||||
- name: workspace
|
||||
using:
|
||||
foreign_key_constraint_on: workspace_id
|
||||
insert_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
check:
|
||||
workspace_id:
|
||||
_eq: x-hasura-workspace-id
|
||||
set:
|
||||
workspace_id: x-hasura-Workspace-Id
|
||||
columns:
|
||||
- city
|
||||
- email
|
||||
- firstname
|
||||
- lastname
|
||||
- phone
|
||||
- created_at
|
||||
- deleted_at
|
||||
- updated_at
|
||||
- company_id
|
||||
- id
|
||||
- workspace_id
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- city
|
||||
- email
|
||||
- firstname
|
||||
- lastname
|
||||
- phone
|
||||
- created_at
|
||||
- deleted_at
|
||||
- updated_at
|
||||
- company_id
|
||||
- id
|
||||
- workspace_id
|
||||
filter:
|
||||
workspace_id:
|
||||
_eq: x-hasura-workspace-id
|
||||
update_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- city
|
||||
- email
|
||||
- firstname
|
||||
- lastname
|
||||
- phone
|
||||
- created_at
|
||||
- deleted_at
|
||||
- updated_at
|
||||
- company_id
|
||||
- id
|
||||
- workspace_id
|
||||
filter:
|
||||
workspace_id:
|
||||
_eq: x-hasura-workspace-id
|
||||
check: null
|
||||
delete_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
filter:
|
||||
workspace_id:
|
||||
_eq: x-hasura-workspace-id
|
||||
@@ -1,25 +0,0 @@
|
||||
table:
|
||||
name: persons
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: company
|
||||
using:
|
||||
foreign_key_constraint_on: company_id
|
||||
- name: workspace
|
||||
using:
|
||||
foreign_key_constraint_on: workspace_id
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- company_id
|
||||
- id
|
||||
- workspace_id
|
||||
- city
|
||||
- email
|
||||
- firstname
|
||||
- lastname
|
||||
- phone
|
||||
- created_at
|
||||
- updated_at
|
||||
filter: {}
|
||||
@@ -1,20 +0,0 @@
|
||||
table:
|
||||
name: workspace_members
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: workspace
|
||||
using:
|
||||
foreign_key_constraint_on: workspace_id
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- created_at
|
||||
- deleted_at
|
||||
- updated_at
|
||||
- id
|
||||
- user_id
|
||||
- workspace_id
|
||||
filter:
|
||||
workspace_id:
|
||||
_eq: X-Hasura-Workspace-Id
|
||||
@@ -1,17 +0,0 @@
|
||||
table:
|
||||
name: workspaces
|
||||
schema: public
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- display_name
|
||||
- domain_name
|
||||
- logo
|
||||
- created_at
|
||||
- deleted_at
|
||||
- updated_at
|
||||
- id
|
||||
filter:
|
||||
id:
|
||||
_eq: X-Hasura-Workspace-Id
|
||||
@@ -1,12 +0,0 @@
|
||||
- "!include auth_provider_requests.yaml"
|
||||
- "!include auth_providers.yaml"
|
||||
- "!include auth_refresh_tokens.yaml"
|
||||
- "!include auth_roles.yaml"
|
||||
- "!include auth_user_providers.yaml"
|
||||
- "!include auth_user_roles.yaml"
|
||||
- "!include auth_user_security_keys.yaml"
|
||||
- "!include auth_users.yaml"
|
||||
- "!include public_companies.yaml"
|
||||
- "!include public_people.yaml"
|
||||
- "!include public_workspace_members.yaml"
|
||||
- "!include public_workspaces.yaml"
|
||||
@@ -1 +0,0 @@
|
||||
disabled_for_roles: []
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -1 +0,0 @@
|
||||
version: 3
|
||||
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."workspaces";
|
||||
@@ -1 +0,0 @@
|
||||
CREATE TABLE "public"."workspaces" ("id" serial NOT NULL, "name" Text NOT NULL, "display_name" text NOT NULL, PRIMARY KEY ("id") , UNIQUE ("id"), UNIQUE ("name"));
|
||||
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."person";
|
||||
@@ -1 +0,0 @@
|
||||
CREATE TABLE "public"."person" ("id" serial NOT NULL, "firstname" text, "lastname" text NOT NULL, "company_domain" text, "phone" text, "city" text, PRIMARY KEY ("id") , UNIQUE ("id"));
|
||||
@@ -1,4 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "workspace_id" integer
|
||||
-- not null;
|
||||
@@ -1,2 +0,0 @@
|
||||
alter table "public"."person" add column "workspace_id" integer
|
||||
not null;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."person" drop constraint "person_workspace_id_fkey";
|
||||
@@ -1,5 +0,0 @@
|
||||
alter table "public"."person"
|
||||
add constraint "person_workspace_id_fkey"
|
||||
foreign key ("workspace_id")
|
||||
references "public"."workspaces"
|
||||
("id") on update restrict on delete restrict;
|
||||
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."company";
|
||||
@@ -1 +0,0 @@
|
||||
CREATE TABLE "public"."company" ("id" serial NOT NULL, "company_name" text NOT NULL, "company_domain" text NOT NULL, "workspace_id" integer NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON UPDATE restrict ON DELETE restrict);
|
||||
@@ -1,4 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "company_id" integer
|
||||
-- null;
|
||||
@@ -1,2 +0,0 @@
|
||||
alter table "public"."person" add column "company_id" integer
|
||||
null;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."person" drop constraint "person_company_id_fkey";
|
||||
@@ -1,5 +0,0 @@
|
||||
alter table "public"."person"
|
||||
add constraint "person_company_id_fkey"
|
||||
foreign key ("company_id")
|
||||
references "public"."company"
|
||||
("id") on update restrict on delete restrict;
|
||||
@@ -1,2 +0,0 @@
|
||||
alter table "public"."person" alter column "company_domain" drop not null;
|
||||
alter table "public"."person" add column "company_domain" text;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."person" drop column "company_domain" cascade;
|
||||
@@ -1,4 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "email" text
|
||||
-- null;
|
||||
@@ -1,2 +0,0 @@
|
||||
alter table "public"."person" add column "email" text
|
||||
null;
|
||||
@@ -1,4 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "created_at" timestamptz
|
||||
-- null default now();
|
||||
@@ -1,2 +0,0 @@
|
||||
alter table "public"."person" add column "created_at" timestamptz
|
||||
null default now();
|
||||
@@ -1,21 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "updated_at" timestamptz
|
||||
-- null default now();
|
||||
--
|
||||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
-- RETURNS TRIGGER AS $$
|
||||
-- DECLARE
|
||||
-- _new record;
|
||||
-- BEGIN
|
||||
-- _new := NEW;
|
||||
-- _new."updated_at" = NOW();
|
||||
-- RETURN _new;
|
||||
-- END;
|
||||
-- $$ LANGUAGE plpgsql;
|
||||
-- CREATE TRIGGER "set_public_person_updated_at"
|
||||
-- BEFORE UPDATE ON "public"."person"
|
||||
-- FOR EACH ROW
|
||||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
-- COMMENT ON TRIGGER "set_public_person_updated_at" ON "public"."person"
|
||||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@@ -1,19 +0,0 @@
|
||||
alter table "public"."person" add column "updated_at" timestamptz
|
||||
null default now();
|
||||
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_person_updated_at"
|
||||
BEFORE UPDATE ON "public"."person"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_person_updated_at" ON "public"."person"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@@ -1,4 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."company" add column "created_at" timestamptz
|
||||
-- null default now();
|
||||
@@ -1,2 +0,0 @@
|
||||
alter table "public"."company" add column "created_at" timestamptz
|
||||
null default now();
|
||||
@@ -1,21 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."company" add column "updated_at" timestamptz
|
||||
-- not null default now();
|
||||
--
|
||||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
-- RETURNS TRIGGER AS $$
|
||||
-- DECLARE
|
||||
-- _new record;
|
||||
-- BEGIN
|
||||
-- _new := NEW;
|
||||
-- _new."updated_at" = NOW();
|
||||
-- RETURN _new;
|
||||
-- END;
|
||||
-- $$ LANGUAGE plpgsql;
|
||||
-- CREATE TRIGGER "set_public_company_updated_at"
|
||||
-- BEFORE UPDATE ON "public"."company"
|
||||
-- FOR EACH ROW
|
||||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
-- COMMENT ON TRIGGER "set_public_company_updated_at" ON "public"."company"
|
||||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@@ -1,19 +0,0 @@
|
||||
alter table "public"."company" add column "updated_at" timestamptz
|
||||
not null default now();
|
||||
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_company_updated_at"
|
||||
BEFORE UPDATE ON "public"."company"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_company_updated_at" ON "public"."company"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."company" alter column "created_at" drop not null;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."company" alter column "created_at" set not null;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."person" alter column "created_at" drop not null;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."person" alter column "created_at" set not null;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."person" alter column "updated_at" drop not null;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."person" alter column "updated_at" set not null;
|
||||
@@ -1,4 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."workspaces" add column "created_at" timestamptz
|
||||
-- not null default now();
|
||||
@@ -1,2 +0,0 @@
|
||||
alter table "public"."workspaces" add column "created_at" timestamptz
|
||||
not null default now();
|
||||
@@ -1,21 +0,0 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."workspaces" add column "updated_at" timestamptz
|
||||
-- not null default now();
|
||||
--
|
||||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
-- RETURNS TRIGGER AS $$
|
||||
-- DECLARE
|
||||
-- _new record;
|
||||
-- BEGIN
|
||||
-- _new := NEW;
|
||||
-- _new."updated_at" = NOW();
|
||||
-- RETURN _new;
|
||||
-- END;
|
||||
-- $$ LANGUAGE plpgsql;
|
||||
-- CREATE TRIGGER "set_public_workspaces_updated_at"
|
||||
-- BEFORE UPDATE ON "public"."workspaces"
|
||||
-- FOR EACH ROW
|
||||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
-- COMMENT ON TRIGGER "set_public_workspaces_updated_at" ON "public"."workspaces"
|
||||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@@ -1,19 +0,0 @@
|
||||
alter table "public"."workspaces" add column "updated_at" timestamptz
|
||||
not null default now();
|
||||
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_workspaces_updated_at"
|
||||
BEFORE UPDATE ON "public"."workspaces"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_workspaces_updated_at" ON "public"."workspaces"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."companies" rename to "company";
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."company" rename to "companies";
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user