chore(*): remove unused code (#6781)

The code removed in the PR was flagged as unused by the JetBrains
inspector.

I did a QA on the dev environment but other checks are highly
recommended.

There is one commit by scope to make the review easier.

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Antoine Moreaux
2024-08-29 18:16:50 +02:00
committed by GitHub
parent ebfdc6cfd2
commit cd06ae20e8
86 changed files with 97 additions and 575 deletions

View File

@ -96,7 +96,7 @@ export class AISQLQueryService {
}
private getCreateTableStatement(tableName: string, colInfos: any[]) {
return `${`CREATE TABLE ${tableName} (\n`} ${colInfos
return `CREATE TABLE ${tableName} (\n ${colInfos
.map(
(colInfo) =>
`${colInfo.column_name} ${colInfo.data_type} ${

View File

@ -7,7 +7,7 @@ import { v4 as uuidv4 } from 'uuid';
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
export class BeforeCreateOneAppToken<T extends AppToken>
implements BeforeCreateOneHook<T, any>
implements BeforeCreateOneHook<T>
{
async run(
instance: CreateOneInputType<T>,

View File

@ -10,6 +10,7 @@ export class AuthException extends CustomException {
export enum AuthExceptionCode {
USER_NOT_FOUND = 'USER_NOT_FOUND',
CLIENT_NOT_FOUND = 'CLIENT_NOT_FOUND',
WORKSPACE_NOT_FOUND = 'WORKSPACE_NOT_FOUND',
INVALID_INPUT = 'INVALID_INPUT',
FORBIDDEN_EXCEPTION = 'FORBIDDEN_EXCEPTION',
UNAUTHENTICATED = 'UNAUTHENTICATED',

View File

@ -72,7 +72,7 @@ export class GoogleAPIsAuthController {
if (!workspaceId) {
throw new AuthException(
'Workspace not found',
AuthExceptionCode.INVALID_INPUT,
AuthExceptionCode.WORKSPACE_NOT_FOUND,
);
}

View File

@ -16,7 +16,6 @@ import {
export class AuthGraphqlApiExceptionFilter implements ExceptionFilter {
catch(exception: AuthException) {
switch (exception.code) {
case AuthExceptionCode.USER_NOT_FOUND:
case AuthExceptionCode.CLIENT_NOT_FOUND:
throw new NotFoundError(exception.message);
case AuthExceptionCode.INVALID_INPUT:
@ -24,6 +23,8 @@ export class AuthGraphqlApiExceptionFilter implements ExceptionFilter {
case AuthExceptionCode.FORBIDDEN_EXCEPTION:
throw new ForbiddenError(exception.message);
case AuthExceptionCode.UNAUTHENTICATED:
case AuthExceptionCode.USER_NOT_FOUND:
case AuthExceptionCode.WORKSPACE_NOT_FOUND:
throw new AuthenticationError(exception.message);
case AuthExceptionCode.INVALID_DATA:
case AuthExceptionCode.INTERNAL_SERVER_ERROR:

View File

@ -41,12 +41,6 @@ import { EnvironmentService } from 'src/engine/integrations/environment/environm
import { TokenService } from './token.service';
export type UserPayload = {
firstName: string;
lastName: string;
email: string;
};
@Injectable()
export class AuthService {
constructor(

View File

@ -52,7 +52,7 @@ export class JwtAuthStrategy extends PassportStrategy(Strategy, 'jwt') {
if (!workspace) {
throw new AuthException(
'Workspace not found',
AuthExceptionCode.INVALID_INPUT,
AuthExceptionCode.WORKSPACE_NOT_FOUND,
);
}

View File

@ -38,7 +38,7 @@ export class FileService {
const expirationDate = addMilliseconds(new Date(), ms(fileTokenExpiresIn));
const signedPayload = await this.jwtWrapperService.sign(
const signedPayload = this.jwtWrapperService.sign(
{
expiration_date: expirationDate,
...payloadToEncode,

View File

@ -115,12 +115,6 @@ export class WorkspaceService extends TypeOrmQueryService<Workspace> {
return workspace;
}
async getWorkspaceIds() {
return this.workspaceRepository
.find()
.then((workspaces) => workspaces.map((workspace) => workspace.id));
}
async handleRemoveWorkspaceMember(workspaceId: string, userId: string) {
await this.userWorkspaceRepository.delete({
userId,