mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-22 19:41:53 +03:00
Lucas/t 231 timebox i can create a company at the same time im creating (#140)
This PR is a bit messy: adding graphql schema adding create company creation on company select on People page some frontend refactoring to be continued --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
parent
fecf45f3bc
commit
b0044ed1a2
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"ms-vscode-remote.remote-containers",
|
"ms-vscode-remote.remote-containers",
|
||||||
"ms-vscode.makefile-tools"
|
"ms-vscode.makefile-tools",
|
||||||
|
"dbaeumer.vscode-eslint"
|
||||||
]
|
]
|
||||||
}
|
}
|
26
.vscode/settings.json
vendored
Normal file
26
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"editor.formatOnSave": false,
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.formatOnSave": false,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.formatOnSave": false,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"[typescriptreact]": {
|
||||||
|
"editor.formatOnSave": false,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"[json]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"javascript.format.enable": false,
|
||||||
|
"typescript.format.enable": false
|
||||||
|
}
|
10
front/package-lock.json
generated
10
front/package-lock.json
generated
@ -22,6 +22,7 @@
|
|||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-datepicker": "^4.11.0",
|
"react-datepicker": "^4.11.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-hotkeys-hook": "^4.4.0",
|
||||||
"react-icons": "^4.8.0",
|
"react-icons": "^4.8.0",
|
||||||
"react-router-dom": "^6.4.4",
|
"react-router-dom": "^6.4.4",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
@ -24939,6 +24940,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.1.tgz",
|
||||||
"integrity": "sha512-xTYf9zFim2pEif/Fw16dBiXpe0hoy5PxcD8+OwBnTtNLfIm3g6WxhKNurY+6OmdH1u6Ta/W/Vl6vjbYP1MFnDg=="
|
"integrity": "sha512-xTYf9zFim2pEif/Fw16dBiXpe0hoy5PxcD8+OwBnTtNLfIm3g6WxhKNurY+6OmdH1u6Ta/W/Vl6vjbYP1MFnDg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/react-hotkeys-hook": {
|
||||||
|
"version": "4.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-hotkeys-hook/-/react-hotkeys-hook-4.4.0.tgz",
|
||||||
|
"integrity": "sha512-wOaCWLwgT/f895CMJrR9hmzVf+gfL8IpjWDXWXKngBp9i6Xqzf0tvLv4VI8l3Vlsg/cc4C/Iik3Ck76L/Hj0tw==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=16.8.1",
|
||||||
|
"react-dom": ">=16.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-icons": {
|
"node_modules/react-icons": {
|
||||||
"version": "4.8.0",
|
"version": "4.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.8.0.tgz",
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-datepicker": "^4.11.0",
|
"react-datepicker": "^4.11.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-hotkeys-hook": "^4.4.0",
|
||||||
"react-icons": "^4.8.0",
|
"react-icons": "^4.8.0",
|
||||||
"react-router-dom": "^6.4.4",
|
"react-router-dom": "^6.4.4",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
|
12
front/src/components/editable-cell/CellBaseContainer.tsx
Normal file
12
front/src/components/editable-cell/CellBaseContainer.tsx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
export const CellBaseContainer = styled.div`
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 32px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
`;
|
28
front/src/components/editable-cell/CellEditModeContainer.tsx
Normal file
28
front/src/components/editable-cell/CellEditModeContainer.tsx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
editModeHorizontalAlign?: 'left' | 'right';
|
||||||
|
editModeVerticalPosition?: 'over' | 'below';
|
||||||
|
};
|
||||||
|
|
||||||
|
export const CellEditModeContainer = styled.div<OwnProps>`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
padding-left: ${(props) => props.theme.spacing(2)};
|
||||||
|
padding-right: ${(props) => props.theme.spacing(2)};
|
||||||
|
position: absolute;
|
||||||
|
left: ${(props) =>
|
||||||
|
props.editModeHorizontalAlign === 'right' ? 'auto' : '0'};
|
||||||
|
right: ${(props) =>
|
||||||
|
props.editModeHorizontalAlign === 'right' ? '0' : 'auto'};
|
||||||
|
top: ${(props) => (props.editModeVerticalPosition === 'over' ? '0' : '100%')};
|
||||||
|
|
||||||
|
background: ${(props) => props.theme.primaryBackground};
|
||||||
|
border: 1px solid ${(props) => props.theme.primaryBorder};
|
||||||
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.16);
|
||||||
|
z-index: 1;
|
||||||
|
border-radius: 4px;
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
`;
|
@ -0,0 +1,12 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
export const CellNormalModeContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: calc(100% - ${(props) => props.theme.spacing(5)});
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
padding-left: ${(props) => props.theme.spacing(2)};
|
||||||
|
padding-right: ${(props) => props.theme.spacing(2)};
|
||||||
|
`;
|
84
front/src/components/editable-cell/EditableCell.tsx
Normal file
84
front/src/components/editable-cell/EditableCell.tsx
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import { ReactElement, useRef } from 'react';
|
||||||
|
import { useOutsideAlerter } from '../../hooks/useOutsideAlerter';
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
|
import { CellBaseContainer } from './CellBaseContainer';
|
||||||
|
import { CellEditModeContainer } from './CellEditModeContainer';
|
||||||
|
import { CellNormalModeContainer } from './CellNormalModeContainer';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
editModeContent: ReactElement;
|
||||||
|
nonEditModeContent: ReactElement;
|
||||||
|
editModeHorizontalAlign?: 'left' | 'right';
|
||||||
|
editModeVerticalPosition?: 'over' | 'below';
|
||||||
|
isEditMode?: boolean;
|
||||||
|
isCreateMode?: boolean;
|
||||||
|
onOutsideClick?: () => void;
|
||||||
|
onInsideClick?: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function EditableCell({
|
||||||
|
editModeContent,
|
||||||
|
nonEditModeContent,
|
||||||
|
editModeHorizontalAlign = 'left',
|
||||||
|
editModeVerticalPosition = 'over',
|
||||||
|
isEditMode = false,
|
||||||
|
onOutsideClick,
|
||||||
|
onInsideClick,
|
||||||
|
}: OwnProps) {
|
||||||
|
const wrapperRef = useRef(null);
|
||||||
|
const editableContainerRef = useRef(null);
|
||||||
|
|
||||||
|
useOutsideAlerter(wrapperRef, () => {
|
||||||
|
onOutsideClick?.();
|
||||||
|
});
|
||||||
|
|
||||||
|
useHotkeys(
|
||||||
|
'esc',
|
||||||
|
() => {
|
||||||
|
if (isEditMode) {
|
||||||
|
onOutsideClick?.();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
preventDefault: true,
|
||||||
|
enableOnContentEditable: true,
|
||||||
|
enableOnFormTags: true,
|
||||||
|
},
|
||||||
|
[isEditMode, onOutsideClick],
|
||||||
|
);
|
||||||
|
|
||||||
|
useHotkeys(
|
||||||
|
'enter',
|
||||||
|
() => {
|
||||||
|
if (isEditMode) {
|
||||||
|
onOutsideClick?.();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
preventDefault: true,
|
||||||
|
enableOnContentEditable: true,
|
||||||
|
enableOnFormTags: true,
|
||||||
|
},
|
||||||
|
[isEditMode, onOutsideClick],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CellBaseContainer
|
||||||
|
ref={wrapperRef}
|
||||||
|
onClick={() => {
|
||||||
|
onInsideClick && onInsideClick();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CellNormalModeContainer>{nonEditModeContent}</CellNormalModeContainer>
|
||||||
|
{isEditMode && (
|
||||||
|
<CellEditModeContainer
|
||||||
|
ref={editableContainerRef}
|
||||||
|
editModeHorizontalAlign={editModeHorizontalAlign}
|
||||||
|
editModeVerticalPosition={editModeVerticalPosition}
|
||||||
|
>
|
||||||
|
{editModeContent}
|
||||||
|
</CellEditModeContainer>
|
||||||
|
)}
|
||||||
|
</CellBaseContainer>
|
||||||
|
);
|
||||||
|
}
|
95
front/src/components/editable-cell/EditableCellMenu.tsx
Normal file
95
front/src/components/editable-cell/EditableCellMenu.tsx
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
import { ReactElement, useRef } from 'react';
|
||||||
|
import { useOutsideAlerter } from '../../hooks/useOutsideAlerter';
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
|
import { CellBaseContainer } from './CellBaseContainer';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
import { EditableCellMenuEditModeContainer } from './EditableCellMenuEditModeContainer';
|
||||||
|
|
||||||
|
const EditableCellMenuNormalModeContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: calc(100% - ${(props) => props.theme.spacing(5)});
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
`;
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
editModeContent: ReactElement;
|
||||||
|
nonEditModeContent: ReactElement;
|
||||||
|
editModeHorizontalAlign?: 'left' | 'right';
|
||||||
|
editModeVerticalPosition?: 'over' | 'below';
|
||||||
|
isEditMode?: boolean;
|
||||||
|
isCreateMode?: boolean;
|
||||||
|
onOutsideClick?: () => void;
|
||||||
|
onInsideClick?: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: refactor
|
||||||
|
export function EditableCellMenu({
|
||||||
|
editModeContent,
|
||||||
|
nonEditModeContent,
|
||||||
|
editModeHorizontalAlign = 'left',
|
||||||
|
editModeVerticalPosition = 'over',
|
||||||
|
isEditMode = false,
|
||||||
|
onOutsideClick,
|
||||||
|
onInsideClick,
|
||||||
|
}: OwnProps) {
|
||||||
|
const wrapperRef = useRef(null);
|
||||||
|
const editableContainerRef = useRef(null);
|
||||||
|
|
||||||
|
useOutsideAlerter(wrapperRef, () => {
|
||||||
|
onOutsideClick?.();
|
||||||
|
});
|
||||||
|
|
||||||
|
useHotkeys(
|
||||||
|
'esc',
|
||||||
|
() => {
|
||||||
|
if (isEditMode) {
|
||||||
|
onOutsideClick?.();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
preventDefault: true,
|
||||||
|
enableOnContentEditable: true,
|
||||||
|
enableOnFormTags: true,
|
||||||
|
},
|
||||||
|
[isEditMode, onOutsideClick],
|
||||||
|
);
|
||||||
|
|
||||||
|
useHotkeys(
|
||||||
|
'enter',
|
||||||
|
() => {
|
||||||
|
if (isEditMode) {
|
||||||
|
onOutsideClick?.();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
preventDefault: true,
|
||||||
|
enableOnContentEditable: true,
|
||||||
|
enableOnFormTags: true,
|
||||||
|
},
|
||||||
|
[isEditMode, onOutsideClick],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CellBaseContainer
|
||||||
|
ref={wrapperRef}
|
||||||
|
onClick={() => {
|
||||||
|
onInsideClick && onInsideClick();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<EditableCellMenuNormalModeContainer>
|
||||||
|
{nonEditModeContent}
|
||||||
|
</EditableCellMenuNormalModeContainer>
|
||||||
|
{isEditMode && (
|
||||||
|
<EditableCellMenuEditModeContainer
|
||||||
|
ref={editableContainerRef}
|
||||||
|
editModeHorizontalAlign={editModeHorizontalAlign}
|
||||||
|
editModeVerticalPosition={editModeVerticalPosition}
|
||||||
|
>
|
||||||
|
{editModeContent}
|
||||||
|
</EditableCellMenuEditModeContainer>
|
||||||
|
)}
|
||||||
|
</CellBaseContainer>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
editModeHorizontalAlign?: 'left' | 'right';
|
||||||
|
editModeVerticalPosition?: 'over' | 'below';
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: refactor
|
||||||
|
export const EditableCellMenuEditModeContainer = styled.div<OwnProps>`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
left: ${(props) =>
|
||||||
|
props.editModeHorizontalAlign === 'right' ? 'auto' : '0'};
|
||||||
|
right: ${(props) =>
|
||||||
|
props.editModeHorizontalAlign === 'right' ? '0' : 'auto'};
|
||||||
|
top: ${(props) => (props.editModeVerticalPosition === 'over' ? '0' : '100%')};
|
||||||
|
|
||||||
|
background: ${(props) => props.theme.primaryBackground};
|
||||||
|
border: 1px solid ${(props) => props.theme.primaryBorder};
|
||||||
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.16);
|
||||||
|
z-index: 1;
|
||||||
|
border-radius: 4px;
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
`;
|
@ -1,99 +0,0 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ReactElement, useRef } from 'react';
|
|
||||||
import { useOutsideAlerter } from '../../hooks/useOutsideAlerter';
|
|
||||||
|
|
||||||
type OwnProps = {
|
|
||||||
editModeContent: ReactElement;
|
|
||||||
nonEditModeContent: ReactElement;
|
|
||||||
editModeHorizontalAlign?: 'left' | 'right';
|
|
||||||
editModeVerticalPosition?: 'over' | 'below';
|
|
||||||
isEditMode?: boolean;
|
|
||||||
onOutsideClick?: () => void;
|
|
||||||
onInsideClick?: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
const StyledWrapper = styled.div`
|
|
||||||
position: relative;
|
|
||||||
box-sizing: border-box;
|
|
||||||
height: 32px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
|
||||||
`;
|
|
||||||
|
|
||||||
type StyledEditModeContainerProps = {
|
|
||||||
editModeHorizontalAlign?: 'left' | 'right';
|
|
||||||
editModeVerticalPosition?: 'over' | 'below';
|
|
||||||
};
|
|
||||||
|
|
||||||
const StyledNonEditModeContainer = styled.div`
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
width: calc(100% - ${(props) => props.theme.spacing(5)});
|
|
||||||
height: 100%;
|
|
||||||
padding-left: ${(props) => props.theme.spacing(2)};
|
|
||||||
padding-right: ${(props) => props.theme.spacing(2)};
|
|
||||||
overflow: hidden;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const StyledEditModeContainer = styled.div<StyledEditModeContainerProps>`
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
min-width: 100%;
|
|
||||||
min-height: 100%;
|
|
||||||
padding-left: ${(props) => props.theme.spacing(2)};
|
|
||||||
padding-right: ${(props) => props.theme.spacing(2)};
|
|
||||||
position: absolute;
|
|
||||||
left: ${(props) =>
|
|
||||||
props.editModeHorizontalAlign === 'right' ? 'auto' : '0'};
|
|
||||||
right: ${(props) =>
|
|
||||||
props.editModeHorizontalAlign === 'right' ? '0' : 'auto'};
|
|
||||||
top: ${(props) => (props.editModeVerticalPosition === 'over' ? '0' : '100%')};
|
|
||||||
|
|
||||||
background: ${(props) => props.theme.primaryBackground};
|
|
||||||
border: 1px solid ${(props) => props.theme.primaryBorder};
|
|
||||||
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.16);
|
|
||||||
z-index: 1;
|
|
||||||
border-radius: 4px;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
`;
|
|
||||||
|
|
||||||
function EditableCellWrapper({
|
|
||||||
editModeContent,
|
|
||||||
nonEditModeContent,
|
|
||||||
editModeHorizontalAlign = 'left',
|
|
||||||
editModeVerticalPosition = 'over',
|
|
||||||
isEditMode = false,
|
|
||||||
onOutsideClick,
|
|
||||||
onInsideClick,
|
|
||||||
}: OwnProps) {
|
|
||||||
const wrapperRef = useRef(null);
|
|
||||||
useOutsideAlerter(wrapperRef, () => {
|
|
||||||
onOutsideClick && onOutsideClick();
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<StyledWrapper
|
|
||||||
ref={wrapperRef}
|
|
||||||
onClick={() => {
|
|
||||||
onInsideClick && onInsideClick();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<StyledNonEditModeContainer>
|
|
||||||
{nonEditModeContent}
|
|
||||||
</StyledNonEditModeContainer>
|
|
||||||
{isEditMode && (
|
|
||||||
<StyledEditModeContainer
|
|
||||||
editModeHorizontalAlign={editModeHorizontalAlign}
|
|
||||||
editModeVerticalPosition={editModeVerticalPosition}
|
|
||||||
>
|
|
||||||
{editModeContent}
|
|
||||||
</StyledEditModeContainer>
|
|
||||||
)}
|
|
||||||
</StyledWrapper>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default EditableCellWrapper;
|
|
@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { ChangeEvent, ComponentType, useRef, useState } from 'react';
|
import { ChangeEvent, ComponentType, useRef, useState } from 'react';
|
||||||
import EditableCellWrapper from './EditableCellWrapper';
|
import { EditableCell } from './EditableCell';
|
||||||
|
|
||||||
export type EditableChipProps = {
|
export type EditableChipProps = {
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
@ -11,16 +11,33 @@ export type EditableChipProps = {
|
|||||||
ChipComponent: ComponentType<{ name: string; picture: string }>;
|
ChipComponent: ComponentType<{ name: string; picture: string }>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: refactor
|
||||||
const StyledInplaceInput = styled.input`
|
const StyledInplaceInput = styled.input`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
padding-left: ${(props) => props.theme.spacing(1)};
|
||||||
|
padding-right: ${(props) => props.theme.spacing(1)};
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
font-weight: 'bold';
|
font-weight: 'bold';
|
||||||
color: props.theme.text20;
|
color: props.theme.text20;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StyledInplaceShow = styled.input`
|
||||||
|
width: 100%;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
padding-left: ${(props) => props.theme.spacing(2)};
|
||||||
|
padding-right: ${(props) => props.theme.spacing(2)};
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
font-weight: 'bold';
|
||||||
|
color: props.theme.text20;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
function EditableChip({
|
function EditableChip({
|
||||||
value,
|
value,
|
||||||
placeholder,
|
placeholder,
|
||||||
@ -34,7 +51,7 @@ function EditableChip({
|
|||||||
const [isEditMode, setIsEditMode] = useState(false);
|
const [isEditMode, setIsEditMode] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EditableCellWrapper
|
<EditableCell
|
||||||
onOutsideClick={() => setIsEditMode(false)}
|
onOutsideClick={() => setIsEditMode(false)}
|
||||||
onInsideClick={() => setIsEditMode(true)}
|
onInsideClick={() => setIsEditMode(true)}
|
||||||
isEditMode={isEditMode}
|
isEditMode={isEditMode}
|
||||||
@ -51,8 +68,12 @@ function EditableChip({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
nonEditModeContent={<ChipComponent name={inputValue} picture={picture} />}
|
nonEditModeContent={
|
||||||
></EditableCellWrapper>
|
<StyledInplaceShow>
|
||||||
|
<ChipComponent name={inputValue} picture={picture} />
|
||||||
|
</StyledInplaceShow>
|
||||||
|
}
|
||||||
|
></EditableCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { forwardRef, useState } from 'react';
|
import { forwardRef, useState } from 'react';
|
||||||
import EditableCellWrapper from './EditableCellWrapper';
|
import { EditableCell } from './EditableCell';
|
||||||
import DatePicker from '../form/DatePicker';
|
import DatePicker from '../form/DatePicker';
|
||||||
import { modalBackground } from '../../layout/styles/themes';
|
import { modalBackground } from '../../layout/styles/themes';
|
||||||
import { humanReadableDate } from '../../services/utils';
|
import { humanReadableDate } from '../../services/utils';
|
||||||
@ -57,7 +57,7 @@ function EditableDate({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EditableCellWrapper
|
<EditableCell
|
||||||
isEditMode={isEditMode}
|
isEditMode={isEditMode}
|
||||||
onOutsideClick={() => setIsEditMode(false)}
|
onOutsideClick={() => setIsEditMode(false)}
|
||||||
onInsideClick={() => setIsEditMode(true)}
|
onInsideClick={() => setIsEditMode(true)}
|
||||||
@ -80,7 +80,7 @@ function EditableDate({
|
|||||||
<div>{inputValue && humanReadableDate(inputValue)}</div>
|
<div>{inputValue && humanReadableDate(inputValue)}</div>
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
}
|
}
|
||||||
></EditableCellWrapper>
|
></EditableCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
77
front/src/components/editable-cell/EditableDoubleText.tsx
Normal file
77
front/src/components/editable-cell/EditableDoubleText.tsx
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
import { ChangeEvent, ReactElement, useRef, useState } from 'react';
|
||||||
|
import { EditableCell } from './EditableCell';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
firstValue: string;
|
||||||
|
secondValue: string;
|
||||||
|
firstValuePlaceholder: string;
|
||||||
|
secondValuePlaceholder: string;
|
||||||
|
nonEditModeContent: ReactElement;
|
||||||
|
onChange: (firstValue: string, secondValue: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const StyledContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
& > input:last-child {
|
||||||
|
padding-left: ${(props) => props.theme.spacing(2)};
|
||||||
|
border-left: 1px solid ${(props) => props.theme.primaryBorder};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledEditInplaceInput = styled.input`
|
||||||
|
width: 45%;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
height: 18px;
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
font-weight: bold;
|
||||||
|
color: ${(props) => props.theme.text20};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function EditableDoubleText({
|
||||||
|
firstValue,
|
||||||
|
secondValue,
|
||||||
|
firstValuePlaceholder,
|
||||||
|
secondValuePlaceholder,
|
||||||
|
nonEditModeContent,
|
||||||
|
onChange,
|
||||||
|
}: OwnProps) {
|
||||||
|
const firstValueInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
const [isEditMode, setIsEditMode] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<EditableCell
|
||||||
|
onInsideClick={() => setIsEditMode(true)}
|
||||||
|
onOutsideClick={() => setIsEditMode(false)}
|
||||||
|
isEditMode={isEditMode}
|
||||||
|
editModeContent={
|
||||||
|
<StyledContainer>
|
||||||
|
<StyledEditInplaceInput
|
||||||
|
autoFocus
|
||||||
|
placeholder={firstValuePlaceholder}
|
||||||
|
ref={firstValueInputRef}
|
||||||
|
value={firstValue}
|
||||||
|
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
onChange(event.target.value, secondValue);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<StyledEditInplaceInput
|
||||||
|
placeholder={secondValuePlaceholder}
|
||||||
|
ref={firstValueInputRef}
|
||||||
|
value={secondValue}
|
||||||
|
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
onChange(firstValue, event.target.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</StyledContainer>
|
||||||
|
}
|
||||||
|
nonEditModeContent={nonEditModeContent}
|
||||||
|
></EditableCell>
|
||||||
|
);
|
||||||
|
}
|
@ -1,77 +0,0 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ChangeEvent, useRef, useState } from 'react';
|
|
||||||
import EditableCellWrapper from './EditableCellWrapper';
|
|
||||||
import PersonChip from '../chips/PersonChip';
|
|
||||||
|
|
||||||
type OwnProps = {
|
|
||||||
firstname: string;
|
|
||||||
lastname: string;
|
|
||||||
changeHandler: (firstname: string, lastname: string) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
& > input:last-child {
|
|
||||||
padding-left: ${(props) => props.theme.spacing(2)};
|
|
||||||
border-left: 1px solid ${(props) => props.theme.primaryBorder};
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const StyledEditInplaceInput = styled.input`
|
|
||||||
width: 45%;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
height: 18px;
|
|
||||||
|
|
||||||
&::placeholder {
|
|
||||||
font-weight: bold;
|
|
||||||
color: ${(props) => props.theme.text20};
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
function EditableFullName({ firstname, lastname, changeHandler }: OwnProps) {
|
|
||||||
const firstnameInputRef = useRef<HTMLInputElement>(null);
|
|
||||||
const [firstnameValue, setFirstnameValue] = useState(firstname);
|
|
||||||
const [lastnameValue, setLastnameValue] = useState(lastname);
|
|
||||||
const [isEditMode, setIsEditMode] = useState(false);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<EditableCellWrapper
|
|
||||||
onOutsideClick={() => setIsEditMode(false)}
|
|
||||||
onInsideClick={() => setIsEditMode(true)}
|
|
||||||
isEditMode={isEditMode}
|
|
||||||
editModeContent={
|
|
||||||
<StyledContainer>
|
|
||||||
<StyledEditInplaceInput
|
|
||||||
autoFocus
|
|
||||||
placeholder="Firstname"
|
|
||||||
ref={firstnameInputRef}
|
|
||||||
value={firstnameValue}
|
|
||||||
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
|
||||||
setFirstnameValue(event.target.value);
|
|
||||||
changeHandler(event.target.value, lastnameValue);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<StyledEditInplaceInput
|
|
||||||
autoFocus
|
|
||||||
placeholder={'Lastname'}
|
|
||||||
ref={firstnameInputRef}
|
|
||||||
value={lastnameValue}
|
|
||||||
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
|
||||||
setLastnameValue(event.target.value);
|
|
||||||
changeHandler(firstnameValue, event.target.value);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</StyledContainer>
|
|
||||||
}
|
|
||||||
nonEditModeContent={
|
|
||||||
<PersonChip name={firstnameValue + ' ' + lastnameValue} />
|
|
||||||
}
|
|
||||||
></EditableCellWrapper>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default EditableFullName;
|
|
@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { ChangeEvent, MouseEvent, useRef, useState } from 'react';
|
import { ChangeEvent, MouseEvent, useRef, useState } from 'react';
|
||||||
import EditableCellWrapper from './EditableCellWrapper';
|
import { EditableCell } from './EditableCell';
|
||||||
import { isValidPhoneNumber, parsePhoneNumber } from 'libphonenumber-js';
|
import { isValidPhoneNumber, parsePhoneNumber } from 'libphonenumber-js';
|
||||||
import Link from '../link/Link';
|
import Link from '../link/Link';
|
||||||
|
|
||||||
@ -14,6 +14,7 @@ type StyledEditModeProps = {
|
|||||||
isEditMode: boolean;
|
isEditMode: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: refactor
|
||||||
const StyledEditInplaceInput = styled.input<StyledEditModeProps>`
|
const StyledEditInplaceInput = styled.input<StyledEditModeProps>`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
@ -31,7 +32,7 @@ function EditablePhone({ value, placeholder, changeHandler }: OwnProps) {
|
|||||||
const [isEditMode, setIsEditMode] = useState(false);
|
const [isEditMode, setIsEditMode] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EditableCellWrapper
|
<EditableCell
|
||||||
isEditMode={isEditMode}
|
isEditMode={isEditMode}
|
||||||
onOutsideClick={() => setIsEditMode(false)}
|
onOutsideClick={() => setIsEditMode(false)}
|
||||||
onInsideClick={() => setIsEditMode(true)}
|
onInsideClick={() => setIsEditMode(true)}
|
||||||
|
@ -1,34 +1,52 @@
|
|||||||
import { ChangeEvent, ComponentType, useState } from 'react';
|
import { ChangeEvent, ComponentType, useEffect, useState } from 'react';
|
||||||
import EditableCellWrapper from './EditableCellWrapper';
|
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useSearch } from '../../services/api/search/search';
|
import { useSearch } from '../../services/api/search/search';
|
||||||
import { SearchConfigType } from '../../interfaces/search/interface';
|
import { SearchConfigType } from '../../interfaces/search/interface';
|
||||||
import { AnyEntity } from '../../interfaces/entities/generic.interface';
|
import { AnyEntity } from '../../interfaces/entities/generic.interface';
|
||||||
|
import { EditableRelationCreateButton } from './EditableRelationCreateButton';
|
||||||
|
import { isNonEmptyString } from '../../modules/utils/type-guards/isNonEmptyString';
|
||||||
|
import { isDefined } from '../../modules/utils/type-guards/isDefined';
|
||||||
|
import { FaPlus } from 'react-icons/fa';
|
||||||
|
import { HoverableMenuItem } from './HoverableMenuItem';
|
||||||
|
import { EditableCellMenu } from './EditableCellMenu';
|
||||||
|
import { CellNormalModeContainer } from './CellNormalModeContainer';
|
||||||
|
|
||||||
const StyledEditModeContainer = styled.div`
|
const StyledEditModeContainer = styled.div`
|
||||||
width: 200px;
|
width: 200px;
|
||||||
margin-left: calc(-1 * ${(props) => props.theme.spacing(2)});
|
// margin-left: calc(-1 * ${(props) => props.theme.spacing(2)});
|
||||||
margin-right: calc(-1 * ${(props) => props.theme.spacing(2)});
|
// margin-right: calc(-1 * ${(props) => props.theme.spacing(2)});
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledEditModeSelectedContainer = styled.div`
|
const StyledEditModeSelectedContainer = styled.div`
|
||||||
height: 31px;
|
height: 31px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: ${(props) => props.theme.spacing(2)};
|
padding-left: ${(props) => props.theme.spacing(1)};
|
||||||
padding-right: ${(props) => props.theme.spacing(2)};
|
padding-right: ${(props) => props.theme.spacing(1)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledEditModeSearchContainer = styled.div`
|
const StyledEditModeSearchContainer = styled.div`
|
||||||
height: 32px;
|
height: 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-top: 1px solid ${(props) => props.theme.primaryBorder};
|
border-top: 1px solid ${(props) => props.theme.primaryBorder};
|
||||||
|
padding-left: ${(props) => props.theme.spacing(1)};
|
||||||
|
padding-right: ${(props) => props.theme.spacing(1)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StyledEditModeCreateButtonContainer = styled.div`
|
||||||
|
height: 36px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-top: 1px solid ${(props) => props.theme.primaryBorder};
|
||||||
|
padding: ${(props) => props.theme.spacing(1)};
|
||||||
|
color: ${(props) => props.theme.text60};
|
||||||
|
`;
|
||||||
|
|
||||||
const StyledEditModeSearchInput = styled.input`
|
const StyledEditModeSearchInput = styled.input`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
padding-left: ${(props) => props.theme.spacing(2)};
|
|
||||||
padding-right: ${(props) => props.theme.spacing(2)};
|
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
font-weight: 'bold';
|
font-weight: 'bold';
|
||||||
@ -38,9 +56,10 @@ const StyledEditModeSearchInput = styled.input`
|
|||||||
|
|
||||||
const StyledEditModeResults = styled.div`
|
const StyledEditModeResults = styled.div`
|
||||||
border-top: 1px solid ${(props) => props.theme.primaryBorder};
|
border-top: 1px solid ${(props) => props.theme.primaryBorder};
|
||||||
padding-left: ${(props) => props.theme.spacing(2)};
|
padding-left: ${(props) => props.theme.spacing(1)};
|
||||||
padding-right: ${(props) => props.theme.spacing(2)};
|
padding-right: ${(props) => props.theme.spacing(1)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledEditModeResultItem = styled.div`
|
const StyledEditModeResultItem = styled.div`
|
||||||
height: 32px;
|
height: 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -49,6 +68,16 @@ const StyledEditModeResultItem = styled.div`
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StyledCreateButtonIcon = styled.div`
|
||||||
|
color: ${(props) => props.theme.text100};
|
||||||
|
align-self: center;
|
||||||
|
padding-top: 4px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledCreateButtonText = styled.div`
|
||||||
|
color: ${(props) => props.theme.text60};
|
||||||
|
`;
|
||||||
|
|
||||||
export type EditableRelationProps<
|
export type EditableRelationProps<
|
||||||
RelationType extends AnyEntity,
|
RelationType extends AnyEntity,
|
||||||
ChipComponentPropsType,
|
ChipComponentPropsType,
|
||||||
@ -56,14 +85,18 @@ export type EditableRelationProps<
|
|||||||
relation?: RelationType | null;
|
relation?: RelationType | null;
|
||||||
searchPlaceholder: string;
|
searchPlaceholder: string;
|
||||||
searchConfig: SearchConfigType<RelationType>;
|
searchConfig: SearchConfigType<RelationType>;
|
||||||
changeHandler: (relation: RelationType) => void;
|
onChange: (relation: RelationType) => void;
|
||||||
|
onChangeSearchInput?: (searchInput: string) => void;
|
||||||
editModeHorizontalAlign?: 'left' | 'right';
|
editModeHorizontalAlign?: 'left' | 'right';
|
||||||
ChipComponent: ComponentType<ChipComponentPropsType>;
|
ChipComponent: ComponentType<ChipComponentPropsType>;
|
||||||
chipComponentPropsMapper: (
|
chipComponentPropsMapper: (
|
||||||
relation: RelationType,
|
relation: RelationType,
|
||||||
) => ChipComponentPropsType & JSX.IntrinsicAttributes;
|
) => ChipComponentPropsType & JSX.IntrinsicAttributes;
|
||||||
|
// TODO: refactor, newRelationName is too hard coded.
|
||||||
|
onCreate?: (newRelationName: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: split this component
|
||||||
function EditableRelation<
|
function EditableRelation<
|
||||||
RelationType extends AnyEntity,
|
RelationType extends AnyEntity,
|
||||||
ChipComponentPropsType,
|
ChipComponentPropsType,
|
||||||
@ -71,19 +104,38 @@ function EditableRelation<
|
|||||||
relation,
|
relation,
|
||||||
searchPlaceholder,
|
searchPlaceholder,
|
||||||
searchConfig,
|
searchConfig,
|
||||||
changeHandler,
|
onChange,
|
||||||
|
onChangeSearchInput,
|
||||||
editModeHorizontalAlign,
|
editModeHorizontalAlign,
|
||||||
ChipComponent,
|
ChipComponent,
|
||||||
chipComponentPropsMapper,
|
chipComponentPropsMapper,
|
||||||
|
onCreate,
|
||||||
}: EditableRelationProps<RelationType, ChipComponentPropsType>) {
|
}: EditableRelationProps<RelationType, ChipComponentPropsType>) {
|
||||||
const [selectedRelation, setSelectedRelation] = useState(relation);
|
|
||||||
const [isEditMode, setIsEditMode] = useState(false);
|
const [isEditMode, setIsEditMode] = useState(false);
|
||||||
|
|
||||||
const [filterSearchResults, setSearchInput, setFilterSearch] =
|
// TODO: Tie this to a react context
|
||||||
|
const [filterSearchResults, setSearchInput, setFilterSearch, searchInput] =
|
||||||
useSearch<RelationType>();
|
useSearch<RelationType>();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isDefined(onChangeSearchInput)) {
|
||||||
|
onChangeSearchInput(searchInput);
|
||||||
|
}
|
||||||
|
}, [onChangeSearchInput, searchInput]);
|
||||||
|
|
||||||
|
const canCreate = isDefined(onCreate);
|
||||||
|
|
||||||
|
const createButtonIsVisible =
|
||||||
|
canCreate && isEditMode && isNonEmptyString(searchInput);
|
||||||
|
|
||||||
|
function handleCreateNewRelationButtonClick() {
|
||||||
|
onCreate?.(searchInput);
|
||||||
|
setIsEditMode(false);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EditableCellWrapper
|
<>
|
||||||
|
<EditableCellMenu
|
||||||
editModeHorizontalAlign={editModeHorizontalAlign}
|
editModeHorizontalAlign={editModeHorizontalAlign}
|
||||||
isEditMode={isEditMode}
|
isEditMode={isEditMode}
|
||||||
onOutsideClick={() => setIsEditMode(false)}
|
onOutsideClick={() => setIsEditMode(false)}
|
||||||
@ -95,8 +147,8 @@ function EditableRelation<
|
|||||||
editModeContent={
|
editModeContent={
|
||||||
<StyledEditModeContainer>
|
<StyledEditModeContainer>
|
||||||
<StyledEditModeSelectedContainer>
|
<StyledEditModeSelectedContainer>
|
||||||
{selectedRelation ? (
|
{relation ? (
|
||||||
<ChipComponent {...chipComponentPropsMapper(selectedRelation)} />
|
<ChipComponent {...chipComponentPropsMapper(relation)} />
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
@ -110,33 +162,51 @@ function EditableRelation<
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</StyledEditModeSearchContainer>
|
</StyledEditModeSearchContainer>
|
||||||
|
{createButtonIsVisible && (
|
||||||
|
<StyledEditModeCreateButtonContainer>
|
||||||
|
<HoverableMenuItem>
|
||||||
|
<EditableRelationCreateButton
|
||||||
|
onClick={handleCreateNewRelationButtonClick}
|
||||||
|
>
|
||||||
|
<StyledCreateButtonIcon>
|
||||||
|
<FaPlus />
|
||||||
|
</StyledCreateButtonIcon>
|
||||||
|
<StyledCreateButtonText>Create new</StyledCreateButtonText>
|
||||||
|
</EditableRelationCreateButton>
|
||||||
|
</HoverableMenuItem>
|
||||||
|
</StyledEditModeCreateButtonContainer>
|
||||||
|
)}
|
||||||
<StyledEditModeResults>
|
<StyledEditModeResults>
|
||||||
{filterSearchResults.results &&
|
{filterSearchResults.results &&
|
||||||
filterSearchResults.results.map((result, index) => (
|
filterSearchResults.results.map((result, index) => (
|
||||||
<StyledEditModeResultItem
|
<StyledEditModeResultItem
|
||||||
key={index}
|
key={index}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedRelation(result.value);
|
onChange(result.value);
|
||||||
changeHandler(result.value);
|
|
||||||
setIsEditMode(false);
|
setIsEditMode(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ChipComponent {...chipComponentPropsMapper(result.value)} />
|
<HoverableMenuItem>
|
||||||
|
<ChipComponent
|
||||||
|
{...chipComponentPropsMapper(result.value)}
|
||||||
|
/>
|
||||||
|
</HoverableMenuItem>
|
||||||
</StyledEditModeResultItem>
|
</StyledEditModeResultItem>
|
||||||
))}
|
))}
|
||||||
</StyledEditModeResults>
|
</StyledEditModeResults>
|
||||||
</StyledEditModeContainer>
|
</StyledEditModeContainer>
|
||||||
}
|
}
|
||||||
nonEditModeContent={
|
nonEditModeContent={
|
||||||
<div>
|
<CellNormalModeContainer>
|
||||||
{selectedRelation ? (
|
{relation ? (
|
||||||
<ChipComponent {...chipComponentPropsMapper(selectedRelation)} />
|
<ChipComponent {...chipComponentPropsMapper(relation)} />
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
</div>
|
</CellNormalModeContainer>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
export const EditableRelationCreateButton = styled.button`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border: none;
|
||||||
|
font-size: ${(props) => props.theme.fontSizeMedium};
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
padding-top: ${(props) => props.theme.spacing(1)};
|
||||||
|
padding-bottom: ${(props) => props.theme.spacing(1)};
|
||||||
|
padding-left: ${(props) => props.theme.spacing(1)};
|
||||||
|
font-family: 'Inter';
|
||||||
|
border-radius: 4px;
|
||||||
|
width: 100%;
|
||||||
|
height: 31px;
|
||||||
|
background: none;
|
||||||
|
gap: 8px;
|
||||||
|
// :hover {
|
||||||
|
// background: rgba(0, 0, 0, 0.04);
|
||||||
|
// color: ${(props) => props.theme.text100};
|
||||||
|
// }
|
||||||
|
// margin-bottom: calc(${(props) => props.theme.spacing(1)} / 2);
|
||||||
|
`;
|
@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { ChangeEvent, useRef, useState } from 'react';
|
import { ChangeEvent, useRef, useState } from 'react';
|
||||||
import EditableCellWrapper from './EditableCellWrapper';
|
import { EditableCell } from './EditableCell';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
@ -13,6 +13,7 @@ type StyledEditModeProps = {
|
|||||||
isEditMode: boolean;
|
isEditMode: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: refactor
|
||||||
const StyledInplaceInput = styled.input<StyledEditModeProps>`
|
const StyledInplaceInput = styled.input<StyledEditModeProps>`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
@ -40,7 +41,7 @@ function EditableText({
|
|||||||
const [isEditMode, setIsEditMode] = useState(false);
|
const [isEditMode, setIsEditMode] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EditableCellWrapper
|
<EditableCell
|
||||||
isEditMode={isEditMode}
|
isEditMode={isEditMode}
|
||||||
onOutsideClick={() => setIsEditMode(false)}
|
onOutsideClick={() => setIsEditMode(false)}
|
||||||
onInsideClick={() => setIsEditMode(true)}
|
onInsideClick={() => setIsEditMode(true)}
|
||||||
@ -59,7 +60,7 @@ function EditableText({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
nonEditModeContent={<StyledNoEditText>{inputValue}</StyledNoEditText>}
|
nonEditModeContent={<StyledNoEditText>{inputValue}</StyledNoEditText>}
|
||||||
></EditableCellWrapper>
|
></EditableCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
front/src/components/editable-cell/HoverableMenuItem.tsx
Normal file
19
front/src/components/editable-cell/HoverableMenuItem.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
export const HoverableMenuItem = styled.div`
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: rgba(0, 0, 0, 0);
|
||||||
|
transition: background 0.1s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
`;
|
@ -1,4 +1,4 @@
|
|||||||
import EditableFullName from '../EditableFullName';
|
import { EditablePeopleFullName } from '../../people/EditablePeopleFullName';
|
||||||
import { ThemeProvider } from '@emotion/react';
|
import { ThemeProvider } from '@emotion/react';
|
||||||
import { lightTheme } from '../../../layout/styles/themes';
|
import { lightTheme } from '../../../layout/styles/themes';
|
||||||
import { StoryFn } from '@storybook/react';
|
import { StoryFn } from '@storybook/react';
|
||||||
@ -6,23 +6,23 @@ import { MemoryRouter } from 'react-router-dom';
|
|||||||
|
|
||||||
const component = {
|
const component = {
|
||||||
title: 'EditableFullName',
|
title: 'EditableFullName',
|
||||||
component: EditableFullName,
|
component: EditablePeopleFullName,
|
||||||
};
|
};
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
changeHandler: (firstname: string, lastname: string) => void;
|
onChange: (firstname: string, lastname: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default component;
|
export default component;
|
||||||
|
|
||||||
const Template: StoryFn<typeof EditableFullName> = (args: OwnProps) => {
|
const Template: StoryFn<typeof EditablePeopleFullName> = (args: OwnProps) => {
|
||||||
return (
|
return (
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
<ThemeProvider theme={lightTheme}>
|
<ThemeProvider theme={lightTheme}>
|
||||||
<div data-testid="content-editable-parent">
|
<div data-testid="content-editable-parent">
|
||||||
<EditableFullName {...args} />
|
<EditablePeopleFullName {...args} />
|
||||||
</div>
|
</div>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</MemoryRouter>
|
</MemoryRouter>
|
||||||
@ -33,7 +33,7 @@ export const EditableFullNameStory = Template.bind({});
|
|||||||
EditableFullNameStory.args = {
|
EditableFullNameStory.args = {
|
||||||
firstname: 'John',
|
firstname: 'John',
|
||||||
lastname: 'Doe',
|
lastname: 'Doe',
|
||||||
changeHandler: () => {
|
onChange: () => {
|
||||||
console.log('changed');
|
console.log('validated');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -87,7 +87,7 @@ EditableRelationStory.args = {
|
|||||||
: undefined,
|
: undefined,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
changeHandler: (relation: Company) => {
|
onChange: (relation: Company) => {
|
||||||
console.log('changed', relation);
|
console.log('changed', relation);
|
||||||
},
|
},
|
||||||
searchConfig: {
|
searchConfig: {
|
||||||
|
@ -15,7 +15,7 @@ it('Checks the EditableRelation editing event bubbles up', async () => {
|
|||||||
Company,
|
Company,
|
||||||
CompanyChipPropsType
|
CompanyChipPropsType
|
||||||
>)}
|
>)}
|
||||||
changeHandler={func}
|
onChange={func}
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
65
front/src/components/inputs/DoubleTextInput.tsx
Normal file
65
front/src/components/inputs/DoubleTextInput.tsx
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
import { ChangeEvent, useRef } from 'react';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
leftValue: string;
|
||||||
|
rightValue: string;
|
||||||
|
leftValuePlaceholder: string;
|
||||||
|
rightValuePlaceholder: string;
|
||||||
|
onChange: (leftValue: string, rightValue: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const StyledContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
& > input:last-child {
|
||||||
|
padding-left: ${(props) => props.theme.spacing(2)};
|
||||||
|
border-left: 1px solid ${(props) => props.theme.primaryBorder};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledEditInplaceInput = styled.input`
|
||||||
|
width: 45%;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
height: 18px;
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
font-weight: bold;
|
||||||
|
color: ${(props) => props.theme.text20};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function DoubleTextInput({
|
||||||
|
leftValue,
|
||||||
|
rightValue,
|
||||||
|
leftValuePlaceholder,
|
||||||
|
rightValuePlaceholder,
|
||||||
|
onChange,
|
||||||
|
}: OwnProps) {
|
||||||
|
const firstValueInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledContainer>
|
||||||
|
<StyledEditInplaceInput
|
||||||
|
autoFocus
|
||||||
|
placeholder={leftValuePlaceholder}
|
||||||
|
ref={firstValueInputRef}
|
||||||
|
value={leftValue}
|
||||||
|
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
onChange(event.target.value, rightValue);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<StyledEditInplaceInput
|
||||||
|
placeholder={rightValuePlaceholder}
|
||||||
|
ref={firstValueInputRef}
|
||||||
|
value={rightValue}
|
||||||
|
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
onChange(leftValue, event.target.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</StyledContainer>
|
||||||
|
);
|
||||||
|
}
|
39
front/src/components/people/EditablePeopleFullName.tsx
Normal file
39
front/src/components/people/EditablePeopleFullName.tsx
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import PersonChip from '../chips/PersonChip';
|
||||||
|
import { EditableDoubleText } from '../editable-cell/EditableDoubleText';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
firstname: string;
|
||||||
|
lastname: string;
|
||||||
|
onChange: (firstname: string, lastname: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function EditablePeopleFullName({
|
||||||
|
firstname,
|
||||||
|
lastname,
|
||||||
|
onChange,
|
||||||
|
}: OwnProps) {
|
||||||
|
const [firstnameValue, setFirstnameValue] = useState(firstname);
|
||||||
|
const [lastnameValue, setLastnameValue] = useState(lastname);
|
||||||
|
|
||||||
|
function handleDoubleTextChange(
|
||||||
|
firstValue: string,
|
||||||
|
secondValue: string,
|
||||||
|
): void {
|
||||||
|
setFirstnameValue(firstValue);
|
||||||
|
setLastnameValue(secondValue);
|
||||||
|
|
||||||
|
onChange(firstnameValue, lastnameValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<EditableDoubleText
|
||||||
|
firstValue={firstnameValue}
|
||||||
|
secondValue={lastnameValue}
|
||||||
|
firstValuePlaceholder="First name"
|
||||||
|
secondValuePlaceholder="Last name"
|
||||||
|
onChange={handleDoubleTextChange}
|
||||||
|
nonEditModeContent={<PersonChip name={firstname + ' ' + lastname} />}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
111
front/src/components/people/PeopleCompanyCell.tsx
Normal file
111
front/src/components/people/PeopleCompanyCell.tsx
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
import {
|
||||||
|
QueryMode,
|
||||||
|
useInsertCompanyMutation,
|
||||||
|
useUpdatePeopleMutation,
|
||||||
|
} from '../../generated/graphql';
|
||||||
|
import {
|
||||||
|
Person,
|
||||||
|
mapToGqlPerson,
|
||||||
|
} from '../../interfaces/entities/person.interface';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Company,
|
||||||
|
mapToCompany,
|
||||||
|
} from '../../interfaces/entities/company.interface';
|
||||||
|
import CompanyChip, { CompanyChipPropsType } from '../chips/CompanyChip';
|
||||||
|
import EditableRelation from '../editable-cell/EditableRelation';
|
||||||
|
import { SEARCH_COMPANY_QUERY } from '../../services/api/search/search';
|
||||||
|
import { SearchConfigType } from '../../interfaces/search/interface';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import { PeopleCompanyCreateCell } from './PeopleCompanyCreateCell';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
|
export type OwnProps = {
|
||||||
|
people: Person;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function PeopleCompanyCell({ people }: OwnProps) {
|
||||||
|
const [isCreating, setIsCreating] = useState(false);
|
||||||
|
const [insertCompany] = useInsertCompanyMutation();
|
||||||
|
const [updatePeople] = useUpdatePeopleMutation();
|
||||||
|
const [initialCompanyName, setInitialCompanyName] = useState('');
|
||||||
|
|
||||||
|
async function handleCompanyCreate(
|
||||||
|
companyName: string,
|
||||||
|
companyDomainName: string,
|
||||||
|
) {
|
||||||
|
const newCompanyId = v4();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await insertCompany({
|
||||||
|
variables: {
|
||||||
|
id: newCompanyId,
|
||||||
|
name: companyName,
|
||||||
|
domain_name: companyDomainName,
|
||||||
|
address: '',
|
||||||
|
created_at: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await updatePeople({
|
||||||
|
variables: {
|
||||||
|
...mapToGqlPerson(people),
|
||||||
|
company_id: newCompanyId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
// TODO: handle error better
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsCreating(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: should be replaced with search context
|
||||||
|
function handleChangeSearchInput(searchInput: string) {
|
||||||
|
setInitialCompanyName(searchInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isCreating ? (
|
||||||
|
<PeopleCompanyCreateCell
|
||||||
|
initialCompanyName={initialCompanyName}
|
||||||
|
onCreate={handleCompanyCreate}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<EditableRelation<Company, CompanyChipPropsType>
|
||||||
|
relation={people.company}
|
||||||
|
searchPlaceholder="Company"
|
||||||
|
ChipComponent={CompanyChip}
|
||||||
|
chipComponentPropsMapper={(company): CompanyChipPropsType => {
|
||||||
|
return {
|
||||||
|
name: company.name || '',
|
||||||
|
picture: `https://www.google.com/s2/favicons?domain=${company.domainName}&sz=256`,
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
onChange={async (relation) => {
|
||||||
|
await updatePeople({
|
||||||
|
variables: {
|
||||||
|
...mapToGqlPerson(people),
|
||||||
|
company_id: relation.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
onChangeSearchInput={handleChangeSearchInput}
|
||||||
|
searchConfig={
|
||||||
|
{
|
||||||
|
query: SEARCH_COMPANY_QUERY,
|
||||||
|
template: (searchInput: string) => ({
|
||||||
|
name: { contains: `%${searchInput}%`, mode: QueryMode.Insensitive },
|
||||||
|
}),
|
||||||
|
resultMapper: (company) => ({
|
||||||
|
render: (company) => company.name,
|
||||||
|
value: mapToCompany(company),
|
||||||
|
}),
|
||||||
|
} satisfies SearchConfigType<Company>
|
||||||
|
}
|
||||||
|
onCreate={() => {
|
||||||
|
setIsCreating(true);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
57
front/src/components/people/PeopleCompanyCreateCell.tsx
Normal file
57
front/src/components/people/PeopleCompanyCreateCell.tsx
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import { useRef, useState } from 'react';
|
||||||
|
import { DoubleTextInput } from '../inputs/DoubleTextInput';
|
||||||
|
import { useListenClickOutsideArrayOfRef } from '../../modules/ui/hooks/useListenClickOutsideArrayOfRef';
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
|
import { CellBaseContainer } from '../editable-cell/CellBaseContainer';
|
||||||
|
import { CellEditModeContainer } from '../editable-cell/CellEditModeContainer';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
initialCompanyName: string;
|
||||||
|
onCreate: (companyName: string, companyDomainName: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function PeopleCompanyCreateCell({
|
||||||
|
initialCompanyName,
|
||||||
|
onCreate,
|
||||||
|
}: OwnProps) {
|
||||||
|
const [companyName, setCompanyName] = useState(initialCompanyName);
|
||||||
|
const [companyDomainName, setCompanyDomainName] = useState('');
|
||||||
|
|
||||||
|
const containerRef = useRef(null);
|
||||||
|
|
||||||
|
useListenClickOutsideArrayOfRef([containerRef], () => {
|
||||||
|
onCreate(companyName, companyDomainName);
|
||||||
|
});
|
||||||
|
|
||||||
|
useHotkeys(
|
||||||
|
'enter, escape',
|
||||||
|
() => {
|
||||||
|
onCreate(companyName, companyDomainName);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enableOnFormTags: true,
|
||||||
|
enableOnContentEditable: true,
|
||||||
|
preventDefault: true,
|
||||||
|
},
|
||||||
|
[containerRef, companyName, companyDomainName, onCreate],
|
||||||
|
);
|
||||||
|
|
||||||
|
function handleDoubleTextChange(leftValue: string, rightValue: string): void {
|
||||||
|
setCompanyDomainName(leftValue);
|
||||||
|
setCompanyName(rightValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CellBaseContainer ref={containerRef}>
|
||||||
|
<CellEditModeContainer editModeVerticalPosition="over">
|
||||||
|
<DoubleTextInput
|
||||||
|
leftValue={companyDomainName}
|
||||||
|
rightValue={companyName}
|
||||||
|
leftValuePlaceholder="URL"
|
||||||
|
rightValuePlaceholder="Name"
|
||||||
|
onChange={handleDoubleTextChange}
|
||||||
|
/>
|
||||||
|
</CellEditModeContainer>
|
||||||
|
</CellBaseContainer>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import { isDefined } from '../../utils/type-guards/isDefined';
|
||||||
|
|
||||||
|
export function useListenClickOutsideArrayOfRef<T extends HTMLElement>(
|
||||||
|
arrayOfRef: Array<React.RefObject<T>>,
|
||||||
|
outsideClickCallback: (event?: MouseEvent) => void,
|
||||||
|
) {
|
||||||
|
useEffect(() => {
|
||||||
|
function handleClickOutside(event: any) {
|
||||||
|
const clickedOnAtLeastOneRef = arrayOfRef
|
||||||
|
.filter((ref) => !!ref.current)
|
||||||
|
.some((ref) => ref.current?.contains(event.target as Node));
|
||||||
|
|
||||||
|
if (!clickedOnAtLeastOneRef) {
|
||||||
|
outsideClickCallback(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasAtLeastOneRefDefined = arrayOfRef.some((ref) =>
|
||||||
|
isDefined(ref.current),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hasAtLeastOneRefDefined) {
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
document.addEventListener('touchstart', handleClickOutside);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
document.removeEventListener('touchstart', handleClickOutside);
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [arrayOfRef, outsideClickCallback]);
|
||||||
|
}
|
12
front/src/modules/utils/debounce.ts
Normal file
12
front/src/modules/utils/debounce.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export const debounce = <FuncArgs extends any[]>(
|
||||||
|
func: (...args: FuncArgs) => void,
|
||||||
|
delay: number,
|
||||||
|
) => {
|
||||||
|
let timeoutId: ReturnType<typeof setTimeout>;
|
||||||
|
return (...args: FuncArgs) => {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
timeoutId = setTimeout(() => {
|
||||||
|
func(...args);
|
||||||
|
}, delay);
|
||||||
|
};
|
||||||
|
};
|
5
front/src/modules/utils/type-guards/isDefined.ts
Normal file
5
front/src/modules/utils/type-guards/isDefined.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export function isDefined<T>(
|
||||||
|
value: T | undefined | null,
|
||||||
|
): value is NonNullable<T> {
|
||||||
|
return value !== undefined && value !== null;
|
||||||
|
}
|
13
front/src/modules/utils/type-guards/isNonEmptyArray.ts
Normal file
13
front/src/modules/utils/type-guards/isNonEmptyArray.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export function isNonEmptyArray<T>(
|
||||||
|
probableArray: T[] | undefined | null,
|
||||||
|
): probableArray is NonNullable<T[]> {
|
||||||
|
if (
|
||||||
|
Array.isArray(probableArray) &&
|
||||||
|
probableArray.length &&
|
||||||
|
probableArray.length > 0
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
15
front/src/modules/utils/type-guards/isNonEmptyString.ts
Normal file
15
front/src/modules/utils/type-guards/isNonEmptyString.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { isDefined } from './isDefined';
|
||||||
|
|
||||||
|
export function isNonEmptyString(
|
||||||
|
probableNonEmptyString: string | undefined | null,
|
||||||
|
): probableNonEmptyString is string {
|
||||||
|
if (
|
||||||
|
isDefined(probableNonEmptyString) &&
|
||||||
|
typeof probableNonEmptyString === 'string' &&
|
||||||
|
probableNonEmptyString !== ''
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
@ -161,7 +161,7 @@ export const useCompaniesColumns = () => {
|
|||||||
name: accountOwner.displayName || '',
|
name: accountOwner.displayName || '',
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
changeHandler={(relation: User) => {
|
onChange={(relation: User) => {
|
||||||
const company = props.row.original;
|
const company = props.row.original;
|
||||||
if (company.accountOwner) {
|
if (company.accountOwner) {
|
||||||
company.accountOwner.id = relation.id;
|
company.accountOwner.id = relation.id;
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { CellContext, createColumnHelper } from '@tanstack/react-table';
|
import { CellContext, createColumnHelper } from '@tanstack/react-table';
|
||||||
|
|
||||||
import { SEARCH_COMPANY_QUERY } from '../../services/api/search/search';
|
|
||||||
import { SearchConfigType } from '../../interfaces/search/interface';
|
|
||||||
|
|
||||||
import {
|
|
||||||
Company,
|
|
||||||
mapToCompany,
|
|
||||||
} from '../../interfaces/entities/company.interface';
|
|
||||||
import { Person } from '../../interfaces/entities/person.interface';
|
import { Person } from '../../interfaces/entities/person.interface';
|
||||||
import { updatePerson } from '../../services/api/people';
|
import { updatePerson } from '../../services/api/people';
|
||||||
|
|
||||||
@ -15,13 +7,9 @@ import ColumnHead from '../../components/table/ColumnHead';
|
|||||||
import Checkbox from '../../components/form/Checkbox';
|
import Checkbox from '../../components/form/Checkbox';
|
||||||
import { SelectAllCheckbox } from '../../components/table/SelectAllCheckbox';
|
import { SelectAllCheckbox } from '../../components/table/SelectAllCheckbox';
|
||||||
import EditablePhone from '../../components/editable-cell/EditablePhone';
|
import EditablePhone from '../../components/editable-cell/EditablePhone';
|
||||||
import EditableFullName from '../../components/editable-cell/EditableFullName';
|
import { EditablePeopleFullName } from '../../components/people/EditablePeopleFullName';
|
||||||
import EditableDate from '../../components/editable-cell/EditableDate';
|
import EditableDate from '../../components/editable-cell/EditableDate';
|
||||||
import EditableText from '../../components/editable-cell/EditableText';
|
import EditableText from '../../components/editable-cell/EditableText';
|
||||||
import EditableRelation from '../../components/editable-cell/EditableRelation';
|
|
||||||
import CompanyChip, {
|
|
||||||
CompanyChipPropsType,
|
|
||||||
} from '../../components/chips/CompanyChip';
|
|
||||||
import {
|
import {
|
||||||
TbBuilding,
|
TbBuilding,
|
||||||
TbCalendar,
|
TbCalendar,
|
||||||
@ -30,7 +18,7 @@ import {
|
|||||||
TbPhone,
|
TbPhone,
|
||||||
TbUser,
|
TbUser,
|
||||||
} from 'react-icons/tb';
|
} from 'react-icons/tb';
|
||||||
import { QueryMode } from '../../generated/graphql';
|
import { PeopleCompanyCell } from '../../components/people/PeopleCompanyCell';
|
||||||
|
|
||||||
const columnHelper = createColumnHelper<Person>();
|
const columnHelper = createColumnHelper<Person>();
|
||||||
|
|
||||||
@ -61,14 +49,15 @@ export const usePeopleColumns = () => {
|
|||||||
<ColumnHead viewName="People" viewIcon={<TbUser size={16} />} />
|
<ColumnHead viewName="People" viewIcon={<TbUser size={16} />} />
|
||||||
),
|
),
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<EditableFullName
|
<EditablePeopleFullName
|
||||||
firstname={props.row.original.firstname || ''}
|
firstname={props.row.original.firstname || ''}
|
||||||
lastname={props.row.original.lastname || ''}
|
lastname={props.row.original.lastname || ''}
|
||||||
changeHandler={(firstName: string, lastName: string) => {
|
onChange={async (firstName: string, lastName: string) => {
|
||||||
const person = props.row.original;
|
const person = props.row.original;
|
||||||
person.firstname = firstName;
|
person.firstname = firstName;
|
||||||
person.lastname = lastName;
|
person.lastname = lastName;
|
||||||
updatePerson(person);
|
const returnedOptimisticResponse = await updatePerson(person);
|
||||||
|
console.log({ returnedOptimisticResponse });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@ -95,43 +84,7 @@ export const usePeopleColumns = () => {
|
|||||||
header: () => (
|
header: () => (
|
||||||
<ColumnHead viewName="Company" viewIcon={<TbBuilding size={16} />} />
|
<ColumnHead viewName="Company" viewIcon={<TbBuilding size={16} />} />
|
||||||
),
|
),
|
||||||
cell: (props) => (
|
cell: (props) => <PeopleCompanyCell people={props.row.original} />,
|
||||||
<EditableRelation<Company, CompanyChipPropsType>
|
|
||||||
relation={props.row.original.company}
|
|
||||||
searchPlaceholder="Company"
|
|
||||||
ChipComponent={CompanyChip}
|
|
||||||
chipComponentPropsMapper={(company): CompanyChipPropsType => {
|
|
||||||
return {
|
|
||||||
name: company.name || '',
|
|
||||||
picture: `https://www.google.com/s2/favicons?domain=${company.domainName}&sz=256`,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
changeHandler={(relation) => {
|
|
||||||
const person = props.row.original;
|
|
||||||
if (person.company) {
|
|
||||||
person.company.id = relation.id;
|
|
||||||
} else {
|
|
||||||
person.company = relation;
|
|
||||||
}
|
|
||||||
updatePerson(person);
|
|
||||||
}}
|
|
||||||
searchConfig={
|
|
||||||
{
|
|
||||||
query: SEARCH_COMPANY_QUERY,
|
|
||||||
template: (searchInput: string) => ({
|
|
||||||
name: {
|
|
||||||
contains: `%${searchInput}%`,
|
|
||||||
mode: QueryMode.Insensitive,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
resultMapper: (company) => ({
|
|
||||||
render: (company) => company.name,
|
|
||||||
value: mapToCompany(company),
|
|
||||||
}),
|
|
||||||
} satisfies SearchConfigType<Company>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
size: 150,
|
size: 150,
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor('phone', {
|
columnHelper.accessor('phone', {
|
||||||
|
@ -99,6 +99,41 @@ export async function updatePerson(
|
|||||||
const result = await apiClient.mutate({
|
const result = await apiClient.mutate({
|
||||||
mutation: UPDATE_PERSON,
|
mutation: UPDATE_PERSON,
|
||||||
variables: mapToGqlPerson(person),
|
variables: mapToGqlPerson(person),
|
||||||
|
|
||||||
|
// TODO: use a mapper?
|
||||||
|
optimisticResponse: {
|
||||||
|
__typename: 'people' as const,
|
||||||
|
id: person.id,
|
||||||
|
update_people: {
|
||||||
|
returning: {
|
||||||
|
id: person.id,
|
||||||
|
city: 'TEST',
|
||||||
|
company: {
|
||||||
|
domain_name: person.company?.domainName,
|
||||||
|
name: person.company?.name,
|
||||||
|
id: person.company?.id,
|
||||||
|
},
|
||||||
|
email: person.email,
|
||||||
|
firstname: person.firstname,
|
||||||
|
lastname: person.lastname,
|
||||||
|
phone: person.phone,
|
||||||
|
created_at: person.creationDate,
|
||||||
|
|
||||||
|
// city
|
||||||
|
// company {
|
||||||
|
// domain_name
|
||||||
|
// name
|
||||||
|
// id
|
||||||
|
// }
|
||||||
|
// email
|
||||||
|
// firstname
|
||||||
|
// id
|
||||||
|
// lastname
|
||||||
|
// phone
|
||||||
|
// created_at
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
AnyEntity,
|
AnyEntity,
|
||||||
UnknownType,
|
UnknownType,
|
||||||
} from '../../../interfaces/entities/generic.interface';
|
} from '../../../interfaces/entities/generic.interface';
|
||||||
|
import { debounce } from '../../../modules/utils/debounce';
|
||||||
|
|
||||||
export const SEARCH_PEOPLE_QUERY = gql`
|
export const SEARCH_PEOPLE_QUERY = gql`
|
||||||
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
|
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
|
||||||
@ -48,19 +49,6 @@ export const SEARCH_COMPANY_QUERY = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const debounce = <FuncArgs extends any[]>(
|
|
||||||
func: (...args: FuncArgs) => void,
|
|
||||||
delay: number,
|
|
||||||
) => {
|
|
||||||
let timeoutId: ReturnType<typeof setTimeout>;
|
|
||||||
return (...args: FuncArgs) => {
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
timeoutId = setTimeout(() => {
|
|
||||||
func(...args);
|
|
||||||
}, delay);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type SearchResultsType<T extends AnyEntity | UnknownType = UnknownType> =
|
export type SearchResultsType<T extends AnyEntity | UnknownType = UnknownType> =
|
||||||
{
|
{
|
||||||
results: {
|
results: {
|
||||||
@ -74,6 +62,7 @@ export const useSearch = <T extends AnyEntity | UnknownType = UnknownType>(): [
|
|||||||
SearchResultsType<T>,
|
SearchResultsType<T>,
|
||||||
React.Dispatch<React.SetStateAction<string>>,
|
React.Dispatch<React.SetStateAction<string>>,
|
||||||
React.Dispatch<React.SetStateAction<SearchConfigType<T> | null>>,
|
React.Dispatch<React.SetStateAction<SearchConfigType<T> | null>>,
|
||||||
|
string,
|
||||||
] => {
|
] => {
|
||||||
const [searchConfig, setSearchConfig] = useState<SearchConfigType<T> | null>(
|
const [searchConfig, setSearchConfig] = useState<SearchConfigType<T> | null>(
|
||||||
null,
|
null,
|
||||||
@ -81,7 +70,7 @@ export const useSearch = <T extends AnyEntity | UnknownType = UnknownType>(): [
|
|||||||
const [searchInput, setSearchInput] = useState<string>('');
|
const [searchInput, setSearchInput] = useState<string>('');
|
||||||
|
|
||||||
const debouncedsetSearchInput = useMemo(
|
const debouncedsetSearchInput = useMemo(
|
||||||
() => debounce(setSearchInput, 500),
|
() => debounce(setSearchInput, 50),
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -119,11 +108,12 @@ export const useSearch = <T extends AnyEntity | UnknownType = UnknownType>(): [
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
results: searchQueryResults.data.searchResults.map(
|
// TODO: add proper typing
|
||||||
|
results: searchQueryResults?.data?.searchResults?.map(
|
||||||
searchConfig.resultMapper,
|
searchConfig.resultMapper,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}, [searchConfig, searchQueryResults]);
|
}, [searchConfig, searchQueryResults]);
|
||||||
|
|
||||||
return [searchResults, debouncedsetSearchInput, setSearchConfig];
|
return [searchResults, debouncedsetSearchInput, setSearchConfig, searchInput];
|
||||||
};
|
};
|
||||||
|
795
server/src/api/graphql/enhance.ts
Normal file
795
server/src/api/graphql/enhance.ts
Normal file
@ -0,0 +1,795 @@
|
|||||||
|
import { ClassType } from "type-graphql";
|
||||||
|
import * as tslib from "tslib";
|
||||||
|
import * as crudResolvers from "./resolvers/crud/resolvers-crud.index";
|
||||||
|
import * as argsTypes from "./resolvers/crud/args.index";
|
||||||
|
import * as actionResolvers from "./resolvers/crud/resolvers-actions.index";
|
||||||
|
import * as relationResolvers from "./resolvers/relations/resolvers.index";
|
||||||
|
import * as models from "./models";
|
||||||
|
import * as outputTypes from "./resolvers/outputs";
|
||||||
|
import * as inputTypes from "./resolvers/inputs";
|
||||||
|
|
||||||
|
export type MethodDecoratorOverrideFn = (decorators: MethodDecorator[]) => MethodDecorator[];
|
||||||
|
|
||||||
|
const crudResolversMap = {
|
||||||
|
User: crudResolvers.UserCrudResolver,
|
||||||
|
Workspace: crudResolvers.WorkspaceCrudResolver,
|
||||||
|
WorkspaceMember: crudResolvers.WorkspaceMemberCrudResolver,
|
||||||
|
Company: crudResolvers.CompanyCrudResolver,
|
||||||
|
Person: crudResolvers.PersonCrudResolver,
|
||||||
|
RefreshToken: crudResolvers.RefreshTokenCrudResolver
|
||||||
|
};
|
||||||
|
const actionResolversMap = {
|
||||||
|
User: {
|
||||||
|
aggregateUser: actionResolvers.AggregateUserResolver,
|
||||||
|
createManyUser: actionResolvers.CreateManyUserResolver,
|
||||||
|
createOneUser: actionResolvers.CreateOneUserResolver,
|
||||||
|
deleteManyUser: actionResolvers.DeleteManyUserResolver,
|
||||||
|
deleteOneUser: actionResolvers.DeleteOneUserResolver,
|
||||||
|
findFirstUser: actionResolvers.FindFirstUserResolver,
|
||||||
|
findFirstUserOrThrow: actionResolvers.FindFirstUserOrThrowResolver,
|
||||||
|
users: actionResolvers.FindManyUserResolver,
|
||||||
|
user: actionResolvers.FindUniqueUserResolver,
|
||||||
|
getUser: actionResolvers.FindUniqueUserOrThrowResolver,
|
||||||
|
groupByUser: actionResolvers.GroupByUserResolver,
|
||||||
|
updateManyUser: actionResolvers.UpdateManyUserResolver,
|
||||||
|
updateOneUser: actionResolvers.UpdateOneUserResolver,
|
||||||
|
upsertOneUser: actionResolvers.UpsertOneUserResolver
|
||||||
|
},
|
||||||
|
Workspace: {
|
||||||
|
aggregateWorkspace: actionResolvers.AggregateWorkspaceResolver,
|
||||||
|
createManyWorkspace: actionResolvers.CreateManyWorkspaceResolver,
|
||||||
|
createOneWorkspace: actionResolvers.CreateOneWorkspaceResolver,
|
||||||
|
deleteManyWorkspace: actionResolvers.DeleteManyWorkspaceResolver,
|
||||||
|
deleteOneWorkspace: actionResolvers.DeleteOneWorkspaceResolver,
|
||||||
|
findFirstWorkspace: actionResolvers.FindFirstWorkspaceResolver,
|
||||||
|
findFirstWorkspaceOrThrow: actionResolvers.FindFirstWorkspaceOrThrowResolver,
|
||||||
|
workspaces: actionResolvers.FindManyWorkspaceResolver,
|
||||||
|
workspace: actionResolvers.FindUniqueWorkspaceResolver,
|
||||||
|
getWorkspace: actionResolvers.FindUniqueWorkspaceOrThrowResolver,
|
||||||
|
groupByWorkspace: actionResolvers.GroupByWorkspaceResolver,
|
||||||
|
updateManyWorkspace: actionResolvers.UpdateManyWorkspaceResolver,
|
||||||
|
updateOneWorkspace: actionResolvers.UpdateOneWorkspaceResolver,
|
||||||
|
upsertOneWorkspace: actionResolvers.UpsertOneWorkspaceResolver
|
||||||
|
},
|
||||||
|
WorkspaceMember: {
|
||||||
|
aggregateWorkspaceMember: actionResolvers.AggregateWorkspaceMemberResolver,
|
||||||
|
createManyWorkspaceMember: actionResolvers.CreateManyWorkspaceMemberResolver,
|
||||||
|
createOneWorkspaceMember: actionResolvers.CreateOneWorkspaceMemberResolver,
|
||||||
|
deleteManyWorkspaceMember: actionResolvers.DeleteManyWorkspaceMemberResolver,
|
||||||
|
deleteOneWorkspaceMember: actionResolvers.DeleteOneWorkspaceMemberResolver,
|
||||||
|
findFirstWorkspaceMember: actionResolvers.FindFirstWorkspaceMemberResolver,
|
||||||
|
findFirstWorkspaceMemberOrThrow: actionResolvers.FindFirstWorkspaceMemberOrThrowResolver,
|
||||||
|
workspaceMembers: actionResolvers.FindManyWorkspaceMemberResolver,
|
||||||
|
workspaceMember: actionResolvers.FindUniqueWorkspaceMemberResolver,
|
||||||
|
getWorkspaceMember: actionResolvers.FindUniqueWorkspaceMemberOrThrowResolver,
|
||||||
|
groupByWorkspaceMember: actionResolvers.GroupByWorkspaceMemberResolver,
|
||||||
|
updateManyWorkspaceMember: actionResolvers.UpdateManyWorkspaceMemberResolver,
|
||||||
|
updateOneWorkspaceMember: actionResolvers.UpdateOneWorkspaceMemberResolver,
|
||||||
|
upsertOneWorkspaceMember: actionResolvers.UpsertOneWorkspaceMemberResolver
|
||||||
|
},
|
||||||
|
Company: {
|
||||||
|
aggregateCompany: actionResolvers.AggregateCompanyResolver,
|
||||||
|
createManyCompany: actionResolvers.CreateManyCompanyResolver,
|
||||||
|
createOneCompany: actionResolvers.CreateOneCompanyResolver,
|
||||||
|
deleteManyCompany: actionResolvers.DeleteManyCompanyResolver,
|
||||||
|
deleteOneCompany: actionResolvers.DeleteOneCompanyResolver,
|
||||||
|
findFirstCompany: actionResolvers.FindFirstCompanyResolver,
|
||||||
|
findFirstCompanyOrThrow: actionResolvers.FindFirstCompanyOrThrowResolver,
|
||||||
|
companies: actionResolvers.FindManyCompanyResolver,
|
||||||
|
company: actionResolvers.FindUniqueCompanyResolver,
|
||||||
|
getCompany: actionResolvers.FindUniqueCompanyOrThrowResolver,
|
||||||
|
groupByCompany: actionResolvers.GroupByCompanyResolver,
|
||||||
|
updateManyCompany: actionResolvers.UpdateManyCompanyResolver,
|
||||||
|
updateOneCompany: actionResolvers.UpdateOneCompanyResolver,
|
||||||
|
upsertOneCompany: actionResolvers.UpsertOneCompanyResolver
|
||||||
|
},
|
||||||
|
Person: {
|
||||||
|
aggregatePerson: actionResolvers.AggregatePersonResolver,
|
||||||
|
createManyPerson: actionResolvers.CreateManyPersonResolver,
|
||||||
|
createOnePerson: actionResolvers.CreateOnePersonResolver,
|
||||||
|
deleteManyPerson: actionResolvers.DeleteManyPersonResolver,
|
||||||
|
deleteOnePerson: actionResolvers.DeleteOnePersonResolver,
|
||||||
|
findFirstPerson: actionResolvers.FindFirstPersonResolver,
|
||||||
|
findFirstPersonOrThrow: actionResolvers.FindFirstPersonOrThrowResolver,
|
||||||
|
people: actionResolvers.FindManyPersonResolver,
|
||||||
|
person: actionResolvers.FindUniquePersonResolver,
|
||||||
|
getPerson: actionResolvers.FindUniquePersonOrThrowResolver,
|
||||||
|
groupByPerson: actionResolvers.GroupByPersonResolver,
|
||||||
|
updateManyPerson: actionResolvers.UpdateManyPersonResolver,
|
||||||
|
updateOnePerson: actionResolvers.UpdateOnePersonResolver,
|
||||||
|
upsertOnePerson: actionResolvers.UpsertOnePersonResolver
|
||||||
|
},
|
||||||
|
RefreshToken: {
|
||||||
|
aggregateRefreshToken: actionResolvers.AggregateRefreshTokenResolver,
|
||||||
|
createManyRefreshToken: actionResolvers.CreateManyRefreshTokenResolver,
|
||||||
|
createOneRefreshToken: actionResolvers.CreateOneRefreshTokenResolver,
|
||||||
|
deleteManyRefreshToken: actionResolvers.DeleteManyRefreshTokenResolver,
|
||||||
|
deleteOneRefreshToken: actionResolvers.DeleteOneRefreshTokenResolver,
|
||||||
|
findFirstRefreshToken: actionResolvers.FindFirstRefreshTokenResolver,
|
||||||
|
findFirstRefreshTokenOrThrow: actionResolvers.FindFirstRefreshTokenOrThrowResolver,
|
||||||
|
refreshTokens: actionResolvers.FindManyRefreshTokenResolver,
|
||||||
|
refreshToken: actionResolvers.FindUniqueRefreshTokenResolver,
|
||||||
|
getRefreshToken: actionResolvers.FindUniqueRefreshTokenOrThrowResolver,
|
||||||
|
groupByRefreshToken: actionResolvers.GroupByRefreshTokenResolver,
|
||||||
|
updateManyRefreshToken: actionResolvers.UpdateManyRefreshTokenResolver,
|
||||||
|
updateOneRefreshToken: actionResolvers.UpdateOneRefreshTokenResolver,
|
||||||
|
upsertOneRefreshToken: actionResolvers.UpsertOneRefreshTokenResolver
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const crudResolversInfo = {
|
||||||
|
User: ["aggregateUser", "createManyUser", "createOneUser", "deleteManyUser", "deleteOneUser", "findFirstUser", "findFirstUserOrThrow", "users", "user", "getUser", "groupByUser", "updateManyUser", "updateOneUser", "upsertOneUser"],
|
||||||
|
Workspace: ["aggregateWorkspace", "createManyWorkspace", "createOneWorkspace", "deleteManyWorkspace", "deleteOneWorkspace", "findFirstWorkspace", "findFirstWorkspaceOrThrow", "workspaces", "workspace", "getWorkspace", "groupByWorkspace", "updateManyWorkspace", "updateOneWorkspace", "upsertOneWorkspace"],
|
||||||
|
WorkspaceMember: ["aggregateWorkspaceMember", "createManyWorkspaceMember", "createOneWorkspaceMember", "deleteManyWorkspaceMember", "deleteOneWorkspaceMember", "findFirstWorkspaceMember", "findFirstWorkspaceMemberOrThrow", "workspaceMembers", "workspaceMember", "getWorkspaceMember", "groupByWorkspaceMember", "updateManyWorkspaceMember", "updateOneWorkspaceMember", "upsertOneWorkspaceMember"],
|
||||||
|
Company: ["aggregateCompany", "createManyCompany", "createOneCompany", "deleteManyCompany", "deleteOneCompany", "findFirstCompany", "findFirstCompanyOrThrow", "companies", "company", "getCompany", "groupByCompany", "updateManyCompany", "updateOneCompany", "upsertOneCompany"],
|
||||||
|
Person: ["aggregatePerson", "createManyPerson", "createOnePerson", "deleteManyPerson", "deleteOnePerson", "findFirstPerson", "findFirstPersonOrThrow", "people", "person", "getPerson", "groupByPerson", "updateManyPerson", "updateOnePerson", "upsertOnePerson"],
|
||||||
|
RefreshToken: ["aggregateRefreshToken", "createManyRefreshToken", "createOneRefreshToken", "deleteManyRefreshToken", "deleteOneRefreshToken", "findFirstRefreshToken", "findFirstRefreshTokenOrThrow", "refreshTokens", "refreshToken", "getRefreshToken", "groupByRefreshToken", "updateManyRefreshToken", "updateOneRefreshToken", "upsertOneRefreshToken"]
|
||||||
|
};
|
||||||
|
const argsInfo = {
|
||||||
|
AggregateUserArgs: ["where", "orderBy", "cursor", "take", "skip"],
|
||||||
|
CreateManyUserArgs: ["data", "skipDuplicates"],
|
||||||
|
CreateOneUserArgs: ["data"],
|
||||||
|
DeleteManyUserArgs: ["where"],
|
||||||
|
DeleteOneUserArgs: ["where"],
|
||||||
|
FindFirstUserArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindFirstUserOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindManyUserArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindUniqueUserArgs: ["where"],
|
||||||
|
FindUniqueUserOrThrowArgs: ["where"],
|
||||||
|
GroupByUserArgs: ["where", "orderBy", "by", "having", "take", "skip"],
|
||||||
|
UpdateManyUserArgs: ["data", "where"],
|
||||||
|
UpdateOneUserArgs: ["data", "where"],
|
||||||
|
UpsertOneUserArgs: ["where", "create", "update"],
|
||||||
|
AggregateWorkspaceArgs: ["where", "orderBy", "cursor", "take", "skip"],
|
||||||
|
CreateManyWorkspaceArgs: ["data", "skipDuplicates"],
|
||||||
|
CreateOneWorkspaceArgs: ["data"],
|
||||||
|
DeleteManyWorkspaceArgs: ["where"],
|
||||||
|
DeleteOneWorkspaceArgs: ["where"],
|
||||||
|
FindFirstWorkspaceArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindFirstWorkspaceOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindManyWorkspaceArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindUniqueWorkspaceArgs: ["where"],
|
||||||
|
FindUniqueWorkspaceOrThrowArgs: ["where"],
|
||||||
|
GroupByWorkspaceArgs: ["where", "orderBy", "by", "having", "take", "skip"],
|
||||||
|
UpdateManyWorkspaceArgs: ["data", "where"],
|
||||||
|
UpdateOneWorkspaceArgs: ["data", "where"],
|
||||||
|
UpsertOneWorkspaceArgs: ["where", "create", "update"],
|
||||||
|
AggregateWorkspaceMemberArgs: ["where", "orderBy", "cursor", "take", "skip"],
|
||||||
|
CreateManyWorkspaceMemberArgs: ["data", "skipDuplicates"],
|
||||||
|
CreateOneWorkspaceMemberArgs: ["data"],
|
||||||
|
DeleteManyWorkspaceMemberArgs: ["where"],
|
||||||
|
DeleteOneWorkspaceMemberArgs: ["where"],
|
||||||
|
FindFirstWorkspaceMemberArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindFirstWorkspaceMemberOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindManyWorkspaceMemberArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindUniqueWorkspaceMemberArgs: ["where"],
|
||||||
|
FindUniqueWorkspaceMemberOrThrowArgs: ["where"],
|
||||||
|
GroupByWorkspaceMemberArgs: ["where", "orderBy", "by", "having", "take", "skip"],
|
||||||
|
UpdateManyWorkspaceMemberArgs: ["data", "where"],
|
||||||
|
UpdateOneWorkspaceMemberArgs: ["data", "where"],
|
||||||
|
UpsertOneWorkspaceMemberArgs: ["where", "create", "update"],
|
||||||
|
AggregateCompanyArgs: ["where", "orderBy", "cursor", "take", "skip"],
|
||||||
|
CreateManyCompanyArgs: ["data", "skipDuplicates"],
|
||||||
|
CreateOneCompanyArgs: ["data"],
|
||||||
|
DeleteManyCompanyArgs: ["where"],
|
||||||
|
DeleteOneCompanyArgs: ["where"],
|
||||||
|
FindFirstCompanyArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindFirstCompanyOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindManyCompanyArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindUniqueCompanyArgs: ["where"],
|
||||||
|
FindUniqueCompanyOrThrowArgs: ["where"],
|
||||||
|
GroupByCompanyArgs: ["where", "orderBy", "by", "having", "take", "skip"],
|
||||||
|
UpdateManyCompanyArgs: ["data", "where"],
|
||||||
|
UpdateOneCompanyArgs: ["data", "where"],
|
||||||
|
UpsertOneCompanyArgs: ["where", "create", "update"],
|
||||||
|
AggregatePersonArgs: ["where", "orderBy", "cursor", "take", "skip"],
|
||||||
|
CreateManyPersonArgs: ["data", "skipDuplicates"],
|
||||||
|
CreateOnePersonArgs: ["data"],
|
||||||
|
DeleteManyPersonArgs: ["where"],
|
||||||
|
DeleteOnePersonArgs: ["where"],
|
||||||
|
FindFirstPersonArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindFirstPersonOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindManyPersonArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindUniquePersonArgs: ["where"],
|
||||||
|
FindUniquePersonOrThrowArgs: ["where"],
|
||||||
|
GroupByPersonArgs: ["where", "orderBy", "by", "having", "take", "skip"],
|
||||||
|
UpdateManyPersonArgs: ["data", "where"],
|
||||||
|
UpdateOnePersonArgs: ["data", "where"],
|
||||||
|
UpsertOnePersonArgs: ["where", "create", "update"],
|
||||||
|
AggregateRefreshTokenArgs: ["where", "orderBy", "cursor", "take", "skip"],
|
||||||
|
CreateManyRefreshTokenArgs: ["data", "skipDuplicates"],
|
||||||
|
CreateOneRefreshTokenArgs: ["data"],
|
||||||
|
DeleteManyRefreshTokenArgs: ["where"],
|
||||||
|
DeleteOneRefreshTokenArgs: ["where"],
|
||||||
|
FindFirstRefreshTokenArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindFirstRefreshTokenOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindManyRefreshTokenArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
|
||||||
|
FindUniqueRefreshTokenArgs: ["where"],
|
||||||
|
FindUniqueRefreshTokenOrThrowArgs: ["where"],
|
||||||
|
GroupByRefreshTokenArgs: ["where", "orderBy", "by", "having", "take", "skip"],
|
||||||
|
UpdateManyRefreshTokenArgs: ["data", "where"],
|
||||||
|
UpdateOneRefreshTokenArgs: ["data", "where"],
|
||||||
|
UpsertOneRefreshTokenArgs: ["where", "create", "update"]
|
||||||
|
};
|
||||||
|
|
||||||
|
type ResolverModelNames = keyof typeof crudResolversMap;
|
||||||
|
|
||||||
|
type ModelResolverActionNames<
|
||||||
|
TModel extends ResolverModelNames
|
||||||
|
> = keyof typeof crudResolversMap[TModel]["prototype"];
|
||||||
|
|
||||||
|
export type ResolverActionsConfig<
|
||||||
|
TModel extends ResolverModelNames
|
||||||
|
> = Partial<Record<ModelResolverActionNames<TModel>, MethodDecorator[] | MethodDecoratorOverrideFn>>
|
||||||
|
& {
|
||||||
|
_all?: MethodDecorator[];
|
||||||
|
_query?: MethodDecorator[];
|
||||||
|
_mutation?: MethodDecorator[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ResolversEnhanceMap = {
|
||||||
|
[TModel in ResolverModelNames]?: ResolverActionsConfig<TModel>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function applyResolversEnhanceMap(
|
||||||
|
resolversEnhanceMap: ResolversEnhanceMap,
|
||||||
|
) {
|
||||||
|
const mutationOperationPrefixes = [
|
||||||
|
"createOne", "createMany", "deleteOne", "updateOne", "deleteMany", "updateMany", "upsertOne"
|
||||||
|
];
|
||||||
|
for (const resolversEnhanceMapKey of Object.keys(resolversEnhanceMap)) {
|
||||||
|
const modelName = resolversEnhanceMapKey as keyof typeof resolversEnhanceMap;
|
||||||
|
const crudTarget = crudResolversMap[modelName].prototype;
|
||||||
|
const resolverActionsConfig = resolversEnhanceMap[modelName]!;
|
||||||
|
const actionResolversConfig = actionResolversMap[modelName];
|
||||||
|
const allActionsDecorators = resolverActionsConfig._all;
|
||||||
|
const resolverActionNames = crudResolversInfo[modelName as keyof typeof crudResolversInfo];
|
||||||
|
for (const resolverActionName of resolverActionNames) {
|
||||||
|
const maybeDecoratorsOrFn = resolverActionsConfig[
|
||||||
|
resolverActionName as keyof typeof resolverActionsConfig
|
||||||
|
] as MethodDecorator[] | MethodDecoratorOverrideFn | undefined;
|
||||||
|
const isWriteOperation = mutationOperationPrefixes.some(prefix => resolverActionName.startsWith(prefix));
|
||||||
|
const operationKindDecorators = isWriteOperation ? resolverActionsConfig._mutation : resolverActionsConfig._query;
|
||||||
|
const mainDecorators = [
|
||||||
|
...allActionsDecorators ?? [],
|
||||||
|
...operationKindDecorators ?? [],
|
||||||
|
]
|
||||||
|
let decorators: MethodDecorator[];
|
||||||
|
if (typeof maybeDecoratorsOrFn === "function") {
|
||||||
|
decorators = maybeDecoratorsOrFn(mainDecorators);
|
||||||
|
} else {
|
||||||
|
decorators = [...mainDecorators, ...maybeDecoratorsOrFn ?? []];
|
||||||
|
}
|
||||||
|
const actionTarget = (actionResolversConfig[
|
||||||
|
resolverActionName as keyof typeof actionResolversConfig
|
||||||
|
] as Function).prototype;
|
||||||
|
tslib.__decorate(decorators, crudTarget, resolverActionName, null);
|
||||||
|
tslib.__decorate(decorators, actionTarget, resolverActionName, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsTypesNames = keyof typeof argsTypes;
|
||||||
|
|
||||||
|
type ArgFieldNames<TArgsType extends ArgsTypesNames> = Exclude<
|
||||||
|
keyof typeof argsTypes[TArgsType]["prototype"],
|
||||||
|
number | symbol
|
||||||
|
>;
|
||||||
|
|
||||||
|
type ArgFieldsConfig<
|
||||||
|
TArgsType extends ArgsTypesNames
|
||||||
|
> = FieldsConfig<ArgFieldNames<TArgsType>>;
|
||||||
|
|
||||||
|
export type ArgConfig<TArgsType extends ArgsTypesNames> = {
|
||||||
|
class?: ClassDecorator[];
|
||||||
|
fields?: ArgFieldsConfig<TArgsType>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ArgsTypesEnhanceMap = {
|
||||||
|
[TArgsType in ArgsTypesNames]?: ArgConfig<TArgsType>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function applyArgsTypesEnhanceMap(
|
||||||
|
argsTypesEnhanceMap: ArgsTypesEnhanceMap,
|
||||||
|
) {
|
||||||
|
for (const argsTypesEnhanceMapKey of Object.keys(argsTypesEnhanceMap)) {
|
||||||
|
const argsTypeName = argsTypesEnhanceMapKey as keyof typeof argsTypesEnhanceMap;
|
||||||
|
const typeConfig = argsTypesEnhanceMap[argsTypeName]!;
|
||||||
|
const typeClass = argsTypes[argsTypeName];
|
||||||
|
const typeTarget = typeClass.prototype;
|
||||||
|
applyTypeClassEnhanceConfig(
|
||||||
|
typeConfig,
|
||||||
|
typeClass,
|
||||||
|
typeTarget,
|
||||||
|
argsInfo[argsTypeName as keyof typeof argsInfo],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const relationResolversMap = {
|
||||||
|
User: relationResolvers.UserRelationsResolver,
|
||||||
|
Workspace: relationResolvers.WorkspaceRelationsResolver,
|
||||||
|
WorkspaceMember: relationResolvers.WorkspaceMemberRelationsResolver,
|
||||||
|
Company: relationResolvers.CompanyRelationsResolver,
|
||||||
|
Person: relationResolvers.PersonRelationsResolver,
|
||||||
|
RefreshToken: relationResolvers.RefreshTokenRelationsResolver
|
||||||
|
};
|
||||||
|
const relationResolversInfo = {
|
||||||
|
User: ["WorkspaceMember", "companies", "RefreshTokens"],
|
||||||
|
Workspace: ["WorkspaceMember", "companies", "people"],
|
||||||
|
WorkspaceMember: ["user", "workspace"],
|
||||||
|
Company: ["accountOwner", "people", "workspace"],
|
||||||
|
Person: ["company", "workspace"],
|
||||||
|
RefreshToken: ["user"]
|
||||||
|
};
|
||||||
|
|
||||||
|
type RelationResolverModelNames = keyof typeof relationResolversMap;
|
||||||
|
|
||||||
|
type RelationResolverActionNames<
|
||||||
|
TModel extends RelationResolverModelNames
|
||||||
|
> = keyof typeof relationResolversMap[TModel]["prototype"];
|
||||||
|
|
||||||
|
export type RelationResolverActionsConfig<TModel extends RelationResolverModelNames>
|
||||||
|
= Partial<Record<RelationResolverActionNames<TModel>, MethodDecorator[] | MethodDecoratorOverrideFn>>
|
||||||
|
& { _all?: MethodDecorator[] };
|
||||||
|
|
||||||
|
export type RelationResolversEnhanceMap = {
|
||||||
|
[TModel in RelationResolverModelNames]?: RelationResolverActionsConfig<TModel>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function applyRelationResolversEnhanceMap(
|
||||||
|
relationResolversEnhanceMap: RelationResolversEnhanceMap,
|
||||||
|
) {
|
||||||
|
for (const relationResolversEnhanceMapKey of Object.keys(relationResolversEnhanceMap)) {
|
||||||
|
const modelName = relationResolversEnhanceMapKey as keyof typeof relationResolversEnhanceMap;
|
||||||
|
const relationResolverTarget = relationResolversMap[modelName].prototype;
|
||||||
|
const relationResolverActionsConfig = relationResolversEnhanceMap[modelName]!;
|
||||||
|
const allActionsDecorators = relationResolverActionsConfig._all ?? [];
|
||||||
|
const relationResolverActionNames = relationResolversInfo[modelName as keyof typeof relationResolversInfo];
|
||||||
|
for (const relationResolverActionName of relationResolverActionNames) {
|
||||||
|
const maybeDecoratorsOrFn = relationResolverActionsConfig[
|
||||||
|
relationResolverActionName as keyof typeof relationResolverActionsConfig
|
||||||
|
] as MethodDecorator[] | MethodDecoratorOverrideFn | undefined;
|
||||||
|
let decorators: MethodDecorator[];
|
||||||
|
if (typeof maybeDecoratorsOrFn === "function") {
|
||||||
|
decorators = maybeDecoratorsOrFn(allActionsDecorators);
|
||||||
|
} else {
|
||||||
|
decorators = [...allActionsDecorators, ...maybeDecoratorsOrFn ?? []];
|
||||||
|
}
|
||||||
|
tslib.__decorate(decorators, relationResolverTarget, relationResolverActionName, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type TypeConfig = {
|
||||||
|
class?: ClassDecorator[];
|
||||||
|
fields?: FieldsConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PropertyDecoratorOverrideFn = (decorators: PropertyDecorator[]) => PropertyDecorator[];
|
||||||
|
|
||||||
|
type FieldsConfig<TTypeKeys extends string = string> = Partial<
|
||||||
|
Record<TTypeKeys, PropertyDecorator[] | PropertyDecoratorOverrideFn>
|
||||||
|
> & { _all?: PropertyDecorator[] };
|
||||||
|
|
||||||
|
function applyTypeClassEnhanceConfig<
|
||||||
|
TEnhanceConfig extends TypeConfig,
|
||||||
|
TType extends object
|
||||||
|
>(
|
||||||
|
enhanceConfig: TEnhanceConfig,
|
||||||
|
typeClass: ClassType<TType>,
|
||||||
|
typePrototype: TType,
|
||||||
|
typeFieldNames: string[]
|
||||||
|
) {
|
||||||
|
if (enhanceConfig.class) {
|
||||||
|
tslib.__decorate(enhanceConfig.class, typeClass);
|
||||||
|
}
|
||||||
|
if (enhanceConfig.fields) {
|
||||||
|
const allFieldsDecorators = enhanceConfig.fields._all ?? [];
|
||||||
|
for (const typeFieldName of typeFieldNames) {
|
||||||
|
const maybeDecoratorsOrFn = enhanceConfig.fields[
|
||||||
|
typeFieldName
|
||||||
|
] as PropertyDecorator[] | PropertyDecoratorOverrideFn | undefined;
|
||||||
|
let decorators: PropertyDecorator[];
|
||||||
|
if (typeof maybeDecoratorsOrFn === "function") {
|
||||||
|
decorators = maybeDecoratorsOrFn(allFieldsDecorators);
|
||||||
|
} else {
|
||||||
|
decorators = [...allFieldsDecorators, ...maybeDecoratorsOrFn ?? []];
|
||||||
|
}
|
||||||
|
tslib.__decorate(decorators, typePrototype, typeFieldName, void 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const modelsInfo = {
|
||||||
|
User: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata"],
|
||||||
|
Workspace: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
WorkspaceMember: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
Company: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
Person: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
RefreshToken: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"]
|
||||||
|
};
|
||||||
|
|
||||||
|
type ModelNames = keyof typeof models;
|
||||||
|
|
||||||
|
type ModelFieldNames<TModel extends ModelNames> = Exclude<
|
||||||
|
keyof typeof models[TModel]["prototype"],
|
||||||
|
number | symbol
|
||||||
|
>;
|
||||||
|
|
||||||
|
type ModelFieldsConfig<TModel extends ModelNames> = FieldsConfig<
|
||||||
|
ModelFieldNames<TModel>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type ModelConfig<TModel extends ModelNames> = {
|
||||||
|
class?: ClassDecorator[];
|
||||||
|
fields?: ModelFieldsConfig<TModel>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ModelsEnhanceMap = {
|
||||||
|
[TModel in ModelNames]?: ModelConfig<TModel>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function applyModelsEnhanceMap(modelsEnhanceMap: ModelsEnhanceMap) {
|
||||||
|
for (const modelsEnhanceMapKey of Object.keys(modelsEnhanceMap)) {
|
||||||
|
const modelName = modelsEnhanceMapKey as keyof typeof modelsEnhanceMap;
|
||||||
|
const modelConfig = modelsEnhanceMap[modelName]!;
|
||||||
|
const modelClass = models[modelName];
|
||||||
|
const modelTarget = modelClass.prototype;
|
||||||
|
applyTypeClassEnhanceConfig(
|
||||||
|
modelConfig,
|
||||||
|
modelClass,
|
||||||
|
modelTarget,
|
||||||
|
modelsInfo[modelName as keyof typeof modelsInfo],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const outputsInfo = {
|
||||||
|
AggregateUser: ["_count", "_min", "_max"],
|
||||||
|
UserGroupBy: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "_count", "_min", "_max"],
|
||||||
|
AggregateWorkspace: ["_count", "_min", "_max"],
|
||||||
|
WorkspaceGroupBy: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "_count", "_min", "_max"],
|
||||||
|
AggregateWorkspaceMember: ["_count", "_min", "_max"],
|
||||||
|
WorkspaceMemberGroupBy: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId", "_count", "_min", "_max"],
|
||||||
|
AggregateCompany: ["_count", "_avg", "_sum", "_min", "_max"],
|
||||||
|
CompanyGroupBy: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId", "_count", "_avg", "_sum", "_min", "_max"],
|
||||||
|
AggregatePerson: ["_count", "_min", "_max"],
|
||||||
|
PersonGroupBy: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId", "_count", "_min", "_max"],
|
||||||
|
AggregateRefreshToken: ["_count", "_min", "_max"],
|
||||||
|
RefreshTokenGroupBy: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId", "_count", "_min", "_max"],
|
||||||
|
AffectedRowsOutput: ["count"],
|
||||||
|
UserCount: ["companies", "RefreshTokens"],
|
||||||
|
UserCountAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "_all"],
|
||||||
|
UserMinAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified"],
|
||||||
|
UserMaxAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified"],
|
||||||
|
WorkspaceCount: ["WorkspaceMember", "companies", "people"],
|
||||||
|
WorkspaceCountAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "_all"],
|
||||||
|
WorkspaceMinAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
WorkspaceMaxAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
WorkspaceMemberCountAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId", "_all"],
|
||||||
|
WorkspaceMemberMinAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
WorkspaceMemberMaxAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
CompanyCount: ["people"],
|
||||||
|
CompanyCountAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId", "_all"],
|
||||||
|
CompanyAvgAggregate: ["employees"],
|
||||||
|
CompanySumAggregate: ["employees"],
|
||||||
|
CompanyMinAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
CompanyMaxAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
PersonCountAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId", "_all"],
|
||||||
|
PersonMinAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
PersonMaxAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
RefreshTokenCountAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId", "_all"],
|
||||||
|
RefreshTokenMinAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"],
|
||||||
|
RefreshTokenMaxAggregate: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"]
|
||||||
|
};
|
||||||
|
|
||||||
|
type OutputTypesNames = keyof typeof outputTypes;
|
||||||
|
|
||||||
|
type OutputTypeFieldNames<TOutput extends OutputTypesNames> = Exclude<
|
||||||
|
keyof typeof outputTypes[TOutput]["prototype"],
|
||||||
|
number | symbol
|
||||||
|
>;
|
||||||
|
|
||||||
|
type OutputTypeFieldsConfig<
|
||||||
|
TOutput extends OutputTypesNames
|
||||||
|
> = FieldsConfig<OutputTypeFieldNames<TOutput>>;
|
||||||
|
|
||||||
|
export type OutputTypeConfig<TOutput extends OutputTypesNames> = {
|
||||||
|
class?: ClassDecorator[];
|
||||||
|
fields?: OutputTypeFieldsConfig<TOutput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OutputTypesEnhanceMap = {
|
||||||
|
[TOutput in OutputTypesNames]?: OutputTypeConfig<TOutput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function applyOutputTypesEnhanceMap(
|
||||||
|
outputTypesEnhanceMap: OutputTypesEnhanceMap,
|
||||||
|
) {
|
||||||
|
for (const outputTypeEnhanceMapKey of Object.keys(outputTypesEnhanceMap)) {
|
||||||
|
const outputTypeName = outputTypeEnhanceMapKey as keyof typeof outputTypesEnhanceMap;
|
||||||
|
const typeConfig = outputTypesEnhanceMap[outputTypeName]!;
|
||||||
|
const typeClass = outputTypes[outputTypeName];
|
||||||
|
const typeTarget = typeClass.prototype;
|
||||||
|
applyTypeClassEnhanceConfig(
|
||||||
|
typeConfig,
|
||||||
|
typeClass,
|
||||||
|
typeTarget,
|
||||||
|
outputsInfo[outputTypeName as keyof typeof outputsInfo],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const inputsInfo = {
|
||||||
|
UserWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "WorkspaceMember", "companies", "RefreshTokens"],
|
||||||
|
UserOrderByWithRelationInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "WorkspaceMember", "companies", "RefreshTokens"],
|
||||||
|
UserWhereUniqueInput: ["id", "email"],
|
||||||
|
UserOrderByWithAggregationInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "_count", "_max", "_min"],
|
||||||
|
UserScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata"],
|
||||||
|
WorkspaceWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "WorkspaceMember", "companies", "people"],
|
||||||
|
WorkspaceOrderByWithRelationInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "WorkspaceMember", "companies", "people"],
|
||||||
|
WorkspaceWhereUniqueInput: ["id", "domainName"],
|
||||||
|
WorkspaceOrderByWithAggregationInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "_count", "_max", "_min"],
|
||||||
|
WorkspaceScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
WorkspaceMemberWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId", "user", "workspace"],
|
||||||
|
WorkspaceMemberOrderByWithRelationInput: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId", "user", "workspace"],
|
||||||
|
WorkspaceMemberWhereUniqueInput: ["id", "userId"],
|
||||||
|
WorkspaceMemberOrderByWithAggregationInput: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId", "_count", "_max", "_min"],
|
||||||
|
WorkspaceMemberScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
CompanyWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId", "accountOwner", "people", "workspace"],
|
||||||
|
CompanyOrderByWithRelationInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId", "accountOwner", "people", "workspace"],
|
||||||
|
CompanyWhereUniqueInput: ["id"],
|
||||||
|
CompanyOrderByWithAggregationInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId", "_count", "_avg", "_max", "_min", "_sum"],
|
||||||
|
CompanyScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
PersonWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId", "company", "workspace"],
|
||||||
|
PersonOrderByWithRelationInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId", "company", "workspace"],
|
||||||
|
PersonWhereUniqueInput: ["id"],
|
||||||
|
PersonOrderByWithAggregationInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId", "_count", "_max", "_min"],
|
||||||
|
PersonScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
RefreshTokenWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId", "user"],
|
||||||
|
RefreshTokenOrderByWithRelationInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId", "user"],
|
||||||
|
RefreshTokenWhereUniqueInput: ["id"],
|
||||||
|
RefreshTokenOrderByWithAggregationInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId", "_count", "_max", "_min"],
|
||||||
|
RefreshTokenScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"],
|
||||||
|
UserCreateInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "WorkspaceMember", "companies", "RefreshTokens"],
|
||||||
|
UserUpdateInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "WorkspaceMember", "companies", "RefreshTokens"],
|
||||||
|
UserCreateManyInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata"],
|
||||||
|
UserUpdateManyMutationInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata"],
|
||||||
|
WorkspaceCreateInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "WorkspaceMember", "companies", "people"],
|
||||||
|
WorkspaceUpdateInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "WorkspaceMember", "companies", "people"],
|
||||||
|
WorkspaceCreateManyInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
WorkspaceUpdateManyMutationInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
WorkspaceMemberCreateInput: ["id", "createdAt", "updatedAt", "deletedAt", "user", "workspace"],
|
||||||
|
WorkspaceMemberUpdateInput: ["id", "createdAt", "updatedAt", "deletedAt", "user", "workspace"],
|
||||||
|
WorkspaceMemberCreateManyInput: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
WorkspaceMemberUpdateManyMutationInput: ["id", "createdAt", "updatedAt", "deletedAt"],
|
||||||
|
CompanyCreateInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwner", "people", "workspace"],
|
||||||
|
CompanyUpdateInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwner", "people", "workspace"],
|
||||||
|
CompanyCreateManyInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
CompanyUpdateManyMutationInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees"],
|
||||||
|
PersonCreateInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "company", "workspace"],
|
||||||
|
PersonUpdateInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "company", "workspace"],
|
||||||
|
PersonCreateManyInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
PersonUpdateManyMutationInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city"],
|
||||||
|
RefreshTokenCreateInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "user"],
|
||||||
|
RefreshTokenUpdateInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "user"],
|
||||||
|
RefreshTokenCreateManyInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"],
|
||||||
|
RefreshTokenUpdateManyMutationInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken"],
|
||||||
|
StringFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "mode", "not"],
|
||||||
|
DateTimeFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
DateTimeNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
BoolFilter: ["equals", "not"],
|
||||||
|
StringNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "mode", "not"],
|
||||||
|
JsonNullableFilter: ["equals", "path", "string_contains", "string_starts_with", "string_ends_with", "array_contains", "array_starts_with", "array_ends_with", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
WorkspaceMemberRelationFilter: ["is", "isNot"],
|
||||||
|
CompanyListRelationFilter: ["every", "some", "none"],
|
||||||
|
RefreshTokenListRelationFilter: ["every", "some", "none"],
|
||||||
|
CompanyOrderByRelationAggregateInput: ["_count"],
|
||||||
|
RefreshTokenOrderByRelationAggregateInput: ["_count"],
|
||||||
|
UserCountOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata"],
|
||||||
|
UserMaxOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified"],
|
||||||
|
UserMinOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified"],
|
||||||
|
StringWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "mode", "not", "_count", "_min", "_max"],
|
||||||
|
DateTimeWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_min", "_max"],
|
||||||
|
DateTimeNullableWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_min", "_max"],
|
||||||
|
BoolWithAggregatesFilter: ["equals", "not", "_count", "_min", "_max"],
|
||||||
|
StringNullableWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "mode", "not", "_count", "_min", "_max"],
|
||||||
|
JsonNullableWithAggregatesFilter: ["equals", "path", "string_contains", "string_starts_with", "string_ends_with", "array_contains", "array_starts_with", "array_ends_with", "lt", "lte", "gt", "gte", "not", "_count", "_min", "_max"],
|
||||||
|
WorkspaceMemberListRelationFilter: ["every", "some", "none"],
|
||||||
|
PersonListRelationFilter: ["every", "some", "none"],
|
||||||
|
WorkspaceMemberOrderByRelationAggregateInput: ["_count"],
|
||||||
|
PersonOrderByRelationAggregateInput: ["_count"],
|
||||||
|
WorkspaceCountOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
WorkspaceMaxOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
WorkspaceMinOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName"],
|
||||||
|
UserRelationFilter: ["is", "isNot"],
|
||||||
|
WorkspaceRelationFilter: ["is", "isNot"],
|
||||||
|
WorkspaceMemberCountOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
WorkspaceMemberMaxOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
WorkspaceMemberMinOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
IntNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
CompanyCountOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
CompanyAvgOrderByAggregateInput: ["employees"],
|
||||||
|
CompanyMaxOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
CompanyMinOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
CompanySumOrderByAggregateInput: ["employees"],
|
||||||
|
IntNullableWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_avg", "_sum", "_min", "_max"],
|
||||||
|
CompanyRelationFilter: ["is", "isNot"],
|
||||||
|
PersonCountOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
PersonMaxOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
PersonMinOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
RefreshTokenCountOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"],
|
||||||
|
RefreshTokenMaxOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"],
|
||||||
|
RefreshTokenMinOrderByAggregateInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"],
|
||||||
|
WorkspaceMemberCreateNestedOneWithoutUserInput: ["create", "connectOrCreate", "connect"],
|
||||||
|
CompanyCreateNestedManyWithoutAccountOwnerInput: ["create", "connectOrCreate", "createMany", "connect"],
|
||||||
|
RefreshTokenCreateNestedManyWithoutUserInput: ["create", "connectOrCreate", "createMany", "connect"],
|
||||||
|
StringFieldUpdateOperationsInput: ["set"],
|
||||||
|
DateTimeFieldUpdateOperationsInput: ["set"],
|
||||||
|
NullableDateTimeFieldUpdateOperationsInput: ["set"],
|
||||||
|
BoolFieldUpdateOperationsInput: ["set"],
|
||||||
|
NullableStringFieldUpdateOperationsInput: ["set"],
|
||||||
|
WorkspaceMemberUpdateOneWithoutUserNestedInput: ["create", "connectOrCreate", "upsert", "disconnect", "delete", "connect", "update"],
|
||||||
|
CompanyUpdateManyWithoutAccountOwnerNestedInput: ["create", "connectOrCreate", "upsert", "createMany", "set", "disconnect", "delete", "connect", "update", "updateMany", "deleteMany"],
|
||||||
|
RefreshTokenUpdateManyWithoutUserNestedInput: ["create", "connectOrCreate", "upsert", "createMany", "set", "disconnect", "delete", "connect", "update", "updateMany", "deleteMany"],
|
||||||
|
WorkspaceMemberCreateNestedManyWithoutWorkspaceInput: ["create", "connectOrCreate", "createMany", "connect"],
|
||||||
|
CompanyCreateNestedManyWithoutWorkspaceInput: ["create", "connectOrCreate", "createMany", "connect"],
|
||||||
|
PersonCreateNestedManyWithoutWorkspaceInput: ["create", "connectOrCreate", "createMany", "connect"],
|
||||||
|
WorkspaceMemberUpdateManyWithoutWorkspaceNestedInput: ["create", "connectOrCreate", "upsert", "createMany", "set", "disconnect", "delete", "connect", "update", "updateMany", "deleteMany"],
|
||||||
|
CompanyUpdateManyWithoutWorkspaceNestedInput: ["create", "connectOrCreate", "upsert", "createMany", "set", "disconnect", "delete", "connect", "update", "updateMany", "deleteMany"],
|
||||||
|
PersonUpdateManyWithoutWorkspaceNestedInput: ["create", "connectOrCreate", "upsert", "createMany", "set", "disconnect", "delete", "connect", "update", "updateMany", "deleteMany"],
|
||||||
|
UserCreateNestedOneWithoutWorkspaceMemberInput: ["create", "connectOrCreate", "connect"],
|
||||||
|
WorkspaceCreateNestedOneWithoutWorkspaceMemberInput: ["create", "connectOrCreate", "connect"],
|
||||||
|
UserUpdateOneRequiredWithoutWorkspaceMemberNestedInput: ["create", "connectOrCreate", "upsert", "connect", "update"],
|
||||||
|
WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput: ["create", "connectOrCreate", "upsert", "connect", "update"],
|
||||||
|
UserCreateNestedOneWithoutCompaniesInput: ["create", "connectOrCreate", "connect"],
|
||||||
|
PersonCreateNestedManyWithoutCompanyInput: ["create", "connectOrCreate", "createMany", "connect"],
|
||||||
|
WorkspaceCreateNestedOneWithoutCompaniesInput: ["create", "connectOrCreate", "connect"],
|
||||||
|
NullableIntFieldUpdateOperationsInput: ["set", "increment", "decrement", "multiply", "divide"],
|
||||||
|
UserUpdateOneWithoutCompaniesNestedInput: ["create", "connectOrCreate", "upsert", "disconnect", "delete", "connect", "update"],
|
||||||
|
PersonUpdateManyWithoutCompanyNestedInput: ["create", "connectOrCreate", "upsert", "createMany", "set", "disconnect", "delete", "connect", "update", "updateMany", "deleteMany"],
|
||||||
|
WorkspaceUpdateOneRequiredWithoutCompaniesNestedInput: ["create", "connectOrCreate", "upsert", "connect", "update"],
|
||||||
|
CompanyCreateNestedOneWithoutPeopleInput: ["create", "connectOrCreate", "connect"],
|
||||||
|
WorkspaceCreateNestedOneWithoutPeopleInput: ["create", "connectOrCreate", "connect"],
|
||||||
|
CompanyUpdateOneWithoutPeopleNestedInput: ["create", "connectOrCreate", "upsert", "disconnect", "delete", "connect", "update"],
|
||||||
|
WorkspaceUpdateOneRequiredWithoutPeopleNestedInput: ["create", "connectOrCreate", "upsert", "connect", "update"],
|
||||||
|
UserCreateNestedOneWithoutRefreshTokensInput: ["create", "connectOrCreate", "connect"],
|
||||||
|
UserUpdateOneRequiredWithoutRefreshTokensNestedInput: ["create", "connectOrCreate", "upsert", "connect", "update"],
|
||||||
|
NestedStringFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "not"],
|
||||||
|
NestedDateTimeFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
NestedDateTimeNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
NestedBoolFilter: ["equals", "not"],
|
||||||
|
NestedStringNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "not"],
|
||||||
|
NestedStringWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "not", "_count", "_min", "_max"],
|
||||||
|
NestedIntFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
NestedDateTimeWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_min", "_max"],
|
||||||
|
NestedDateTimeNullableWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_min", "_max"],
|
||||||
|
NestedIntNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
NestedBoolWithAggregatesFilter: ["equals", "not", "_count", "_min", "_max"],
|
||||||
|
NestedStringNullableWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "not", "_count", "_min", "_max"],
|
||||||
|
NestedJsonNullableFilter: ["equals", "path", "string_contains", "string_starts_with", "string_ends_with", "array_contains", "array_starts_with", "array_ends_with", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
NestedIntNullableWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_avg", "_sum", "_min", "_max"],
|
||||||
|
NestedFloatNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
|
||||||
|
WorkspaceMemberCreateWithoutUserInput: ["id", "createdAt", "updatedAt", "deletedAt", "workspace"],
|
||||||
|
WorkspaceMemberCreateOrConnectWithoutUserInput: ["where", "create"],
|
||||||
|
CompanyCreateWithoutAccountOwnerInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "people", "workspace"],
|
||||||
|
CompanyCreateOrConnectWithoutAccountOwnerInput: ["where", "create"],
|
||||||
|
CompanyCreateManyAccountOwnerInputEnvelope: ["data", "skipDuplicates"],
|
||||||
|
RefreshTokenCreateWithoutUserInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken"],
|
||||||
|
RefreshTokenCreateOrConnectWithoutUserInput: ["where", "create"],
|
||||||
|
RefreshTokenCreateManyUserInputEnvelope: ["data", "skipDuplicates"],
|
||||||
|
WorkspaceMemberUpsertWithoutUserInput: ["update", "create"],
|
||||||
|
WorkspaceMemberUpdateWithoutUserInput: ["id", "createdAt", "updatedAt", "deletedAt", "workspace"],
|
||||||
|
CompanyUpsertWithWhereUniqueWithoutAccountOwnerInput: ["where", "update", "create"],
|
||||||
|
CompanyUpdateWithWhereUniqueWithoutAccountOwnerInput: ["where", "data"],
|
||||||
|
CompanyUpdateManyWithWhereWithoutAccountOwnerInput: ["where", "data"],
|
||||||
|
CompanyScalarWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId", "workspaceId"],
|
||||||
|
RefreshTokenUpsertWithWhereUniqueWithoutUserInput: ["where", "update", "create"],
|
||||||
|
RefreshTokenUpdateWithWhereUniqueWithoutUserInput: ["where", "data"],
|
||||||
|
RefreshTokenUpdateManyWithWhereWithoutUserInput: ["where", "data"],
|
||||||
|
RefreshTokenScalarWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "refreshToken", "userId"],
|
||||||
|
WorkspaceMemberCreateWithoutWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "user"],
|
||||||
|
WorkspaceMemberCreateOrConnectWithoutWorkspaceInput: ["where", "create"],
|
||||||
|
WorkspaceMemberCreateManyWorkspaceInputEnvelope: ["data", "skipDuplicates"],
|
||||||
|
CompanyCreateWithoutWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwner", "people"],
|
||||||
|
CompanyCreateOrConnectWithoutWorkspaceInput: ["where", "create"],
|
||||||
|
CompanyCreateManyWorkspaceInputEnvelope: ["data", "skipDuplicates"],
|
||||||
|
PersonCreateWithoutWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "company"],
|
||||||
|
PersonCreateOrConnectWithoutWorkspaceInput: ["where", "create"],
|
||||||
|
PersonCreateManyWorkspaceInputEnvelope: ["data", "skipDuplicates"],
|
||||||
|
WorkspaceMemberUpsertWithWhereUniqueWithoutWorkspaceInput: ["where", "update", "create"],
|
||||||
|
WorkspaceMemberUpdateWithWhereUniqueWithoutWorkspaceInput: ["where", "data"],
|
||||||
|
WorkspaceMemberUpdateManyWithWhereWithoutWorkspaceInput: ["where", "data"],
|
||||||
|
WorkspaceMemberScalarWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "userId", "workspaceId"],
|
||||||
|
CompanyUpsertWithWhereUniqueWithoutWorkspaceInput: ["where", "update", "create"],
|
||||||
|
CompanyUpdateWithWhereUniqueWithoutWorkspaceInput: ["where", "data"],
|
||||||
|
CompanyUpdateManyWithWhereWithoutWorkspaceInput: ["where", "data"],
|
||||||
|
PersonUpsertWithWhereUniqueWithoutWorkspaceInput: ["where", "update", "create"],
|
||||||
|
PersonUpdateWithWhereUniqueWithoutWorkspaceInput: ["where", "data"],
|
||||||
|
PersonUpdateManyWithWhereWithoutWorkspaceInput: ["where", "data"],
|
||||||
|
PersonScalarWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId", "workspaceId"],
|
||||||
|
UserCreateWithoutWorkspaceMemberInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "companies", "RefreshTokens"],
|
||||||
|
UserCreateOrConnectWithoutWorkspaceMemberInput: ["where", "create"],
|
||||||
|
WorkspaceCreateWithoutWorkspaceMemberInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "companies", "people"],
|
||||||
|
WorkspaceCreateOrConnectWithoutWorkspaceMemberInput: ["where", "create"],
|
||||||
|
UserUpsertWithoutWorkspaceMemberInput: ["update", "create"],
|
||||||
|
UserUpdateWithoutWorkspaceMemberInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "companies", "RefreshTokens"],
|
||||||
|
WorkspaceUpsertWithoutWorkspaceMemberInput: ["update", "create"],
|
||||||
|
WorkspaceUpdateWithoutWorkspaceMemberInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "companies", "people"],
|
||||||
|
UserCreateWithoutCompaniesInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "WorkspaceMember", "RefreshTokens"],
|
||||||
|
UserCreateOrConnectWithoutCompaniesInput: ["where", "create"],
|
||||||
|
PersonCreateWithoutCompanyInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "workspace"],
|
||||||
|
PersonCreateOrConnectWithoutCompanyInput: ["where", "create"],
|
||||||
|
PersonCreateManyCompanyInputEnvelope: ["data", "skipDuplicates"],
|
||||||
|
WorkspaceCreateWithoutCompaniesInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "WorkspaceMember", "people"],
|
||||||
|
WorkspaceCreateOrConnectWithoutCompaniesInput: ["where", "create"],
|
||||||
|
UserUpsertWithoutCompaniesInput: ["update", "create"],
|
||||||
|
UserUpdateWithoutCompaniesInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "WorkspaceMember", "RefreshTokens"],
|
||||||
|
PersonUpsertWithWhereUniqueWithoutCompanyInput: ["where", "update", "create"],
|
||||||
|
PersonUpdateWithWhereUniqueWithoutCompanyInput: ["where", "data"],
|
||||||
|
PersonUpdateManyWithWhereWithoutCompanyInput: ["where", "data"],
|
||||||
|
WorkspaceUpsertWithoutCompaniesInput: ["update", "create"],
|
||||||
|
WorkspaceUpdateWithoutCompaniesInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "WorkspaceMember", "people"],
|
||||||
|
CompanyCreateWithoutPeopleInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwner", "workspace"],
|
||||||
|
CompanyCreateOrConnectWithoutPeopleInput: ["where", "create"],
|
||||||
|
WorkspaceCreateWithoutPeopleInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "WorkspaceMember", "companies"],
|
||||||
|
WorkspaceCreateOrConnectWithoutPeopleInput: ["where", "create"],
|
||||||
|
CompanyUpsertWithoutPeopleInput: ["update", "create"],
|
||||||
|
CompanyUpdateWithoutPeopleInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwner", "workspace"],
|
||||||
|
WorkspaceUpsertWithoutPeopleInput: ["update", "create"],
|
||||||
|
WorkspaceUpdateWithoutPeopleInput: ["id", "createdAt", "updatedAt", "deletedAt", "domainName", "displayName", "WorkspaceMember", "companies"],
|
||||||
|
UserCreateWithoutRefreshTokensInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "WorkspaceMember", "companies"],
|
||||||
|
UserCreateOrConnectWithoutRefreshTokensInput: ["where", "create"],
|
||||||
|
UserUpsertWithoutRefreshTokensInput: ["update", "create"],
|
||||||
|
UserUpdateWithoutRefreshTokensInput: ["id", "createdAt", "updatedAt", "deletedAt", "lastSeen", "disabled", "displayName", "email", "avatarUrl", "locale", "phoneNumber", "passwordHash", "emailVerified", "metadata", "WorkspaceMember", "companies"],
|
||||||
|
CompanyCreateManyAccountOwnerInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "workspaceId"],
|
||||||
|
RefreshTokenCreateManyUserInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken"],
|
||||||
|
CompanyUpdateWithoutAccountOwnerInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "people", "workspace"],
|
||||||
|
RefreshTokenUpdateWithoutUserInput: ["id", "createdAt", "updatedAt", "deletedAt", "refreshToken"],
|
||||||
|
WorkspaceMemberCreateManyWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "userId"],
|
||||||
|
CompanyCreateManyWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwnerId"],
|
||||||
|
PersonCreateManyWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "companyId"],
|
||||||
|
WorkspaceMemberUpdateWithoutWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "user"],
|
||||||
|
CompanyUpdateWithoutWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "name", "domainName", "address", "employees", "accountOwner", "people"],
|
||||||
|
PersonUpdateWithoutWorkspaceInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "company"],
|
||||||
|
PersonCreateManyCompanyInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "workspaceId"],
|
||||||
|
PersonUpdateWithoutCompanyInput: ["id", "createdAt", "updatedAt", "deletedAt", "firstname", "lastname", "email", "phone", "city", "workspace"]
|
||||||
|
};
|
||||||
|
|
||||||
|
type InputTypesNames = keyof typeof inputTypes;
|
||||||
|
|
||||||
|
type InputTypeFieldNames<TInput extends InputTypesNames> = Exclude<
|
||||||
|
keyof typeof inputTypes[TInput]["prototype"],
|
||||||
|
number | symbol
|
||||||
|
>;
|
||||||
|
|
||||||
|
type InputTypeFieldsConfig<
|
||||||
|
TInput extends InputTypesNames
|
||||||
|
> = FieldsConfig<InputTypeFieldNames<TInput>>;
|
||||||
|
|
||||||
|
export type InputTypeConfig<TInput extends InputTypesNames> = {
|
||||||
|
class?: ClassDecorator[];
|
||||||
|
fields?: InputTypeFieldsConfig<TInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type InputTypesEnhanceMap = {
|
||||||
|
[TInput in InputTypesNames]?: InputTypeConfig<TInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function applyInputTypesEnhanceMap(
|
||||||
|
inputTypesEnhanceMap: InputTypesEnhanceMap,
|
||||||
|
) {
|
||||||
|
for (const inputTypeEnhanceMapKey of Object.keys(inputTypesEnhanceMap)) {
|
||||||
|
const inputTypeName = inputTypeEnhanceMapKey as keyof typeof inputTypesEnhanceMap;
|
||||||
|
const typeConfig = inputTypesEnhanceMap[inputTypeName]!;
|
||||||
|
const typeClass = inputTypes[inputTypeName];
|
||||||
|
const typeTarget = typeClass.prototype;
|
||||||
|
applyTypeClassEnhanceConfig(
|
||||||
|
typeConfig,
|
||||||
|
typeClass,
|
||||||
|
typeTarget,
|
||||||
|
inputsInfo[inputTypeName as keyof typeof inputsInfo],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
18
server/src/api/graphql/enums/CompanyScalarFieldEnum.ts
Normal file
18
server/src/api/graphql/enums/CompanyScalarFieldEnum.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum CompanyScalarFieldEnum {
|
||||||
|
id = "id",
|
||||||
|
createdAt = "createdAt",
|
||||||
|
updatedAt = "updatedAt",
|
||||||
|
deletedAt = "deletedAt",
|
||||||
|
name = "name",
|
||||||
|
domainName = "domainName",
|
||||||
|
address = "address",
|
||||||
|
employees = "employees",
|
||||||
|
accountOwnerId = "accountOwnerId",
|
||||||
|
workspaceId = "workspaceId"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(CompanyScalarFieldEnum, {
|
||||||
|
name: "CompanyScalarFieldEnum",
|
||||||
|
description: undefined,
|
||||||
|
});
|
11
server/src/api/graphql/enums/JsonNullValueFilter.ts
Normal file
11
server/src/api/graphql/enums/JsonNullValueFilter.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum JsonNullValueFilter {
|
||||||
|
DbNull = "DbNull",
|
||||||
|
JsonNull = "JsonNull",
|
||||||
|
AnyNull = "AnyNull"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(JsonNullValueFilter, {
|
||||||
|
name: "JsonNullValueFilter",
|
||||||
|
description: undefined,
|
||||||
|
});
|
10
server/src/api/graphql/enums/NullableJsonNullValueInput.ts
Normal file
10
server/src/api/graphql/enums/NullableJsonNullValueInput.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum NullableJsonNullValueInput {
|
||||||
|
DbNull = "DbNull",
|
||||||
|
JsonNull = "JsonNull"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(NullableJsonNullValueInput, {
|
||||||
|
name: "NullableJsonNullValueInput",
|
||||||
|
description: undefined,
|
||||||
|
});
|
19
server/src/api/graphql/enums/PersonScalarFieldEnum.ts
Normal file
19
server/src/api/graphql/enums/PersonScalarFieldEnum.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum PersonScalarFieldEnum {
|
||||||
|
id = "id",
|
||||||
|
createdAt = "createdAt",
|
||||||
|
updatedAt = "updatedAt",
|
||||||
|
deletedAt = "deletedAt",
|
||||||
|
firstname = "firstname",
|
||||||
|
lastname = "lastname",
|
||||||
|
email = "email",
|
||||||
|
phone = "phone",
|
||||||
|
city = "city",
|
||||||
|
companyId = "companyId",
|
||||||
|
workspaceId = "workspaceId"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(PersonScalarFieldEnum, {
|
||||||
|
name: "PersonScalarFieldEnum",
|
||||||
|
description: undefined,
|
||||||
|
});
|
10
server/src/api/graphql/enums/QueryMode.ts
Normal file
10
server/src/api/graphql/enums/QueryMode.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum QueryMode {
|
||||||
|
"default" = "default",
|
||||||
|
insensitive = "insensitive"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(QueryMode, {
|
||||||
|
name: "QueryMode",
|
||||||
|
description: undefined,
|
||||||
|
});
|
14
server/src/api/graphql/enums/RefreshTokenScalarFieldEnum.ts
Normal file
14
server/src/api/graphql/enums/RefreshTokenScalarFieldEnum.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum RefreshTokenScalarFieldEnum {
|
||||||
|
id = "id",
|
||||||
|
createdAt = "createdAt",
|
||||||
|
updatedAt = "updatedAt",
|
||||||
|
deletedAt = "deletedAt",
|
||||||
|
refreshToken = "refreshToken",
|
||||||
|
userId = "userId"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(RefreshTokenScalarFieldEnum, {
|
||||||
|
name: "RefreshTokenScalarFieldEnum",
|
||||||
|
description: undefined,
|
||||||
|
});
|
10
server/src/api/graphql/enums/SortOrder.ts
Normal file
10
server/src/api/graphql/enums/SortOrder.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum SortOrder {
|
||||||
|
asc = "asc",
|
||||||
|
desc = "desc"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(SortOrder, {
|
||||||
|
name: "SortOrder",
|
||||||
|
description: undefined,
|
||||||
|
});
|
12
server/src/api/graphql/enums/TransactionIsolationLevel.ts
Normal file
12
server/src/api/graphql/enums/TransactionIsolationLevel.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum TransactionIsolationLevel {
|
||||||
|
ReadUncommitted = "ReadUncommitted",
|
||||||
|
ReadCommitted = "ReadCommitted",
|
||||||
|
RepeatableRead = "RepeatableRead",
|
||||||
|
Serializable = "Serializable"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(TransactionIsolationLevel, {
|
||||||
|
name: "TransactionIsolationLevel",
|
||||||
|
description: undefined,
|
||||||
|
});
|
22
server/src/api/graphql/enums/UserScalarFieldEnum.ts
Normal file
22
server/src/api/graphql/enums/UserScalarFieldEnum.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum UserScalarFieldEnum {
|
||||||
|
id = "id",
|
||||||
|
createdAt = "createdAt",
|
||||||
|
updatedAt = "updatedAt",
|
||||||
|
deletedAt = "deletedAt",
|
||||||
|
lastSeen = "lastSeen",
|
||||||
|
disabled = "disabled",
|
||||||
|
displayName = "displayName",
|
||||||
|
email = "email",
|
||||||
|
avatarUrl = "avatarUrl",
|
||||||
|
locale = "locale",
|
||||||
|
phoneNumber = "phoneNumber",
|
||||||
|
passwordHash = "passwordHash",
|
||||||
|
emailVerified = "emailVerified",
|
||||||
|
metadata = "metadata"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(UserScalarFieldEnum, {
|
||||||
|
name: "UserScalarFieldEnum",
|
||||||
|
description: undefined,
|
||||||
|
});
|
@ -0,0 +1,14 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum WorkspaceMemberScalarFieldEnum {
|
||||||
|
id = "id",
|
||||||
|
createdAt = "createdAt",
|
||||||
|
updatedAt = "updatedAt",
|
||||||
|
deletedAt = "deletedAt",
|
||||||
|
userId = "userId",
|
||||||
|
workspaceId = "workspaceId"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(WorkspaceMemberScalarFieldEnum, {
|
||||||
|
name: "WorkspaceMemberScalarFieldEnum",
|
||||||
|
description: undefined,
|
||||||
|
});
|
14
server/src/api/graphql/enums/WorkspaceScalarFieldEnum.ts
Normal file
14
server/src/api/graphql/enums/WorkspaceScalarFieldEnum.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
|
||||||
|
export enum WorkspaceScalarFieldEnum {
|
||||||
|
id = "id",
|
||||||
|
createdAt = "createdAt",
|
||||||
|
updatedAt = "updatedAt",
|
||||||
|
deletedAt = "deletedAt",
|
||||||
|
domainName = "domainName",
|
||||||
|
displayName = "displayName"
|
||||||
|
}
|
||||||
|
TypeGraphQL.registerEnumType(WorkspaceScalarFieldEnum, {
|
||||||
|
name: "WorkspaceScalarFieldEnum",
|
||||||
|
description: undefined,
|
||||||
|
});
|
11
server/src/api/graphql/enums/index.ts
Normal file
11
server/src/api/graphql/enums/index.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export { CompanyScalarFieldEnum } from "./CompanyScalarFieldEnum";
|
||||||
|
export { JsonNullValueFilter } from "./JsonNullValueFilter";
|
||||||
|
export { NullableJsonNullValueInput } from "./NullableJsonNullValueInput";
|
||||||
|
export { PersonScalarFieldEnum } from "./PersonScalarFieldEnum";
|
||||||
|
export { QueryMode } from "./QueryMode";
|
||||||
|
export { RefreshTokenScalarFieldEnum } from "./RefreshTokenScalarFieldEnum";
|
||||||
|
export { SortOrder } from "./SortOrder";
|
||||||
|
export { TransactionIsolationLevel } from "./TransactionIsolationLevel";
|
||||||
|
export { UserScalarFieldEnum } from "./UserScalarFieldEnum";
|
||||||
|
export { WorkspaceMemberScalarFieldEnum } from "./WorkspaceMemberScalarFieldEnum";
|
||||||
|
export { WorkspaceScalarFieldEnum } from "./WorkspaceScalarFieldEnum";
|
61
server/src/api/graphql/helpers.ts
Normal file
61
server/src/api/graphql/helpers.ts
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import graphqlFields from "graphql-fields";
|
||||||
|
|
||||||
|
export function transformInfoIntoPrismaArgs(info: GraphQLResolveInfo): Record<string, any> {
|
||||||
|
const fields: Record<string, any> = graphqlFields(
|
||||||
|
// suppress GraphQLResolveInfo types issue
|
||||||
|
info as any,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
excludedFields: ['__typename'],
|
||||||
|
processArguments: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return transformFields(fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformFields(fields: Record<string, any>): Record<string, any> {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(fields)
|
||||||
|
.map<[string, any]>(([key, value]) => {
|
||||||
|
if (Object.keys(value).length === 0) {
|
||||||
|
return [key, true];
|
||||||
|
}
|
||||||
|
if ("__arguments" in value) {
|
||||||
|
return [key, Object.fromEntries(
|
||||||
|
value.__arguments.map((argument: object) => {
|
||||||
|
const [[key, { value }]] = Object.entries(argument);
|
||||||
|
return [key, value];
|
||||||
|
})
|
||||||
|
)];
|
||||||
|
}
|
||||||
|
return [key, transformFields(value)];
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPrismaFromContext(context: any) {
|
||||||
|
const prismaClient = context["prisma"];
|
||||||
|
if (!prismaClient) {
|
||||||
|
throw new Error("Unable to find Prisma Client in GraphQL context. Please provide it under the `context[\"prisma\"]` key.");
|
||||||
|
}
|
||||||
|
return prismaClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function transformCountFieldIntoSelectRelationsCount(_count: object) {
|
||||||
|
return {
|
||||||
|
include: {
|
||||||
|
_count: {
|
||||||
|
select: {
|
||||||
|
...Object.fromEntries(
|
||||||
|
Object.entries(_count).filter(([_, v]) => v != null)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
23
server/src/api/graphql/index.ts
Normal file
23
server/src/api/graphql/index.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import * as crudResolversImport from "./resolvers/crud/resolvers-crud.index";
|
||||||
|
import * as relationResolversImport from "./resolvers/relations/resolvers.index";
|
||||||
|
import { NonEmptyArray } from "type-graphql";
|
||||||
|
|
||||||
|
export * from "./enums";
|
||||||
|
export * from "./models";
|
||||||
|
export * from "./resolvers/crud";
|
||||||
|
|
||||||
|
export const crudResolvers = Object.values(crudResolversImport) as unknown as NonEmptyArray<Function>;
|
||||||
|
|
||||||
|
export * from "./resolvers/relations";
|
||||||
|
|
||||||
|
export const relationResolvers = Object.values(relationResolversImport) as unknown as NonEmptyArray<Function>;
|
||||||
|
|
||||||
|
export * from "./resolvers/inputs";
|
||||||
|
export * from "./resolvers/outputs";
|
||||||
|
export * from "./enhance";
|
||||||
|
export * from "./scalars";
|
||||||
|
|
||||||
|
export const resolvers = [
|
||||||
|
...crudResolvers,
|
||||||
|
...relationResolvers,
|
||||||
|
] as unknown as NonEmptyArray<Function>;
|
74
server/src/api/graphql/models/Company.ts
Normal file
74
server/src/api/graphql/models/Company.ts
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
|
import { DecimalJSScalar } from "../scalars";
|
||||||
|
import { Person } from "../models/Person";
|
||||||
|
import { User } from "../models/User";
|
||||||
|
import { Workspace } from "../models/Workspace";
|
||||||
|
import { CompanyCount } from "../resolvers/outputs/CompanyCount";
|
||||||
|
|
||||||
|
@TypeGraphQL.ObjectType("Company", {
|
||||||
|
isAbstract: true
|
||||||
|
})
|
||||||
|
export class Company {
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
id!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
createdAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
updatedAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
deletedAt?: Date | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
name!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
domainName!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
address!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
employees?: number | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
accountOwnerId?: string | null;
|
||||||
|
|
||||||
|
accountOwner?: User | null;
|
||||||
|
|
||||||
|
people?: Person[];
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
workspaceId!: string;
|
||||||
|
|
||||||
|
workspace?: Workspace;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyCount, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
_count?: CompanyCount | null;
|
||||||
|
}
|
70
server/src/api/graphql/models/Person.ts
Normal file
70
server/src/api/graphql/models/Person.ts
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
|
import { DecimalJSScalar } from "../scalars";
|
||||||
|
import { Company } from "../models/Company";
|
||||||
|
import { Workspace } from "../models/Workspace";
|
||||||
|
|
||||||
|
@TypeGraphQL.ObjectType("Person", {
|
||||||
|
isAbstract: true
|
||||||
|
})
|
||||||
|
export class Person {
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
id!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
createdAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
updatedAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
deletedAt?: Date | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
firstname!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
lastname!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
email!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
phone!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
city!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
companyId?: string | null;
|
||||||
|
|
||||||
|
company?: Company | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
workspaceId!: string;
|
||||||
|
|
||||||
|
workspace?: Workspace;
|
||||||
|
}
|
42
server/src/api/graphql/models/RefreshToken.ts
Normal file
42
server/src/api/graphql/models/RefreshToken.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
|
import { DecimalJSScalar } from "../scalars";
|
||||||
|
import { User } from "../models/User";
|
||||||
|
|
||||||
|
@TypeGraphQL.ObjectType("RefreshToken", {
|
||||||
|
isAbstract: true
|
||||||
|
})
|
||||||
|
export class RefreshToken {
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
id!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
createdAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
updatedAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
deletedAt?: Date | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
refreshToken!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
userId!: string;
|
||||||
|
|
||||||
|
user?: User;
|
||||||
|
}
|
94
server/src/api/graphql/models/User.ts
Normal file
94
server/src/api/graphql/models/User.ts
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
|
import { DecimalJSScalar } from "../scalars";
|
||||||
|
import { Company } from "../models/Company";
|
||||||
|
import { RefreshToken } from "../models/RefreshToken";
|
||||||
|
import { WorkspaceMember } from "../models/WorkspaceMember";
|
||||||
|
import { UserCount } from "../resolvers/outputs/UserCount";
|
||||||
|
|
||||||
|
@TypeGraphQL.ObjectType("User", {
|
||||||
|
isAbstract: true
|
||||||
|
})
|
||||||
|
export class User {
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
id!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
createdAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
updatedAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
deletedAt?: Date | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
lastSeen?: Date | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Boolean, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
disabled!: boolean;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
displayName!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
email!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
avatarUrl?: string | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
locale!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
phoneNumber?: string | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
passwordHash?: string | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Boolean, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
emailVerified!: boolean;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => GraphQLScalars.JSONResolver, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
metadata?: Prisma.JsonValue | null;
|
||||||
|
|
||||||
|
WorkspaceMember?: WorkspaceMember | null;
|
||||||
|
|
||||||
|
companies?: Company[];
|
||||||
|
|
||||||
|
RefreshTokens?: RefreshToken[];
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => UserCount, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
_count?: UserCount | null;
|
||||||
|
}
|
54
server/src/api/graphql/models/Workspace.ts
Normal file
54
server/src/api/graphql/models/Workspace.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
|
import { DecimalJSScalar } from "../scalars";
|
||||||
|
import { Company } from "../models/Company";
|
||||||
|
import { Person } from "../models/Person";
|
||||||
|
import { WorkspaceMember } from "../models/WorkspaceMember";
|
||||||
|
import { WorkspaceCount } from "../resolvers/outputs/WorkspaceCount";
|
||||||
|
|
||||||
|
@TypeGraphQL.ObjectType("Workspace", {
|
||||||
|
isAbstract: true
|
||||||
|
})
|
||||||
|
export class Workspace {
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
id!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
createdAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
updatedAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
deletedAt?: Date | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
domainName!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
displayName!: string;
|
||||||
|
|
||||||
|
WorkspaceMember?: WorkspaceMember[];
|
||||||
|
|
||||||
|
companies?: Company[];
|
||||||
|
|
||||||
|
people?: Person[];
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => WorkspaceCount, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
_count?: WorkspaceCount | null;
|
||||||
|
}
|
45
server/src/api/graphql/models/WorkspaceMember.ts
Normal file
45
server/src/api/graphql/models/WorkspaceMember.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
|
import { DecimalJSScalar } from "../scalars";
|
||||||
|
import { User } from "../models/User";
|
||||||
|
import { Workspace } from "../models/Workspace";
|
||||||
|
|
||||||
|
@TypeGraphQL.ObjectType("WorkspaceMember", {
|
||||||
|
isAbstract: true
|
||||||
|
})
|
||||||
|
export class WorkspaceMember {
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
id!: string;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
createdAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
updatedAt!: Date;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Date, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
deletedAt?: Date | null;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
userId!: string;
|
||||||
|
|
||||||
|
user?: User;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => String, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
workspaceId!: string;
|
||||||
|
|
||||||
|
workspace?: Workspace;
|
||||||
|
}
|
6
server/src/api/graphql/models/index.ts
Normal file
6
server/src/api/graphql/models/index.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export { Company } from "./Company";
|
||||||
|
export { Person } from "./Person";
|
||||||
|
export { RefreshToken } from "./RefreshToken";
|
||||||
|
export { User } from "./User";
|
||||||
|
export { Workspace } from "./Workspace";
|
||||||
|
export { WorkspaceMember } from "./WorkspaceMember";
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { AggregateCompanyArgs } from "./args/AggregateCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { AggregateCompany } from "../../outputs/AggregateCompany";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class AggregateCompanyResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => AggregateCompany, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async aggregateCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateCompanyArgs): Promise<AggregateCompany> {
|
||||||
|
return getPrismaFromContext(ctx).company.aggregate({
|
||||||
|
...args,
|
||||||
|
...transformInfoIntoPrismaArgs(info),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,179 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { AggregateCompanyArgs } from "./args/AggregateCompanyArgs";
|
||||||
|
import { CreateManyCompanyArgs } from "./args/CreateManyCompanyArgs";
|
||||||
|
import { CreateOneCompanyArgs } from "./args/CreateOneCompanyArgs";
|
||||||
|
import { DeleteManyCompanyArgs } from "./args/DeleteManyCompanyArgs";
|
||||||
|
import { DeleteOneCompanyArgs } from "./args/DeleteOneCompanyArgs";
|
||||||
|
import { FindFirstCompanyArgs } from "./args/FindFirstCompanyArgs";
|
||||||
|
import { FindFirstCompanyOrThrowArgs } from "./args/FindFirstCompanyOrThrowArgs";
|
||||||
|
import { FindManyCompanyArgs } from "./args/FindManyCompanyArgs";
|
||||||
|
import { FindUniqueCompanyArgs } from "./args/FindUniqueCompanyArgs";
|
||||||
|
import { FindUniqueCompanyOrThrowArgs } from "./args/FindUniqueCompanyOrThrowArgs";
|
||||||
|
import { GroupByCompanyArgs } from "./args/GroupByCompanyArgs";
|
||||||
|
import { UpdateManyCompanyArgs } from "./args/UpdateManyCompanyArgs";
|
||||||
|
import { UpdateOneCompanyArgs } from "./args/UpdateOneCompanyArgs";
|
||||||
|
import { UpsertOneCompanyArgs } from "./args/UpsertOneCompanyArgs";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
|
||||||
|
import { AggregateCompany } from "../../outputs/AggregateCompany";
|
||||||
|
import { CompanyGroupBy } from "../../outputs/CompanyGroupBy";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class CompanyCrudResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => AggregateCompany, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async aggregateCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateCompanyArgs): Promise<AggregateCompany> {
|
||||||
|
return getPrismaFromContext(ctx).company.aggregate({
|
||||||
|
...args,
|
||||||
|
...transformInfoIntoPrismaArgs(info),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async createManyCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyCompanyArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.createMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => Company, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async createOneCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOneCompanyArgs): Promise<Company> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.create({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async deleteManyCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyCompanyArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.deleteMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async deleteOneCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOneCompanyArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.delete({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async findFirstCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstCompanyArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findFirst({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async findFirstCompanyOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstCompanyOrThrowArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findFirstOrThrow({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => [Company], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async companies(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyCompanyArgs): Promise<Company[]> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async company(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueCompanyArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findUnique({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async getCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueCompanyOrThrowArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findUniqueOrThrow({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => [CompanyGroupBy], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async groupByCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByCompanyArgs): Promise<CompanyGroupBy[]> {
|
||||||
|
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.groupBy({
|
||||||
|
...args,
|
||||||
|
...Object.fromEntries(
|
||||||
|
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async updateManyCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyCompanyArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.updateMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async updateOneCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOneCompanyArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.update({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => Company, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async upsertOneCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOneCompanyArgs): Promise<Company> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.upsert({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { CreateManyCompanyArgs } from "./args/CreateManyCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class CreateManyCompanyResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async createManyCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyCompanyArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.createMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { CreateOneCompanyArgs } from "./args/CreateOneCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class CreateOneCompanyResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => Company, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async createOneCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOneCompanyArgs): Promise<Company> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.create({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { DeleteManyCompanyArgs } from "./args/DeleteManyCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class DeleteManyCompanyResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async deleteManyCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyCompanyArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.deleteMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { DeleteOneCompanyArgs } from "./args/DeleteOneCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class DeleteOneCompanyResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async deleteOneCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOneCompanyArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.delete({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindFirstCompanyOrThrowArgs } from "./args/FindFirstCompanyOrThrowArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class FindFirstCompanyOrThrowResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async findFirstCompanyOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstCompanyOrThrowArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findFirstOrThrow({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindFirstCompanyArgs } from "./args/FindFirstCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class FindFirstCompanyResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async findFirstCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstCompanyArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findFirst({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindManyCompanyArgs } from "./args/FindManyCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class FindManyCompanyResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => [Company], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async companies(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyCompanyArgs): Promise<Company[]> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindUniqueCompanyOrThrowArgs } from "./args/FindUniqueCompanyOrThrowArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class FindUniqueCompanyOrThrowResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async getCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueCompanyOrThrowArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findUniqueOrThrow({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindUniqueCompanyArgs } from "./args/FindUniqueCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class FindUniqueCompanyResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async company(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueCompanyArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.findUnique({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { GroupByCompanyArgs } from "./args/GroupByCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { CompanyGroupBy } from "../../outputs/CompanyGroupBy";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class GroupByCompanyResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => [CompanyGroupBy], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async groupByCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByCompanyArgs): Promise<CompanyGroupBy[]> {
|
||||||
|
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.groupBy({
|
||||||
|
...args,
|
||||||
|
...Object.fromEntries(
|
||||||
|
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { UpdateManyCompanyArgs } from "./args/UpdateManyCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class UpdateManyCompanyResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async updateManyCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyCompanyArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.updateMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { UpdateOneCompanyArgs } from "./args/UpdateOneCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class UpdateOneCompanyResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => Company, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async updateOneCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOneCompanyArgs): Promise<Company | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.update({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { UpsertOneCompanyArgs } from "./args/UpsertOneCompanyArgs";
|
||||||
|
import { Company } from "../../../models/Company";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Company)
|
||||||
|
export class UpsertOneCompanyResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => Company, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async upsertOneCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOneCompanyArgs): Promise<Company> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).company.upsert({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyOrderByWithRelationInput } from "../../../inputs/CompanyOrderByWithRelationInput";
|
||||||
|
import { CompanyWhereInput } from "../../../inputs/CompanyWhereInput";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class AggregateCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
where?: CompanyWhereInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyOrderByWithRelationInput], {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
orderBy?: CompanyOrderByWithRelationInput[] | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
cursor?: CompanyWhereUniqueInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
take?: number | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
skip?: number | undefined;
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyCreateManyInput } from "../../../inputs/CompanyCreateManyInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class CreateManyCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyCreateManyInput], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
data!: CompanyCreateManyInput[];
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => Boolean, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
skipDuplicates?: boolean | undefined;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyCreateInput } from "../../../inputs/CompanyCreateInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class CreateOneCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyCreateInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
data!: CompanyCreateInput;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyWhereInput } from "../../../inputs/CompanyWhereInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class DeleteManyCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
where?: CompanyWhereInput | undefined;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class DeleteOneCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
where!: CompanyWhereUniqueInput;
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyOrderByWithRelationInput } from "../../../inputs/CompanyOrderByWithRelationInput";
|
||||||
|
import { CompanyWhereInput } from "../../../inputs/CompanyWhereInput";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
import { CompanyScalarFieldEnum } from "../../../../enums/CompanyScalarFieldEnum";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class FindFirstCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
where?: CompanyWhereInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyOrderByWithRelationInput], {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
orderBy?: CompanyOrderByWithRelationInput[] | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
cursor?: CompanyWhereUniqueInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
take?: number | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
skip?: number | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyScalarFieldEnum], {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
distinct?: Array<"id" | "createdAt" | "updatedAt" | "deletedAt" | "name" | "domainName" | "address" | "employees" | "accountOwnerId" | "workspaceId"> | undefined;
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyOrderByWithRelationInput } from "../../../inputs/CompanyOrderByWithRelationInput";
|
||||||
|
import { CompanyWhereInput } from "../../../inputs/CompanyWhereInput";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
import { CompanyScalarFieldEnum } from "../../../../enums/CompanyScalarFieldEnum";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class FindFirstCompanyOrThrowArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
where?: CompanyWhereInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyOrderByWithRelationInput], {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
orderBy?: CompanyOrderByWithRelationInput[] | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
cursor?: CompanyWhereUniqueInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
take?: number | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
skip?: number | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyScalarFieldEnum], {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
distinct?: Array<"id" | "createdAt" | "updatedAt" | "deletedAt" | "name" | "domainName" | "address" | "employees" | "accountOwnerId" | "workspaceId"> | undefined;
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyOrderByWithRelationInput } from "../../../inputs/CompanyOrderByWithRelationInput";
|
||||||
|
import { CompanyWhereInput } from "../../../inputs/CompanyWhereInput";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
import { CompanyScalarFieldEnum } from "../../../../enums/CompanyScalarFieldEnum";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class FindManyCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
where?: CompanyWhereInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyOrderByWithRelationInput], {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
orderBy?: CompanyOrderByWithRelationInput[] | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
cursor?: CompanyWhereUniqueInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
take?: number | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
skip?: number | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyScalarFieldEnum], {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
distinct?: Array<"id" | "createdAt" | "updatedAt" | "deletedAt" | "name" | "domainName" | "address" | "employees" | "accountOwnerId" | "workspaceId"> | undefined;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class FindUniqueCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
where!: CompanyWhereUniqueInput;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class FindUniqueCompanyOrThrowArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
where!: CompanyWhereUniqueInput;
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyOrderByWithAggregationInput } from "../../../inputs/CompanyOrderByWithAggregationInput";
|
||||||
|
import { CompanyScalarWhereWithAggregatesInput } from "../../../inputs/CompanyScalarWhereWithAggregatesInput";
|
||||||
|
import { CompanyWhereInput } from "../../../inputs/CompanyWhereInput";
|
||||||
|
import { CompanyScalarFieldEnum } from "../../../../enums/CompanyScalarFieldEnum";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class GroupByCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
where?: CompanyWhereInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyOrderByWithAggregationInput], {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
orderBy?: CompanyOrderByWithAggregationInput[] | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => [CompanyScalarFieldEnum], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
by!: Array<"id" | "createdAt" | "updatedAt" | "deletedAt" | "name" | "domainName" | "address" | "employees" | "accountOwnerId" | "workspaceId">;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyScalarWhereWithAggregatesInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
having?: CompanyScalarWhereWithAggregatesInput | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
take?: number | undefined;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
skip?: number | undefined;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyUpdateManyMutationInput } from "../../../inputs/CompanyUpdateManyMutationInput";
|
||||||
|
import { CompanyWhereInput } from "../../../inputs/CompanyWhereInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class UpdateManyCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyUpdateManyMutationInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
data!: CompanyUpdateManyMutationInput;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereInput, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
where?: CompanyWhereInput | undefined;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyUpdateInput } from "../../../inputs/CompanyUpdateInput";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class UpdateOneCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyUpdateInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
data!: CompanyUpdateInput;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
where!: CompanyWhereUniqueInput;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import * as GraphQLScalars from "graphql-scalars";
|
||||||
|
import { CompanyCreateInput } from "../../../inputs/CompanyCreateInput";
|
||||||
|
import { CompanyUpdateInput } from "../../../inputs/CompanyUpdateInput";
|
||||||
|
import { CompanyWhereUniqueInput } from "../../../inputs/CompanyWhereUniqueInput";
|
||||||
|
|
||||||
|
@TypeGraphQL.ArgsType()
|
||||||
|
export class UpsertOneCompanyArgs {
|
||||||
|
@TypeGraphQL.Field(_type => CompanyWhereUniqueInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
where!: CompanyWhereUniqueInput;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyCreateInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
create!: CompanyCreateInput;
|
||||||
|
|
||||||
|
@TypeGraphQL.Field(_type => CompanyUpdateInput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
update!: CompanyUpdateInput;
|
||||||
|
}
|
14
server/src/api/graphql/resolvers/crud/Company/args/index.ts
Normal file
14
server/src/api/graphql/resolvers/crud/Company/args/index.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
export { AggregateCompanyArgs } from "./AggregateCompanyArgs";
|
||||||
|
export { CreateManyCompanyArgs } from "./CreateManyCompanyArgs";
|
||||||
|
export { CreateOneCompanyArgs } from "./CreateOneCompanyArgs";
|
||||||
|
export { DeleteManyCompanyArgs } from "./DeleteManyCompanyArgs";
|
||||||
|
export { DeleteOneCompanyArgs } from "./DeleteOneCompanyArgs";
|
||||||
|
export { FindFirstCompanyArgs } from "./FindFirstCompanyArgs";
|
||||||
|
export { FindFirstCompanyOrThrowArgs } from "./FindFirstCompanyOrThrowArgs";
|
||||||
|
export { FindManyCompanyArgs } from "./FindManyCompanyArgs";
|
||||||
|
export { FindUniqueCompanyArgs } from "./FindUniqueCompanyArgs";
|
||||||
|
export { FindUniqueCompanyOrThrowArgs } from "./FindUniqueCompanyOrThrowArgs";
|
||||||
|
export { GroupByCompanyArgs } from "./GroupByCompanyArgs";
|
||||||
|
export { UpdateManyCompanyArgs } from "./UpdateManyCompanyArgs";
|
||||||
|
export { UpdateOneCompanyArgs } from "./UpdateOneCompanyArgs";
|
||||||
|
export { UpsertOneCompanyArgs } from "./UpsertOneCompanyArgs";
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { AggregatePersonArgs } from "./args/AggregatePersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { AggregatePerson } from "../../outputs/AggregatePerson";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class AggregatePersonResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => AggregatePerson, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async aggregatePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregatePersonArgs): Promise<AggregatePerson> {
|
||||||
|
return getPrismaFromContext(ctx).person.aggregate({
|
||||||
|
...args,
|
||||||
|
...transformInfoIntoPrismaArgs(info),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { CreateManyPersonArgs } from "./args/CreateManyPersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class CreateManyPersonResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async createManyPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyPersonArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.createMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { CreateOnePersonArgs } from "./args/CreateOnePersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class CreateOnePersonResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => Person, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async createOnePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOnePersonArgs): Promise<Person> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.create({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { DeleteManyPersonArgs } from "./args/DeleteManyPersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class DeleteManyPersonResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async deleteManyPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyPersonArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.deleteMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { DeleteOnePersonArgs } from "./args/DeleteOnePersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class DeleteOnePersonResolver {
|
||||||
|
@TypeGraphQL.Mutation(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async deleteOnePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOnePersonArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.delete({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindFirstPersonOrThrowArgs } from "./args/FindFirstPersonOrThrowArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class FindFirstPersonOrThrowResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async findFirstPersonOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstPersonOrThrowArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findFirstOrThrow({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindFirstPersonArgs } from "./args/FindFirstPersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class FindFirstPersonResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async findFirstPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstPersonArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findFirst({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindManyPersonArgs } from "./args/FindManyPersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class FindManyPersonResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => [Person], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async people(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyPersonArgs): Promise<Person[]> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindUniquePersonOrThrowArgs } from "./args/FindUniquePersonOrThrowArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class FindUniquePersonOrThrowResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async getPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniquePersonOrThrowArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findUniqueOrThrow({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { FindUniquePersonArgs } from "./args/FindUniquePersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class FindUniquePersonResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async person(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniquePersonArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findUnique({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { GroupByPersonArgs } from "./args/GroupByPersonArgs";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { PersonGroupBy } from "../../outputs/PersonGroupBy";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class GroupByPersonResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => [PersonGroupBy], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async groupByPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByPersonArgs): Promise<PersonGroupBy[]> {
|
||||||
|
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.groupBy({
|
||||||
|
...args,
|
||||||
|
...Object.fromEntries(
|
||||||
|
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,179 @@
|
|||||||
|
import * as TypeGraphQL from "type-graphql";
|
||||||
|
import type { GraphQLResolveInfo } from "graphql";
|
||||||
|
import { AggregatePersonArgs } from "./args/AggregatePersonArgs";
|
||||||
|
import { CreateManyPersonArgs } from "./args/CreateManyPersonArgs";
|
||||||
|
import { CreateOnePersonArgs } from "./args/CreateOnePersonArgs";
|
||||||
|
import { DeleteManyPersonArgs } from "./args/DeleteManyPersonArgs";
|
||||||
|
import { DeleteOnePersonArgs } from "./args/DeleteOnePersonArgs";
|
||||||
|
import { FindFirstPersonArgs } from "./args/FindFirstPersonArgs";
|
||||||
|
import { FindFirstPersonOrThrowArgs } from "./args/FindFirstPersonOrThrowArgs";
|
||||||
|
import { FindManyPersonArgs } from "./args/FindManyPersonArgs";
|
||||||
|
import { FindUniquePersonArgs } from "./args/FindUniquePersonArgs";
|
||||||
|
import { FindUniquePersonOrThrowArgs } from "./args/FindUniquePersonOrThrowArgs";
|
||||||
|
import { GroupByPersonArgs } from "./args/GroupByPersonArgs";
|
||||||
|
import { UpdateManyPersonArgs } from "./args/UpdateManyPersonArgs";
|
||||||
|
import { UpdateOnePersonArgs } from "./args/UpdateOnePersonArgs";
|
||||||
|
import { UpsertOnePersonArgs } from "./args/UpsertOnePersonArgs";
|
||||||
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||||
|
import { Person } from "../../../models/Person";
|
||||||
|
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
|
||||||
|
import { AggregatePerson } from "../../outputs/AggregatePerson";
|
||||||
|
import { PersonGroupBy } from "../../outputs/PersonGroupBy";
|
||||||
|
|
||||||
|
@TypeGraphQL.Resolver(_of => Person)
|
||||||
|
export class PersonCrudResolver {
|
||||||
|
@TypeGraphQL.Query(_returns => AggregatePerson, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async aggregatePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregatePersonArgs): Promise<AggregatePerson> {
|
||||||
|
return getPrismaFromContext(ctx).person.aggregate({
|
||||||
|
...args,
|
||||||
|
...transformInfoIntoPrismaArgs(info),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async createManyPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyPersonArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.createMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => Person, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async createOnePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOnePersonArgs): Promise<Person> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.create({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async deleteManyPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyPersonArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.deleteMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async deleteOnePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOnePersonArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.delete({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async findFirstPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstPersonArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findFirst({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async findFirstPersonOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstPersonOrThrowArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findFirstOrThrow({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => [Person], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async people(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyPersonArgs): Promise<Person[]> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async person(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniquePersonArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findUnique({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async getPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniquePersonOrThrowArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.findUniqueOrThrow({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Query(_returns => [PersonGroupBy], {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async groupByPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByPersonArgs): Promise<PersonGroupBy[]> {
|
||||||
|
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.groupBy({
|
||||||
|
...args,
|
||||||
|
...Object.fromEntries(
|
||||||
|
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async updateManyPerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyPersonArgs): Promise<AffectedRowsOutput> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.updateMany({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => Person, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
async updateOnePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOnePersonArgs): Promise<Person | null> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.update({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeGraphQL.Mutation(_returns => Person, {
|
||||||
|
nullable: false
|
||||||
|
})
|
||||||
|
async upsertOnePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOnePersonArgs): Promise<Person> {
|
||||||
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||||
|
return getPrismaFromContext(ctx).person.upsert({
|
||||||
|
...args,
|
||||||
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user