diff --git a/api/src/@common/app/home/home.controller.spec.ts b/api/src/@common/app/home/home.controller.spec.ts index 736d85e6..8e60800b 100644 --- a/api/src/@common/app/home/home.controller.spec.ts +++ b/api/src/@common/app/home/home.controller.spec.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { HomeController } from './home.controller'; describe('HomeController', () => { diff --git a/api/src/@common/email/email.service.spec.ts b/api/src/@common/email/email.service.spec.ts index 63f1524b..13dc6713 100644 --- a/api/src/@common/email/email.service.spec.ts +++ b/api/src/@common/email/email.service.spec.ts @@ -1,6 +1,6 @@ import { HttpModule } from '@nestjs/axios'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { EmailService } from './email.service'; describe('EmailService', () => { diff --git a/api/src/@common/email/email.service.ts b/api/src/@common/email/email.service.ts index 148fc059..a5f0ac1e 100644 --- a/api/src/@common/email/email.service.ts +++ b/api/src/@common/email/email.service.ts @@ -5,7 +5,7 @@ import { HttpService } from '@nestjs/axios'; import { Injectable } from '@nestjs/common'; import { create as createHandlebars, type ExpressHandlebars } from 'express-handlebars'; import { firstValueFrom } from 'rxjs'; -import { Environment, EnvironmentConfig } from '~/env.validation'; +import { Environment, EnvironmentConfig } from '~env'; import { sendEmailSchema, SendMailData } from './schemas'; type HbsRenderViewParameters = Parameters; diff --git a/api/src/@common/graphql/context/context.service.spec.ts b/api/src/@common/graphql/context/context.service.spec.ts index d98c7217..47a40b2a 100644 --- a/api/src/@common/graphql/context/context.service.spec.ts +++ b/api/src/@common/graphql/context/context.service.spec.ts @@ -1,6 +1,6 @@ import { LuciaModule } from '$users/auth/lucia/lucia.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { ContextService } from './context.service'; describe('ContextService', () => { diff --git a/api/src/@common/graphql/graphql.module.ts b/api/src/@common/graphql/graphql.module.ts index b62928fa..15a57d82 100644 --- a/api/src/@common/graphql/graphql.module.ts +++ b/api/src/@common/graphql/graphql.module.ts @@ -5,7 +5,7 @@ import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo'; import { GraphQLModule as NestGraphQLModule } from '@nestjs/graphql'; import depthLimit from 'graphql-depth-limit'; import { join } from 'path'; -import { Environment, EnvironmentConfig } from '~/env.validation'; +import { Environment, EnvironmentConfig } from '~env'; import { ConfigModule } from '../configs/config.module'; import { ContextModule } from './context/context.module'; import { ContextService, type CommonGQLContext, type TypedSubscriptionContext } from './context/context.service'; diff --git a/api/src/@common/graphql/schema/schema.manager.ts b/api/src/@common/graphql/schema/schema.manager.ts index a2225f73..095e224c 100644 --- a/api/src/@common/graphql/schema/schema.manager.ts +++ b/api/src/@common/graphql/schema/schema.manager.ts @@ -1,7 +1,7 @@ import { schemaPath } from '$graphql/graphql.module'; import { NestFactory } from '@nestjs/core'; import { existsSync } from 'fs'; -import { AppModule } from '~/app.module'; +import { AppModule } from '~app-module'; export async function ensureGraphQLSchema() { if (!existsSync(schemaPath)) { diff --git a/api/src/@common/minio/minio-client.module.ts b/api/src/@common/minio/minio-client.module.ts index 1e5a4ec4..54c3d6b3 100644 --- a/api/src/@common/minio/minio-client.module.ts +++ b/api/src/@common/minio/minio-client.module.ts @@ -2,7 +2,7 @@ import { TypedI18nModule } from '$i18n/i18n.module'; import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.js'; import { MinioModule } from 'nestjs-minio-client'; -import { EnvironmentConfig } from '~/env.validation'; +import { EnvironmentConfig } from '~env'; import { MinioClientService } from './minio-client.service'; export const GRAPHQL_MAX_FILE_SIZE_MB = 10; diff --git a/api/src/@common/minio/minio-client.service.ts b/api/src/@common/minio/minio-client.service.ts index 9785640f..6ecc50e1 100644 --- a/api/src/@common/minio/minio-client.service.ts +++ b/api/src/@common/minio/minio-client.service.ts @@ -3,7 +3,7 @@ import { HttpException, HttpStatus, Injectable, Logger } from '@nestjs/common'; import * as crypto from 'crypto'; import { FileUpload } from 'graphql-upload/Upload.js'; import { MinioService } from 'nestjs-minio-client'; -import { EnvironmentConfig } from '~/env.validation'; +import { EnvironmentConfig } from '~env'; import { GRAPHQL_MAX_FILE_COUNT, GRAPHQL_MAX_FILE_SIZE_MB } from './minio-client.module'; @Injectable() diff --git a/api/src/@common/users/admin/admin.resolver.ts b/api/src/@common/users/admin/admin.resolver.ts index 0b68bf2b..da8a4304 100644 --- a/api/src/@common/users/admin/admin.resolver.ts +++ b/api/src/@common/users/admin/admin.resolver.ts @@ -10,7 +10,7 @@ import { Origin } from '$utils/origin.decorator'; import { ForbiddenException } from '@nestjs/common'; import { Args, Mutation, Query, Resolver } from '@nestjs/graphql'; import { I18n, I18nContext } from 'nestjs-i18n'; -import { ADMIN } from '~/@utils/roles'; +import { ADMIN } from '~utils/roles'; import { AdminService } from './admin.service'; import { CreateUserOutput } from './dtos/create-user.output'; import { GetUserOutput } from './dtos/getUser.output'; diff --git a/api/src/@common/users/admin/admin.service.spec.ts b/api/src/@common/users/admin/admin.service.spec.ts index ac3759be..f2636748 100644 --- a/api/src/@common/users/admin/admin.service.spec.ts +++ b/api/src/@common/users/admin/admin.service.spec.ts @@ -3,7 +3,7 @@ import { AuthModule } from '$users/auth/auth.module'; import { RolesService } from '$users/auth/roles/roles.service'; import { PresenceModule } from '$users/presence/presence.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { AdminService } from './admin.service'; describe('AdminService', () => { diff --git a/api/src/@common/users/admin/admin.service.ts b/api/src/@common/users/admin/admin.service.ts index 9d7cf02f..d2841772 100644 --- a/api/src/@common/users/admin/admin.service.ts +++ b/api/src/@common/users/admin/admin.service.ts @@ -11,8 +11,8 @@ import { LiveUser } from '$users/dtos/LiveUser.dto'; import { PresenceService, UserOnlineSelector } from '$users/presence/presence.service'; import { Injectable } from '@nestjs/common'; import { EventEmitter2 } from '@nestjs/event-emitter'; -import { ADMIN } from '~/@utils/roles'; -import { EnvironmentConfig } from '~/env.validation'; +import { EnvironmentConfig } from '~env'; +import { ADMIN } from '~utils/roles'; import { ADMIN_CREATE_USER_EVENT_KEY, ADMIN_CREATE_USER_EVENT_TYPE } from './listeners/admin.events'; @Injectable() diff --git a/api/src/@common/users/auth/auth.service.spec.ts b/api/src/@common/users/auth/auth.service.spec.ts index 74df5d6c..b461b448 100644 --- a/api/src/@common/users/auth/auth.service.spec.ts +++ b/api/src/@common/users/auth/auth.service.spec.ts @@ -2,7 +2,7 @@ import { ConfigModule } from '$configs/config.module'; import { EmailModule } from '$email/email.module'; import { PresenceModule } from '$users/presence/presence.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { AuthService } from './auth.service'; import { LuciaFactory } from './lucia/lucia.factory'; import { RolesModule } from './roles/roles.module'; diff --git a/api/src/@common/users/auth/auth.service.ts b/api/src/@common/users/auth/auth.service.ts index 2c6a34c2..d178c0d0 100644 --- a/api/src/@common/users/auth/auth.service.ts +++ b/api/src/@common/users/auth/auth.service.ts @@ -8,7 +8,7 @@ import { loadLuciaUtils } from '$users/auth/lucia/modules-compat'; import { PresenceService, UserOnlineSelector } from '$users/presence/presence.service'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import type { GlobalDatabaseUserAttributes } from 'lucia'; -import { EnvironmentConfig } from '~/env.validation'; +import { EnvironmentConfig } from '~env'; import { Auth, LuciaFactory } from './lucia/lucia.factory'; import { LuciaSession } from './session.decorator'; diff --git a/api/src/@common/users/auth/lucia/lucia.factory.ts b/api/src/@common/users/auth/lucia/lucia.factory.ts index 6ee9e049..95ab69fa 100644 --- a/api/src/@common/users/auth/lucia/lucia.factory.ts +++ b/api/src/@common/users/auth/lucia/lucia.factory.ts @@ -1,6 +1,6 @@ import type { PrismaClient, User } from '$prisma-client'; import { loadLuciaCryptoNode18, loadLuciaMiddleware, loadLuciaModule, loadPrismaAdapterModule } from '$users/auth/lucia/modules-compat'; -import { Environment, type EnvironmentConfig } from '~/env.validation'; +import { Environment, type EnvironmentConfig } from '~env'; export async function luciaFactory(prisma: PrismaClient, env: EnvironmentConfig) { await loadLuciaCryptoNode18(); diff --git a/api/src/@common/users/auth/roles/roles.service.ts b/api/src/@common/users/auth/roles/roles.service.ts index 8cbce1d3..ac5c9753 100644 --- a/api/src/@common/users/auth/roles/roles.service.ts +++ b/api/src/@common/users/auth/roles/roles.service.ts @@ -2,7 +2,7 @@ import { RoleCreateNestedManyWithoutUsersInput, RoleWhereInput } from '$prisma-g import { PrismaSelector, PrismaService } from '$prisma/prisma.service'; import { Injectable } from '@nestjs/common'; import { User } from 'lucia'; -import { ADMIN } from '~/@utils/roles'; +import { ADMIN } from '~utils/roles'; @Injectable() export class RolesService { diff --git a/api/src/@common/users/presence/presence.service.spec.ts b/api/src/@common/users/presence/presence.service.spec.ts index cbf7b91c..d5cb102a 100644 --- a/api/src/@common/users/presence/presence.service.spec.ts +++ b/api/src/@common/users/presence/presence.service.spec.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { PresenceService } from './presence.service'; describe('PresenceService', () => { diff --git a/api/src/@common/users/user/profile/profile-picture/profile-picture.controller.spec.ts b/api/src/@common/users/user/profile/profile-picture/profile-picture.controller.spec.ts index 427e33db..38110b17 100644 --- a/api/src/@common/users/user/profile/profile-picture/profile-picture.controller.spec.ts +++ b/api/src/@common/users/user/profile/profile-picture/profile-picture.controller.spec.ts @@ -1,6 +1,6 @@ import { MinioClientModule } from '$minio/minio-client.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { ProfilePictureController } from './profile-picture.controller'; import { ProfilePictureService } from './profile-picture.service'; diff --git a/api/src/@common/users/user/profile/profile-picture/profile-picture.service.spec.ts b/api/src/@common/users/user/profile/profile-picture/profile-picture.service.spec.ts index 8b095e14..edc561b4 100644 --- a/api/src/@common/users/user/profile/profile-picture/profile-picture.service.spec.ts +++ b/api/src/@common/users/user/profile/profile-picture/profile-picture.service.spec.ts @@ -1,6 +1,6 @@ import { MinioClientModule } from '$minio/minio-client.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { ProfilePictureService } from './profile-picture.service'; describe('ProfilePictureService', () => { diff --git a/api/src/@common/users/user/profile/profile.resolver.spec.ts b/api/src/@common/users/user/profile/profile.resolver.spec.ts index dcc1531d..dd8f2228 100644 --- a/api/src/@common/users/user/profile/profile.resolver.spec.ts +++ b/api/src/@common/users/user/profile/profile.resolver.spec.ts @@ -1,6 +1,6 @@ import { PresenceModule } from '$users/presence/presence.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { UserProfileResolver } from './profile.resolver'; import { UserProfileService } from './profile.service'; diff --git a/api/src/@common/users/user/profile/profile.service.spec.ts b/api/src/@common/users/user/profile/profile.service.spec.ts index 4d02165b..ea23af53 100644 --- a/api/src/@common/users/user/profile/profile.service.spec.ts +++ b/api/src/@common/users/user/profile/profile.service.spec.ts @@ -1,6 +1,6 @@ import { PresenceModule } from '$users/presence/presence.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { UserProfileService } from './profile.service'; describe('UserProfileService', () => { diff --git a/api/src/@common/users/user/security/security.resolver.spec.ts b/api/src/@common/users/user/security/security.resolver.spec.ts index 2660aa8a..00045f9a 100644 --- a/api/src/@common/users/user/security/security.resolver.spec.ts +++ b/api/src/@common/users/user/security/security.resolver.spec.ts @@ -1,7 +1,7 @@ import { AuthModule } from '$users/auth/auth.module'; import { LuciaModule } from '$users/auth/lucia/lucia.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { UserSecurityModule } from './security.module'; import { UserSecurityResolver } from './security.resolver'; import { UserSecurityService } from './security.service'; diff --git a/api/src/@common/users/user/security/security.service.spec.ts b/api/src/@common/users/user/security/security.service.spec.ts index 863054d8..ea491ff6 100644 --- a/api/src/@common/users/user/security/security.service.spec.ts +++ b/api/src/@common/users/user/security/security.service.spec.ts @@ -1,7 +1,7 @@ import { AuthModule } from '$users/auth/auth.module'; import { LuciaModule } from '$users/auth/lucia/lucia.module'; import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { UserSecurityService } from './security.service'; describe('UserSecurityService', () => { diff --git a/api/src/message/message.resolver.spec.ts b/api/src/message/message.resolver.spec.ts index 51436697..1afbb2e4 100644 --- a/api/src/message/message.resolver.spec.ts +++ b/api/src/message/message.resolver.spec.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { MessageResolver } from './message.resolver'; import { MessageService } from './message.service'; diff --git a/api/src/message/message.service.spec.ts b/api/src/message/message.service.spec.ts index ecfc23de..d477fa31 100644 --- a/api/src/message/message.service.spec.ts +++ b/api/src/message/message.service.spec.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { TestManager } from '~/@utils/tests/TestManager'; +import { TestManager } from '~utils/tests/TestManager'; import { MessageService } from './message.service'; describe('MessageService', () => { diff --git a/api/tests/mocks/graphql.module.ts b/api/tests/mocks/graphql.module.ts index c4fbf568..0a6b14b7 100644 --- a/api/tests/mocks/graphql.module.ts +++ b/api/tests/mocks/graphql.module.ts @@ -1,13 +1,13 @@ import { ConfigModule } from '$configs/config.module'; import { ContextModule } from '$graphql/context/context.module'; -import { CommonContext, ContextService, TypedSubscriptionContext } from '$graphql/context/context.service'; +import { CommonGQLContext, ContextService, TypedSubscriptionContext } from '$graphql/context/context.service'; import { schemaPath } from '$graphql/graphql.module'; import { PresenceModule } from '$users/presence/presence.module'; import { PresenceService } from '$users/presence/presence.service'; import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo'; import { GraphQLModule as NestGraphQLModule } from '@nestjs/graphql'; import depthLimit from 'graphql-depth-limit'; -import { EnvironmentConfig } from '~/env.validation'; +import { EnvironmentConfig } from '~env'; export const TestGraphqlModule = NestGraphQLModule.forRootAsync({ driver: ApolloDriver, @@ -21,7 +21,7 @@ export const TestGraphqlModule = NestGraphQLModule.forRootAsync { const { req: { session }, - } = await contextService.setupGqlContext(context as TypedSubscriptionContext | CommonContext); + } = await contextService.setupGqlContext(context as TypedSubscriptionContext | CommonGQLContext); if (session) { presenceService.onConnect(session); @@ -30,7 +30,7 @@ export const TestGraphqlModule = NestGraphQLModule.forRootAsync { const { req: { session }, - } = contextService.extractRawGqlContext(context as TypedSubscriptionContext | CommonContext); + } = contextService.extractRawGqlContext(context as TypedSubscriptionContext | CommonGQLContext); if (session) { presenceService.onDisconnect(session); @@ -40,7 +40,7 @@ export const TestGraphqlModule = NestGraphQLModule.forRootAsync contextService.setupGqlContext(context), + context: (context: TypedSubscriptionContext | CommonGQLContext) => contextService.setupGqlContext(context), }; }, inject: [EnvironmentConfig, ContextService, PresenceService], diff --git a/api/tests/utils/E2ETestManager.ts b/api/tests/utils/E2ETestManager.ts index 1d5b2325..7c36fb11 100644 --- a/api/tests/utils/E2ETestManager.ts +++ b/api/tests/utils/E2ETestManager.ts @@ -12,9 +12,9 @@ import { TestingModuleBuilder } from '@nestjs/testing'; import { User } from 'lucia'; import supertest from 'supertest'; import supertestGQL, { Variables } from 'supertest-graphql'; -import { ADMIN } from '~/@utils/roles'; -import { TestManager, type TestOptions } from '~/@utils/tests/TestManager'; -import { AppModule } from '~/app.module'; +import { AppModule } from '~app-module'; +import { ADMIN } from '~utils/roles'; +import { TestManager, type TestOptions } from '~utils/tests/TestManager'; import { prepareTestDb } from '../../prisma/utils/functions'; import { TestGraphqlModule } from '../mocks/graphql.module'; diff --git a/api/tsconfig.json b/api/tsconfig.json index ea990fed..926f8a7e 100644 --- a/api/tsconfig.json +++ b/api/tsconfig.json @@ -13,7 +13,10 @@ "$prisma-client": ["./src/_generated/prisma/client/index"], "$prisma-graphql/*": ["./src/_generated/prisma-nestjs-graphql/*"], "$*": ["./src/@common/*"], - "~/*": ["./src/*"], + "~utils/*": ["./src/@utils/*"], + "~env": ["./src/env.validation"], + "~app-module": ["./src/app.module"], + // "~/*": ["./src/*"], }, "typeRoots": [