mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-12 15:52:32 +10:00
restructure directories
* set log level based on env
This commit is contained in:
@ -6,7 +6,11 @@ import { PersistenceExtension } from './extensions/persistence.extension';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Redis } from '@hocuspocus/extension-redis';
|
||||
import { EnvironmentService } from '../integrations/environment/environment.service';
|
||||
import { createRetryStrategy, parseRedisUrl, RedisConfig } from '../helpers';
|
||||
import {
|
||||
createRetryStrategy,
|
||||
parseRedisUrl,
|
||||
RedisConfig,
|
||||
} from '../common/helpers';
|
||||
|
||||
@Injectable()
|
||||
export class CollaborationGateway {
|
||||
|
||||
@ -10,7 +10,7 @@ import { UserRepo } from '@docmost/db/repos/user/user.repo';
|
||||
import { PageRepo } from '@docmost/db/repos/page/page.repo';
|
||||
import { SpaceMemberRepo } from '@docmost/db/repos/space/space-member.repo';
|
||||
import { findHighestUserSpaceRole } from '@docmost/db/repos/space/utils';
|
||||
import { SpaceRole } from '../../helpers/types/permission';
|
||||
import { SpaceRole } from '../../common/helpers/types/permission';
|
||||
import { getPageId } from '../collaboration.util';
|
||||
|
||||
@Injectable()
|
||||
|
||||
@ -110,6 +110,7 @@ export class PersistenceExtension implements Extension {
|
||||
...page,
|
||||
lastUpdatedById: context.user.id,
|
||||
content: tiptapJson,
|
||||
textContent: textContent,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
58
apps/server/src/common/logger/internal-log-filter.ts
Normal file
58
apps/server/src/common/logger/internal-log-filter.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import { ConsoleLogger } from '@nestjs/common';
|
||||
|
||||
export class InternalLogFilter extends ConsoleLogger {
|
||||
static contextsToIgnore = [
|
||||
'InstanceLoader',
|
||||
'RoutesResolver',
|
||||
'RouterExplorer',
|
||||
'WebSocketsController',
|
||||
];
|
||||
|
||||
private allowedLogLevels: string[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.allowedLogLevels =
|
||||
process.env.NODE_ENV === 'production'
|
||||
? ['log', 'error', 'fatal']
|
||||
: ['log', 'debug', 'verbose', 'warn', 'error', 'fatal'];
|
||||
}
|
||||
|
||||
private isLogLevelAllowed(level: string): boolean {
|
||||
return this.allowedLogLevels.includes(level);
|
||||
}
|
||||
|
||||
log(_: any, context?: string): void {
|
||||
if (
|
||||
this.isLogLevelAllowed('log') &&
|
||||
(process.env.NODE_ENV !== 'production' ||
|
||||
!InternalLogFilter.contextsToIgnore.includes(context))
|
||||
) {
|
||||
super.log.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
warn(_: any, context?: string): void {
|
||||
if (this.isLogLevelAllowed('warn')) {
|
||||
super.warn.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
error(_: any, stack?: string, context?: string): void {
|
||||
if (this.isLogLevelAllowed('error')) {
|
||||
super.error.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
debug(_: any, context?: string): void {
|
||||
if (this.isLogLevelAllowed('debug')) {
|
||||
super.debug.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
verbose(_: any, context?: string): void {
|
||||
if (this.isLogLevelAllowed('verbose')) {
|
||||
super.verbose.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
import { Injectable, NestMiddleware, NotFoundException } from '@nestjs/common';
|
||||
import { FastifyRequest, FastifyReply } from 'fastify';
|
||||
import { EnvironmentService } from '../integrations/environment/environment.service';
|
||||
import { EnvironmentService } from '../../integrations/environment/environment.service';
|
||||
import { WorkspaceRepo } from '@docmost/db/repos/workspace/workspace.repo';
|
||||
|
||||
@Injectable()
|
||||
@ -18,16 +18,16 @@ import { AttachmentService } from './services/attachment.service';
|
||||
import { FastifyReply } from 'fastify';
|
||||
import { AttachmentInterceptor } from './interceptors/attachment.interceptor';
|
||||
import * as bytes from 'bytes';
|
||||
import { AuthUser } from '../../decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import { StorageService } from '../../integrations/storage/storage.service';
|
||||
import {
|
||||
getAttachmentFolderPath,
|
||||
validAttachmentTypes,
|
||||
} from './attachment.utils';
|
||||
import { getMimeType } from '../../helpers';
|
||||
import { getMimeType } from '../../common/helpers';
|
||||
import {
|
||||
AttachmentType,
|
||||
MAX_AVATAR_SIZE,
|
||||
|
||||
@ -15,10 +15,10 @@ import { SetupGuard } from './guards/setup.guard';
|
||||
import { EnvironmentService } from '../../integrations/environment/environment.service';
|
||||
import { CreateAdminUserDto } from './dto/create-admin-user.dto';
|
||||
import { ChangePasswordDto } from './dto/change-password.dto';
|
||||
import { AuthUser } from '../../decorators/auth-user.decorator';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
|
||||
@ -11,7 +11,7 @@ import { TokensDto } from '../dto/tokens.dto';
|
||||
import { SignupService } from './signup.service';
|
||||
import { CreateAdminUserDto } from '../dto/create-admin-user.dto';
|
||||
import { UserRepo } from '@docmost/db/repos/user/user.repo';
|
||||
import { comparePasswordHash, hashPassword } from '../../../helpers';
|
||||
import { comparePasswordHash, hashPassword } from '../../../common/helpers';
|
||||
import { ChangePasswordDto } from '../dto/change-password.dto';
|
||||
import { MailService } from '../../../integrations/mail/mail.service';
|
||||
import ChangePasswordEmail from '@docmost/transactional/emails/change-password-email';
|
||||
|
||||
@ -9,7 +9,7 @@ import { executeTx } from '@docmost/db/utils';
|
||||
import { InjectKysely } from 'nestjs-kysely';
|
||||
import { User } from '@docmost/db/types/entity.types';
|
||||
import { GroupUserRepo } from '@docmost/db/repos/group/group-user.repo';
|
||||
import { UserRole } from '../../../helpers/types/permission';
|
||||
import { UserRole } from '../../../common/helpers/types/permission';
|
||||
|
||||
@Injectable()
|
||||
export class SignupService {
|
||||
|
||||
@ -4,7 +4,7 @@ import {
|
||||
createMongoAbility,
|
||||
MongoAbility,
|
||||
} from '@casl/ability';
|
||||
import { SpaceRole } from '../../../helpers/types/permission';
|
||||
import { SpaceRole } from '../../../common/helpers/types/permission';
|
||||
import { User } from '@docmost/db/types/entity.types';
|
||||
import { SpaceMemberRepo } from '@docmost/db/repos/space/space-member.repo';
|
||||
import {
|
||||
|
||||
@ -4,7 +4,7 @@ import {
|
||||
createMongoAbility,
|
||||
MongoAbility,
|
||||
} from '@casl/ability';
|
||||
import { UserRole } from '../../../helpers/types/permission';
|
||||
import { UserRole } from '../../../common/helpers/types/permission';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import {
|
||||
IWorkspaceAbility,
|
||||
|
||||
@ -12,9 +12,9 @@ import { CommentService } from './comment.service';
|
||||
import { CreateCommentDto } from './dto/create-comment.dto';
|
||||
import { UpdateCommentDto } from './dto/update-comment.dto';
|
||||
import { PageIdDto, CommentIdDto } from './dto/comments.input';
|
||||
import { AuthUser } from '../../decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import SpaceAbilityFactory from '../casl/abilities/space-ability.factory';
|
||||
|
||||
@ -14,7 +14,7 @@ import { SearchModule } from './search/search.module';
|
||||
import { SpaceModule } from './space/space.module';
|
||||
import { GroupModule } from './group/group.module';
|
||||
import { CaslModule } from './casl/casl.module';
|
||||
import { DomainMiddleware } from '../middlewares/domain.middleware';
|
||||
import { DomainMiddleware } from '../common/middlewares/domain.middleware';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
||||
@ -9,15 +9,15 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { GroupService } from './services/group.service';
|
||||
import { CreateGroupDto } from './dto/create-group.dto';
|
||||
import { AuthUser } from '../../decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { GroupUserService } from './services/group-user.service';
|
||||
import { GroupIdDto } from './dto/group-id.dto';
|
||||
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
|
||||
import { AddGroupUserDto } from './dto/add-group-user.dto';
|
||||
import { RemoveGroupUserDto } from './dto/remove-group-user.dto';
|
||||
import { UpdateGroupDto } from './dto/update-group.dto';
|
||||
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import WorkspaceAbilityFactory from '../casl/abilities/workspace-ability.factory';
|
||||
import {
|
||||
|
||||
@ -14,9 +14,9 @@ import { UpdatePageDto } from './dto/update-page.dto';
|
||||
import { MovePageDto } from './dto/move-page.dto';
|
||||
import { PageHistoryIdDto, PageIdDto, PageInfoDto } from './dto/page.dto';
|
||||
import { PageHistoryService } from './services/page-history.service';
|
||||
import { AuthUser } from '../../decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import { SidebarPageDto } from './dto/sidebar-page.dto';
|
||||
|
||||
@ -18,7 +18,7 @@ import { generateJitteredKeyBetween } from 'fractional-indexing-jittered';
|
||||
import { MovePageDto } from '../dto/move-page.dto';
|
||||
import { ExpressionBuilder } from 'kysely';
|
||||
import { DB } from '@docmost/db/types/db';
|
||||
import { generateSlugId } from '../../../helpers';
|
||||
import { generateSlugId } from '../../../common/helpers';
|
||||
|
||||
@Injectable()
|
||||
export class PageService {
|
||||
|
||||
@ -10,15 +10,15 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { SearchService } from './search.service';
|
||||
import { SearchDTO, SearchSuggestionDTO } from './dto/search.dto';
|
||||
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import SpaceAbilityFactory from '../casl/abilities/space-ability.factory';
|
||||
import {
|
||||
SpaceCaslAction,
|
||||
SpaceCaslSubject,
|
||||
} from '../casl/interfaces/space-ability.type';
|
||||
import { AuthUser } from '../../decorators/auth-user.decorator';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Controller('search')
|
||||
|
||||
@ -1,11 +1,6 @@
|
||||
import {
|
||||
ArrayMaxSize,
|
||||
IsArray,
|
||||
IsEnum,
|
||||
IsUUID,
|
||||
} from 'class-validator';
|
||||
import { ArrayMaxSize, IsArray, IsEnum, IsUUID } from 'class-validator';
|
||||
import { SpaceIdDto } from './space-id.dto';
|
||||
import { SpaceRole } from '../../../helpers/types/permission';
|
||||
import { SpaceRole } from '../../../common/helpers/types/permission';
|
||||
|
||||
export class AddSpaceMembersDto extends SpaceIdDto {
|
||||
// @IsOptional()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { IsEnum, IsNotEmpty, IsOptional, IsUUID } from 'class-validator';
|
||||
import { SpaceIdDto } from './space-id.dto';
|
||||
import { SpaceRole } from '../../../helpers/types/permission';
|
||||
import { SpaceRole } from '../../../common/helpers/types/permission';
|
||||
|
||||
export class UpdateSpaceMemberRoleDto extends SpaceIdDto {
|
||||
@IsOptional()
|
||||
|
||||
@ -12,7 +12,7 @@ import { Space, SpaceMember, User } from '@docmost/db/types/entity.types';
|
||||
import { SpaceRepo } from '@docmost/db/repos/space/space.repo';
|
||||
import { RemoveSpaceMemberDto } from '../dto/remove-space-member.dto';
|
||||
import { UpdateSpaceMemberRoleDto } from '../dto/update-space-member-role.dto';
|
||||
import { SpaceRole } from '../../../helpers/types/permission';
|
||||
import { SpaceRole } from '../../../common/helpers/types/permission';
|
||||
import { PaginationResult } from '@docmost/db/pagination/pagination';
|
||||
|
||||
@Injectable()
|
||||
|
||||
@ -10,9 +10,9 @@ import {
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { SpaceService } from './services/space.service';
|
||||
import { AuthUser } from '../../decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { SpaceIdDto } from './dto/space-id.dto';
|
||||
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
|
||||
import { SpaceMemberService } from './services/space-member.service';
|
||||
|
||||
@ -8,9 +8,9 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { UserService } from './user.service';
|
||||
import { UpdateUserDto } from './dto/update-user.dto';
|
||||
import { AuthUser } from '../../decorators/auth-user.decorator';
|
||||
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
|
||||
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
|
||||
@ -11,18 +11,18 @@ import {
|
||||
import { WorkspaceService } from '../services/workspace.service';
|
||||
import { UpdateWorkspaceDto } from '../dto/update-workspace.dto';
|
||||
import { UpdateWorkspaceUserRoleDto } from '../dto/update-workspace-user-role.dto';
|
||||
import { AuthUser } from '../../../decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../../decorators/auth-workspace.decorator';
|
||||
import { AuthUser } from '../../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../../common/decorators/auth-workspace.decorator';
|
||||
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
|
||||
import { WorkspaceInvitationService } from '../services/workspace-invitation.service';
|
||||
import { Public } from '../../../decorators/public.decorator';
|
||||
import { Public } from '../../../common/decorators/public.decorator';
|
||||
import {
|
||||
AcceptInviteDto,
|
||||
InvitationIdDto,
|
||||
InviteUserDto,
|
||||
RevokeInviteDto,
|
||||
} from '../dto/invitation.dto';
|
||||
import { JwtAuthGuard } from '../../../guards/jwt-auth.guard';
|
||||
import { JwtAuthGuard } from '../../../common/guards/jwt-auth.guard';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import WorkspaceAbilityFactory from '../../casl/abilities/workspace-ability.factory';
|
||||
import {
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
MaxLength,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
import { UserRole } from '../../../helpers/types/permission';
|
||||
import { UserRole } from '../../../common/helpers/types/permission';
|
||||
|
||||
export class InviteUserDto {
|
||||
@IsArray()
|
||||
|
||||
@ -16,12 +16,12 @@ import {
|
||||
} from '@docmost/db/types/entity.types';
|
||||
import { MailService } from '../../../integrations/mail/mail.service';
|
||||
import InvitationEmail from '@docmost/transactional/emails/invitation-email';
|
||||
import { hashPassword } from '../../../helpers';
|
||||
import { hashPassword } from '../../../common/helpers';
|
||||
import { GroupUserRepo } from '@docmost/db/repos/group/group-user.repo';
|
||||
import InvitationAcceptedEmail from '@docmost/transactional/emails/invitation-accepted-email';
|
||||
import { EnvironmentService } from '../../../integrations/environment/environment.service';
|
||||
import { TokenService } from '../../auth/services/token.service';
|
||||
import { nanoIdGen } from '../../../helpers/nanoid.utils';
|
||||
import { nanoIdGen } from '../../../common/helpers/nanoid.utils';
|
||||
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
|
||||
import { executeWithPagination } from '@docmost/db/pagination/pagination';
|
||||
import { TokensDto } from '../../auth/dto/tokens.dto';
|
||||
|
||||
@ -7,7 +7,7 @@ import { CreateWorkspaceDto } from '../dto/create-workspace.dto';
|
||||
import { UpdateWorkspaceDto } from '../dto/update-workspace.dto';
|
||||
import { SpaceService } from '../../space/services/space.service';
|
||||
import { CreateSpaceDto } from '../../space/dto/create-space.dto';
|
||||
import { SpaceRole, UserRole } from '../../../helpers/types/permission';
|
||||
import { SpaceRole, UserRole } from '../../../common/helpers/types/permission';
|
||||
import { SpaceMemberService } from '../../space/services/space-member.service';
|
||||
import { WorkspaceRepo } from '@docmost/db/repos/workspace/workspace.repo';
|
||||
import { KyselyDB, KyselyTransaction } from '@docmost/db/types/kysely.types';
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
} from 'kysely';
|
||||
import { run } from 'kysely-migration-cli';
|
||||
import * as dotenv from 'dotenv';
|
||||
import { envPath } from '../helpers/utils';
|
||||
import { envPath } from '../common/helpers/utils';
|
||||
|
||||
dotenv.config({ path: envPath });
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Kysely, sql } from 'kysely';
|
||||
import { UserRole } from '../../helpers/types/permission';
|
||||
import { UserRole } from '../../common/helpers/types/permission';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
import { Kysely, sql } from 'kysely';
|
||||
import { SpaceRole, SpaceVisibility } from '../../helpers/types/permission';
|
||||
import {
|
||||
SpaceRole,
|
||||
SpaceVisibility,
|
||||
} from '../../common/helpers/types/permission';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { UserSpaceRole } from '@docmost/db/repos/space/types';
|
||||
import { SpaceRole } from '../../../helpers/types/permission';
|
||||
import { SpaceRole } from '../../../common/helpers/types/permission';
|
||||
|
||||
export function findHighestUserSpaceRole(userSpaceRoles: UserSpaceRole[]) {
|
||||
if (!userSpaceRoles) {
|
||||
|
||||
@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||
import { InjectKysely } from 'nestjs-kysely';
|
||||
import { KyselyDB, KyselyTransaction } from '@docmost/db/types/kysely.types';
|
||||
import { Users } from '@docmost/db/types/db';
|
||||
import { hashPassword } from '../../../helpers';
|
||||
import { hashPassword } from '../../../common/helpers';
|
||||
import { dbOrTx } from '@docmost/db/utils';
|
||||
import {
|
||||
InsertableUser,
|
||||
|
||||
@ -2,7 +2,7 @@ import { Global, Module } from '@nestjs/common';
|
||||
import { EnvironmentService } from './environment.service';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { validate } from './environment.validation';
|
||||
import { envPath } from '../../helpers';
|
||||
import { envPath } from '../../common/helpers';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
import { ConsoleLogger } from '@nestjs/common';
|
||||
|
||||
export class InternalLogFilter extends ConsoleLogger {
|
||||
static contextsToIgnore = [
|
||||
'InstanceLoader',
|
||||
'RoutesResolver',
|
||||
'RouterExplorer',
|
||||
'WebSocketsController',
|
||||
];
|
||||
|
||||
log(_: any, context?: string): void {
|
||||
if (
|
||||
process.env.NODE_ENV !== 'production' ||
|
||||
!InternalLogFilter.contextsToIgnore.includes(context)
|
||||
) {
|
||||
super.log.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
import { BullModule } from '@nestjs/bullmq';
|
||||
import { EnvironmentService } from '../environment/environment.service';
|
||||
import { createRetryStrategy, parseRedisUrl } from '../../helpers';
|
||||
import { createRetryStrategy, parseRedisUrl } from '../../common/helpers';
|
||||
import { QueueName } from './constants';
|
||||
|
||||
@Global()
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
import { streamToBuffer } from '../storage.utils';
|
||||
import { Readable } from 'stream';
|
||||
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
||||
import { getMimeType } from '../../../helpers';
|
||||
import { getMimeType } from '../../../common/helpers';
|
||||
|
||||
export class S3Driver implements StorageDriver {
|
||||
private readonly s3Client: S3Client;
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
} from '../interfaces';
|
||||
import { LocalDriver, S3Driver } from '../drivers';
|
||||
import * as process from 'node:process';
|
||||
import { LOCAL_STORAGE_PATH } from '../../../helpers';
|
||||
import { LOCAL_STORAGE_PATH } from '../../../common/helpers';
|
||||
|
||||
function createStorageDriver(disk: StorageConfig): StorageDriver {
|
||||
switch (disk.driver) {
|
||||
|
||||
@ -5,10 +5,10 @@ import {
|
||||
NestFastifyApplication,
|
||||
} from '@nestjs/platform-fastify';
|
||||
import { NotFoundException, ValidationPipe } from '@nestjs/common';
|
||||
import { TransformHttpResponseInterceptor } from './interceptors/http-response.interceptor';
|
||||
import { TransformHttpResponseInterceptor } from './common/interceptors/http-response.interceptor';
|
||||
import fastifyMultipart from '@fastify/multipart';
|
||||
import { WsRedisIoAdapter } from './ws/adapter/ws-redis.adapter';
|
||||
import { InternalLogFilter } from './integrations/logger/internal-log-filter';
|
||||
import { InternalLogFilter } from './common/logger/internal-log-filter';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create<NestFastifyApplication>(
|
||||
|
||||
@ -2,7 +2,7 @@ import { IoAdapter } from '@nestjs/platform-socket.io';
|
||||
import { ServerOptions } from 'socket.io';
|
||||
import { createAdapter } from '@socket.io/redis-adapter';
|
||||
import Redis, { RedisOptions } from 'ioredis';
|
||||
import { createRetryStrategy } from '../../helpers';
|
||||
import { createRetryStrategy } from '../../common/helpers';
|
||||
|
||||
export class WsRedisIoAdapter extends IoAdapter {
|
||||
private adapterConstructor: ReturnType<typeof createAdapter>;
|
||||
|
||||
Reference in New Issue
Block a user