Fix linter and remove console logs

This commit is contained in:
Charles Bochet 2023-11-20 16:54:51 +01:00
parent 189586830e
commit 0ace17df82
16 changed files with 57 additions and 109 deletions

View File

@ -46,8 +46,6 @@ root.render(
import { lightTheme, darkTheme } from "${availableComponentPaths[0]}"; import { lightTheme, darkTheme } from "${availableComponentPaths[0]}";
import { MyComponent } from "./MyComponent.tsx"; import { MyComponent } from "./MyComponent.tsx";
console.log("lightTheme", lightTheme);
export default function App() { export default function App() {
return (<ThemeProvider theme={lightTheme}> return (<ThemeProvider theme={lightTheme}>
<MyComponent /> <MyComponent />

View File

@ -35,9 +35,11 @@ export const RecordShowPage = () => {
objectMetadataId: string; objectMetadataId: string;
}>(); }>();
const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem({ const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem(
objectNameSingular, {
}); objectNameSingular,
},
);
const { favorites, createFavorite, deleteFavorite } = useFavorites({ const { favorites, createFavorite, deleteFavorite } = useFavorites({
objectNamePlural: foundObjectMetadataItem?.namePlural, objectNamePlural: foundObjectMetadataItem?.namePlural,

View File

@ -32,9 +32,11 @@ export const RecordTableContainer = ({
}: { }: {
objectNamePlural: string; objectNamePlural: string;
}) => { }) => {
const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem({ const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem(
objectNamePlural, {
}); objectNamePlural,
},
);
const { columnDefinitions } = useComputeDefinitionsFromFieldMetadata( const { columnDefinitions } = useComputeDefinitionsFromFieldMetadata(
foundObjectMetadataItem, foundObjectMetadataItem,
); );

View File

@ -48,11 +48,14 @@ export const useFindManyObjectRecords = <
isFetchingMoreObjectsFamilyState(objectNamePlural), isFetchingMoreObjectsFamilyState(objectNamePlural),
); );
const { objectMetadataItem: foundObjectMetadataItem, objectNotFoundInMetadata, findManyQuery } = const {
useObjectMetadataItem({ objectMetadataItem: foundObjectMetadataItem,
objectNamePlural, objectNotFoundInMetadata,
skip, findManyQuery,
}); } = useObjectMetadataItem({
objectNamePlural,
skip,
});
const { enqueueSnackBar } = useSnackBar(); const { enqueueSnackBar } = useSnackBar();

View File

@ -15,10 +15,13 @@ export const useFindOneObjectRecord = <
onCompleted?: (data: ObjectType) => void; onCompleted?: (data: ObjectType) => void;
skip?: boolean; skip?: boolean;
}) => { }) => {
const { objectMetadataItem: foundObjectMetadataItem, objectNotFoundInMetadata, findOneQuery } = const {
useObjectMetadataItem({ objectMetadataItem: foundObjectMetadataItem,
objectNameSingular, objectNotFoundInMetadata,
}); findOneQuery,
} = useObjectMetadataItem({
objectNameSingular,
});
const { data, loading, error } = useQuery< const { data, loading, error } = useQuery<
{ [nameSingular: string]: ObjectType }, { [nameSingular: string]: ObjectType },

View File

@ -14,9 +14,11 @@ import { useFindManyObjectRecords } from './useFindManyObjectRecords';
export const useObjectRecordTable = () => { export const useObjectRecordTable = () => {
const { scopeId: objectNamePlural } = useRecordTable(); const { scopeId: objectNamePlural } = useRecordTable();
const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem({ const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem(
objectNamePlural, {
}); objectNamePlural,
},
);
const { registerOptimisticEffect } = useOptimisticEffect({ const { registerOptimisticEffect } = useOptimisticEffect({
objectNameSingular: foundObjectMetadataItem?.nameSingular, objectNameSingular: foundObjectMetadataItem?.nameSingular,

View File

@ -29,9 +29,11 @@ export const useRecordTableContextMenuEntries = () => {
const { scopeId: objectNamePlural, resetTableRowSelection } = const { scopeId: objectNamePlural, resetTableRowSelection } =
useRecordTable(); useRecordTable();
const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem({ const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem(
objectNamePlural, {
}); objectNamePlural,
},
);
const { createFavorite, deleteFavorite, favorites } = useFavorites({ const { createFavorite, deleteFavorite, favorites } = useFavorites({
objectNamePlural, objectNamePlural,

View File

@ -15,7 +15,6 @@ export const mapPaginatedObjectsToObjects = <
pagedObjects: ObjectTypeQuery | undefined; pagedObjects: ObjectTypeQuery | undefined;
objectNamePlural: string; objectNamePlural: string;
}) => { }) => {
console.log(objectNamePlural);
const formattedObjects: ObjectType[] = const formattedObjects: ObjectType[] =
pagedObjects?.[objectNamePlural].edges.map((objectEdge: ObjectEdge) => ({ pagedObjects?.[objectNamePlural].edges.map((objectEdge: ObjectEdge) => ({
...objectEdge.node, ...objectEdge.node,

View File

@ -1,8 +1,5 @@
import { v4 as uuidv4 } from 'uuid';
import { useSpreadsheetImport } from '@/spreadsheet-import/hooks/useSpreadsheetImport'; import { useSpreadsheetImport } from '@/spreadsheet-import/hooks/useSpreadsheetImport';
import { SpreadsheetOptions } from '@/spreadsheet-import/types'; import { SpreadsheetOptions } from '@/spreadsheet-import/types';
import { useSnackBar } from '@/ui/feedback/snack-bar/hooks/useSnackBar';
import { fieldsForPerson } from '../utils/fieldsForPerson'; import { fieldsForPerson } from '../utils/fieldsForPerson';
@ -10,7 +7,6 @@ export type FieldPersonMapping = (typeof fieldsForPerson)[number]['key'];
export const useSpreadsheetPersonImport = () => { export const useSpreadsheetPersonImport = () => {
const { openSpreadsheetImport } = useSpreadsheetImport<FieldPersonMapping>(); const { openSpreadsheetImport } = useSpreadsheetImport<FieldPersonMapping>();
const { enqueueSnackBar } = useSnackBar();
const openPersonSpreadsheetImport = ( const openPersonSpreadsheetImport = (
options?: Omit< options?: Omit<
@ -20,20 +16,19 @@ export const useSpreadsheetPersonImport = () => {
) => { ) => {
openSpreadsheetImport({ openSpreadsheetImport({
...options, ...options,
onSubmit: async (data) => { onSubmit: async (_data) => {
// TODO: Add better type checking in spreadsheet import later // TODO: Add better type checking in spreadsheet import later
const createInputs = data.validData.map((person) => ({ // const createInputs = data.validData.map((person) => ({
id: uuidv4(), // id: uuidv4(),
firstName: person.firstName as string | undefined, // firstName: person.firstName as string | undefined,
lastName: person.lastName as string | undefined, // lastName: person.lastName as string | undefined,
email: person.email as string | undefined, // email: person.email as string | undefined,
linkedinUrl: person.linkedinUrl as string | undefined, // linkedinUrl: person.linkedinUrl as string | undefined,
xUrl: person.xUrl as string | undefined, // xUrl: person.xUrl as string | undefined,
jobTitle: person.jobTitle as string | undefined, // jobTitle: person.jobTitle as string | undefined,
phone: person.phone as string | undefined, // phone: person.phone as string | undefined,
city: person.city as string | undefined, // city: person.city as string | undefined,
})); // }));
// TODO : abstract this part for any object // TODO : abstract this part for any object
// try { // try {
// const result = await createManyPerson({ // const result = await createManyPerson({
@ -42,7 +37,6 @@ export const useSpreadsheetPersonImport = () => {
// }, // },
// refetchQueries: 'active', // refetchQueries: 'active',
// }); // });
// if (result.errors) { // if (result.errors) {
// throw result.errors; // throw result.errors;
// } // }

View File

@ -1,34 +0,0 @@
type ChipDisplayProps = {
displayName: string;
entityId: string | null;
avatarUrlValue?: string;
};
export const ChipDisplay = ({
displayName,
entityId,
avatarUrlValue,
}: ChipDisplayProps) => {
switch (true) {
// case Entity.Company: {
// return (
// <CompanyChip
// id={entityId ?? ''}
// name={displayName}
// avatarUrl={getLogoUrlFromDomainName(avatarUrlValue)}
// />
// );
// }
// case Entity.Person: {
// return (
// <PersonChip
// id={entityId ?? ''}
// name={displayName}
// avatarUrl={avatarUrlValue}
// />
// );
// }
default:
return <> </>;
}
};

View File

@ -22,9 +22,11 @@ export const RecordTableBody = () => {
const { scopeId: objectNamePlural } = useRecordTable(); const { scopeId: objectNamePlural } = useRecordTable();
const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem({ const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem(
objectNamePlural, {
}); objectNamePlural,
},
);
const [isFetchingMoreObjects] = useRecoilState( const [isFetchingMoreObjects] = useRecoilState(
isFetchingMoreObjectsFamilyState(foundObjectMetadataItem?.namePlural), isFetchingMoreObjectsFamilyState(foundObjectMetadataItem?.namePlural),

View File

@ -3,7 +3,6 @@ import { useNavigate } from 'react-router-dom';
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings'; import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
import { getObjectSlug } from '@/object-metadata/utils/getObjectSlug'; import { getObjectSlug } from '@/object-metadata/utils/getObjectSlug';
import { useCreateOneObjectRecord } from '@/object-record/hooks/useCreateOneObjectRecord';
import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons'; import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';
import { SettingsHeaderContainer } from '@/settings/components/SettingsHeaderContainer'; import { SettingsHeaderContainer } from '@/settings/components/SettingsHeaderContainer';
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
@ -31,10 +30,6 @@ export const SettingsNewObject = () => {
disabledObjectMetadataItems: disabledObjects, disabledObjectMetadataItems: disabledObjects,
} = useObjectMetadataItemForSettings(); } = useObjectMetadataItemForSettings();
const { createOneObject: createOneView } = useCreateOneObjectRecord({
objectNameSingular: 'view',
});
const [ const [
selectedStandardObjectMetadataIds, selectedStandardObjectMetadataIds,
setSelectedStandardObjectMetadataIds, setSelectedStandardObjectMetadataIds,

View File

@ -47,9 +47,11 @@ export const SettingsDevelopersApiKeys = () => {
const { registerOptimisticEffect } = useOptimisticEffect({ const { registerOptimisticEffect } = useOptimisticEffect({
objectNameSingular: 'apiKey', objectNameSingular: 'apiKey',
}); });
const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem({ const { objectMetadataItem: foundObjectMetadataItem } = useObjectMetadataItem(
objectNameSingular: 'apiKey', {
}); objectNameSingular: 'apiKey',
},
);
const filter = { revokedAt: { is: 'NULL' } }; const filter = { revokedAt: { is: 'NULL' } };
useFindManyObjectRecords({ useFindManyObjectRecords({
objectNamePlural: 'apiKeys', objectNamePlural: 'apiKeys',

View File

@ -126,7 +126,6 @@ export class AuthResolver {
@Args() args: ApiKeyTokenInput, @Args() args: ApiKeyTokenInput,
@AuthWorkspace() { id: workspaceId }: Workspace, @AuthWorkspace() { id: workspaceId }: Workspace,
): Promise<ApiKeyToken | undefined> { ): Promise<ApiKeyToken | undefined> {
console.log('toto');
return await this.tokenService.generateApiKeyToken( return await this.tokenService.generateApiKeyToken(
workspaceId, workspaceId,
args.apiKeyId, args.apiKeyId,

View File

@ -55,8 +55,6 @@ export class TokenService {
workspaceId: user.defaultWorkspace.id, workspaceId: user.defaultWorkspace.id,
}; };
console.log(jwtPayload);
return { return {
token: this.jwtService.sign(jwtPayload), token: this.jwtService.sign(jwtPayload),
expiresAt, expiresAt,
@ -79,12 +77,9 @@ export class TokenService {
const refreshToken = const refreshToken =
this.refreshTokenRepository.create(refreshTokenPayload); this.refreshTokenRepository.create(refreshTokenPayload);
console.log(refreshToken);
await this.refreshTokenRepository.save(refreshToken); await this.refreshTokenRepository.save(refreshToken);
console.log('toto');
return { return {
token: this.jwtService.sign(jwtPayload, { token: this.jwtService.sign(jwtPayload, {
secret, secret,

View File

@ -101,18 +101,10 @@ export class WorkspaceQueryRunnerService {
): Promise<Record | undefined> { ): Promise<Record | undefined> {
const { workspaceId, targetTableName } = options; const { workspaceId, targetTableName } = options;
console.log({
workspaceId,
targetTableName,
});
const query = this.workspaceQueryBuilderFactory.updateOne(args, options); const query = this.workspaceQueryBuilderFactory.updateOne(args, options);
console.log({ query });
const result = await this.execute(query, workspaceId); const result = await this.execute(query, workspaceId);
console.log('HEY');
return this.parseResult<PGGraphQLMutation<Record>>( return this.parseResult<PGGraphQLMutation<Record>>(
result, result,
targetTableName, targetTableName,
@ -160,12 +152,6 @@ export class WorkspaceQueryRunnerService {
$$); $$);
`); `);
console.log(
JSON.stringify({
results,
}),
);
return results; return results;
} }
@ -178,8 +164,6 @@ export class WorkspaceQueryRunnerService {
const result = graphqlResult?.[0]?.resolve?.data?.[entityKey]; const result = graphqlResult?.[0]?.resolve?.data?.[entityKey];
const errors = graphqlResult?.[0]?.resolve?.errors; const errors = graphqlResult?.[0]?.resolve?.errors;
console.log('Result : ', graphqlResult?.[0]?.resolve);
if (Array.isArray(errors) && errors.length > 0) { if (Array.isArray(errors) && errors.length > 0) {
console.error('GraphQL errors', errors); console.error('GraphQL errors', errors);
} }