Fix wrong type

import, make auth and chat work
This commit is contained in:
Wuesteon 2025-12-04 23:25:25 +01:00
parent b8f9bc107c
commit 9c47119535
261 changed files with 24453 additions and 443 deletions

View file

@ -4,7 +4,7 @@
* Common utilities for writing tests
*/
import { type ConfigService } from '@nestjs/config';
import { ConfigService } from '@nestjs/config';
/**
* Create mock ConfigService

View file

@ -22,7 +22,8 @@
* - POST /auth/organizations/set-active - Set active organization
*/
import { Test, type TestingModule } from '@nestjs/testing';
import { Test } from '@nestjs/testing';
import type { TestingModule } from '@nestjs/testing';
import {
UnauthorizedException,
ConflictException,

View file

@ -11,13 +11,13 @@ import {
HttpStatus,
} from '@nestjs/common';
import { BetterAuthService } from './services/better-auth.service';
import { type RegisterDto } from './dto/register.dto';
import { type LoginDto } from './dto/login.dto';
import { type RefreshTokenDto } from './dto/refresh-token.dto';
import { type RegisterB2BDto } from './dto/register-b2b.dto';
import { type InviteEmployeeDto } from './dto/invite-employee.dto';
import { type AcceptInvitationDto } from './dto/accept-invitation.dto';
import { type SetActiveOrganizationDto } from './dto/set-active-organization.dto';
import { RegisterDto } from './dto/register.dto';
import { LoginDto } from './dto/login.dto';
import { RefreshTokenDto } from './dto/refresh-token.dto';
import { RegisterB2BDto } from './dto/register-b2b.dto';
import { InviteEmployeeDto } from './dto/invite-employee.dto';
import { AcceptInvitationDto } from './dto/accept-invitation.dto';
import { SetActiveOrganizationDto } from './dto/set-active-organization.dto';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
/**

View file

@ -19,9 +19,9 @@
*/
import { Test, TestingModule } from '@nestjs/testing';
import { type ConfigService } from '@nestjs/config';
import { ConfigService } from '@nestjs/config';
import * as jwt from 'jsonwebtoken';
import { type JWTCustomPayload } from './better-auth.config';
import { JWTCustomPayload } from './better-auth.config';
import { createMockConfigService } from '../__tests__/utils/test-helpers';
import { mockUserFactory } from '../__tests__/utils/mock-factories';

View file

@ -9,7 +9,8 @@
* - Credit balance initialization
*/
import { Test, type TestingModule } from '@nestjs/testing';
import { Test } from '@nestjs/testing';
import type { TestingModule } from '@nestjs/testing';
import { ConfigService } from '@nestjs/config';
import { ConflictException, NotFoundException, ForbiddenException } from '@nestjs/common';
import { BetterAuthService } from './better-auth.service';

View file

@ -21,7 +21,8 @@ import {
UnauthorizedException,
} from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { createBetterAuth, type BetterAuthInstance } from '../better-auth.config';
import { createBetterAuth } from '../better-auth.config';
import type { BetterAuthInstance } from '../better-auth.config';
import { getDb } from '../../db/connection';
import { balances, organizationBalances } from '../../db/schema/credits.schema';
import { hasUser, hasToken, hasMember, hasMembers, hasSession } from '../types/better-auth.types';

View file

@ -1,4 +1,5 @@
import { createParamDecorator, type ExecutionContext } from '@nestjs/common';
import { createParamDecorator } from '@nestjs/common';
import type { ExecutionContext } from '@nestjs/common';
export interface CurrentUserData {
userId: string;

View file

@ -1,11 +1,5 @@
import {
type ExceptionFilter,
Catch,
type ArgumentsHost,
HttpException,
HttpStatus,
} from '@nestjs/common';
import { type Response } from 'express';
import { ExceptionFilter, Catch, ArgumentsHost, HttpException, HttpStatus } from '@nestjs/common';
import { Response } from 'express';
@Catch()
export class HttpExceptionFilter implements ExceptionFilter {

View file

@ -1,4 +1,5 @@
import { Injectable, type CanActivate, type ExecutionContext } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import type { CanActivate, ExecutionContext } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import * as jwt from 'jsonwebtoken';

View file

@ -17,12 +17,13 @@
* - POST /credits/organization/:orgId/use - Use credits with org tracking
*/
import { Test, type TestingModule } from '@nestjs/testing';
import { Test } from '@nestjs/testing';
import type { TestingModule } from '@nestjs/testing';
import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common';
import { CreditsController } from './credits.controller';
import { CreditsService } from './credits.service';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
import { type CurrentUserData } from '../common/decorators/current-user.decorator';
import { CurrentUserData } from '../common/decorators/current-user.decorator';
import {
mockBalanceFactory,
mockTransactionFactory,

View file

@ -1,9 +1,10 @@
import { Controller, Get, Post, Body, UseGuards, Query, ParseIntPipe, Param } from '@nestjs/common';
import { CreditsService } from './credits.service';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
import { CurrentUser, type CurrentUserData } from '../common/decorators/current-user.decorator';
import { type UseCreditsDto } from './dto/use-credits.dto';
import { type AllocateCreditsDto } from './dto/allocate-credits.dto';
import { CurrentUser } from '../common/decorators/current-user.decorator';
import type { CurrentUserData } from '../common/decorators/current-user.decorator';
import { UseCreditsDto } from './dto/use-credits.dto';
import { AllocateCreditsDto } from './dto/allocate-credits.dto';
@Controller('credits')
@UseGuards(JwtAuthGuard)

View file

@ -9,7 +9,8 @@
* - Idempotency
*/
import { Test, type TestingModule } from '@nestjs/testing';
import { Test } from '@nestjs/testing';
import type { TestingModule } from '@nestjs/testing';
import { ConfigService } from '@nestjs/config';
import {
BadRequestException,

View file

@ -19,8 +19,8 @@ import {
members,
organizations,
} from '../db/schema';
import { type UseCreditsDto } from './dto/use-credits.dto';
import { type AllocateCreditsDto } from './dto/allocate-credits.dto';
import { UseCreditsDto } from './dto/use-credits.dto';
import { AllocateCreditsDto } from './dto/allocate-credits.dto';
@Injectable()
export class CreditsService {

View file

@ -12,8 +12,10 @@ import {
import { FeedbackService } from './feedback.service';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
import { OptionalAuthGuard } from '../common/guards/optional-auth.guard';
import { CurrentUser, type CurrentUserData } from '../common/decorators/current-user.decorator';
import { type CreateFeedbackDto, type FeedbackQueryDto } from './dto';
import { CurrentUser } from '../common/decorators/current-user.decorator';
import type { CurrentUserData } from '../common/decorators/current-user.decorator';
import { CreateFeedbackDto } from './dto';
import type { FeedbackQueryDto } from './dto';
@Controller('feedback')
export class FeedbackController {

View file

@ -3,7 +3,8 @@ import { ConfigService } from '@nestjs/config';
import { eq, and, desc, sql, count } from 'drizzle-orm';
import { getDb } from '../db/connection';
import { userFeedback, feedbackVotes } from '../db/schema';
import { type CreateFeedbackDto, type FeedbackQueryDto } from './dto';
import { CreateFeedbackDto } from './dto';
import type { FeedbackQueryDto } from './dto';
import { AiService } from '../ai/ai.service';
@Injectable()

View file

@ -1,8 +1,10 @@
import { Controller, Get, Patch, Delete, Body, Param, UseGuards } from '@nestjs/common';
import { SettingsService } from './settings.service';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
import { CurrentUser, type CurrentUserData } from '../common/decorators/current-user.decorator';
import { type UpdateGlobalSettingsDto, type UpdateAppOverrideDto } from './dto';
import { CurrentUser } from '../common/decorators/current-user.decorator';
import type { CurrentUserData } from '../common/decorators/current-user.decorator';
import { UpdateGlobalSettingsDto } from './dto';
import type { UpdateAppOverrideDto } from './dto';
@Controller('settings')
@UseGuards(JwtAuthGuard)

View file

@ -15,8 +15,9 @@
* These tests will be updated when Better Auth organization plugin is fully integrated.
*/
import { Test, type TestingModule } from '@nestjs/testing';
import { type INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import type { TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import request from 'supertest';
import { AppModule } from '../../src/app.module';
import { ConfigService } from '@nestjs/config';

View file

@ -10,8 +10,9 @@
* 6. Logout
*/
import { Test, type TestingModule } from '@nestjs/testing';
import { type INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import type { TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import request from 'supertest';
import { AppModule } from '../../src/app.module';

View file

@ -7,7 +7,8 @@
* - Multi-device sessions
*/
import { Test, type TestingModule } from '@nestjs/testing';
import { Test } from '@nestjs/testing';
import type { TestingModule } from '@nestjs/testing';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { AuthService } from '../../src/auth/auth.service';
import { CreditsService } from '../../src/credits/credits.service';

View file

@ -7,7 +7,8 @@
* - Daily free credit reset
*/
import { Test, type TestingModule } from '@nestjs/testing';
import { Test } from '@nestjs/testing';
import type { TestingModule } from '@nestjs/testing';
import { ConfigModule } from '@nestjs/config';
import { CreditsService } from '../../src/credits/credits.service';
import { AuthService } from '../../src/auth/auth.service';