Final backend fixes and path stabilization
This commit is contained in:
@@ -5,10 +5,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
|
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
|
||||||
import { APP_GUARD } from '@nestjs/core';
|
import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
|
||||||
|
|
||||||
import { BullModule } from '@nestjs/bull';
|
import { BullModule } from '@nestjs/bull';
|
||||||
import { envValidationSchema } from './config/env.validation';
|
import { envValidationSchema } from './config/env.validation';
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ import { JwtService } from '@nestjs/jwt';
|
|||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
import * as bcrypt from 'bcrypt';
|
import * as bcrypt from 'bcrypt';
|
||||||
import { User } from '../../users/entities/user.entity';
|
import { User } from '../users/entities/user.entity';
|
||||||
import { Tenant, TenantStatus } from '../../tenants/entities/tenant.entity';
|
import { Tenant, TenantStatus } from '../tenants/entities/tenant.entity';
|
||||||
import { UserRole } from '../../users/enums/role.enum';
|
import { UserRole } from '../users/enums/role.enum';
|
||||||
import { RegisterDto } from './dto/register.dto';
|
import { RegisterDto } from './dto/register.dto';
|
||||||
import { LoginDto } from './dto/login.dto';
|
import { LoginDto } from './dto/login.dto';
|
||||||
import { Subscription, SubscriptionPlan, SubscriptionStatus } from '../../subscriptions/entities/subscription.entity';
|
import { Subscription, SubscriptionPlan, SubscriptionStatus } from '../subscriptions/entities/subscription.entity';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class CompaniesService {
|
|||||||
const company = this.companyRepository.create({
|
const company = this.companyRepository.create({
|
||||||
...dto,
|
...dto,
|
||||||
tenant_id: tenantId,
|
tenant_id: tenantId,
|
||||||
});
|
} as Partial<Company>);
|
||||||
|
|
||||||
return this.companyRepository.save(company);
|
return this.companyRepository.save(company);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export class GeminiExtractorService {
|
|||||||
const cleanedJson = responseText.replace(/```json|```/g, '').trim();
|
const cleanedJson = responseText.replace(/```json|```/g, '').trim();
|
||||||
|
|
||||||
return JSON.parse(cleanedJson);
|
return JSON.parse(cleanedJson);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
this.logger.error(`AI Extraction failed: ${error.message}`);
|
this.logger.error(`AI Extraction failed: ${error.message}`);
|
||||||
throw new InternalServerErrorException('AI Extraction failed');
|
throw new InternalServerErrorException('AI Extraction failed');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export class JoFotaraGatewayService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
this.logger.error(`JoFotara API Error: ${error.response?.data || error.message}`);
|
this.logger.error(`JoFotara API Error: ${error.response?.data || error.message}`);
|
||||||
throw new InternalServerErrorException(
|
throw new InternalServerErrorException(
|
||||||
`Failed to submit invoice to JoFotara: ${error.response?.data?.message || 'Unknown Error'}`,
|
`Failed to submit invoice to JoFotara: ${error.response?.data?.message || 'Unknown Error'}`,
|
||||||
@@ -72,7 +72,7 @@ export class JoFotaraGatewayService {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
throw new InternalServerErrorException('Failed to check invoice status');
|
throw new InternalServerErrorException('Failed to check invoice status');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class UsersService {
|
|||||||
...dto,
|
...dto,
|
||||||
password_hash: passwordHash,
|
password_hash: passwordHash,
|
||||||
tenant_id: tenantId,
|
tenant_id: tenantId,
|
||||||
});
|
} as Partial<User>);
|
||||||
|
|
||||||
return this.userRepository.save(user);
|
return this.userRepository.save(user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
"extends": "./tsconfig",
|
"extends": "./tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"baseUrl": "./"
|
"baseUrl": "./",
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user