feat: add config module with controller and service
- Implemented ConfigController for handling config-related requests. - Created ConfigService for business logic related to configurations. - Added CreateConfigDto for validating configuration data. feat: add good categories module with controller and service - Implemented GoodCategoriesController for managing good categories. - Created GoodCategoriesService for business logic related to good categories. - Added CreateGoodCategoryDto for validating good category data. feat: add goods module with controller and service - Implemented GoodsController for managing goods. - Created GoodsService for business logic related to goods. - Added CreateGoodDto for validating good data. feat: add profile module with controller and service - Implemented ProfileController for managing user profiles. - Created ProfileService for business logic related to profiles. - Added CreateProfileDto for profile data structure. feat: add sales invoice payments module with controller and service - Implemented SalesInvoicePaymentsController for managing invoice payments. - Created SalesInvoicePaymentsService for business logic related to payments. - Added CreateSalesInvoicePaymentDto for validating payment data. feat: add service categories module with controller and service - Implemented ServiceCategoriesController for managing service categories. - Created ServiceCategoriesService for business logic related to service categories. - Added CreateServiceCategoryDto for validating service category data. feat: add services module with controller and service - Implemented ServicesController for managing services. - Created ServicesService for business logic related to services. - Added CreateServiceDto for validating service data. feat: add trigger logs module with controller and service - Implemented TriggerLogsController for managing trigger logs. - Created TriggerLogsService for business logic related to trigger logs. - Added CreateTriggerLogDto for validating trigger log data. feat: add uploaders module for handling file uploads - Implemented UploadersController for managing file uploads. - Created ImageUploaderService for image upload logic. - Created UploaderService for file handling and storage.
This commit is contained in:
+19
-4
@@ -1,24 +1,37 @@
|
||||
import { ValidationPipe, VersioningType } from '@nestjs/common'
|
||||
import { NestFactory } from '@nestjs/core'
|
||||
import { NestFactory, Reflector } from '@nestjs/core'
|
||||
import { JwtService } from '@nestjs/jwt'
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
|
||||
import { AppModule } from './app.module'
|
||||
import { PrismaExceptionFilter } from './common/filters/prisma-exception.filter'
|
||||
import { LoggingInterceptor } from './common/interceptors/logging.interceptor'
|
||||
import { ResponseMappingInterceptor } from './common/interceptors/response-mapping.interceptor'
|
||||
import { JwtAuthGuard } from './modules/auth/jwt-auth.guard'
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule)
|
||||
|
||||
const cookieParser = (await import('cookie-parser')).default
|
||||
app.use(cookieParser())
|
||||
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('Pos')
|
||||
.setDescription('The Pos API description')
|
||||
.setVersion('1.0')
|
||||
.addTag('pos')
|
||||
.addBearerAuth({
|
||||
type: 'http',
|
||||
scheme: 'bearer',
|
||||
bearerFormat: 'JWT',
|
||||
name: 'Authorization',
|
||||
description: 'Enter JWT token',
|
||||
in: 'header',
|
||||
})
|
||||
.build()
|
||||
const documentFactory = () => SwaggerModule.createDocument(app, config)
|
||||
SwaggerModule.setup('swagger', app, documentFactory)
|
||||
|
||||
// Set API prefix and enable URI versioning so all routes live under /api/v1/*
|
||||
// Set API prefix and enable URI versioning so alls routes live under /api/v1/*
|
||||
app.setGlobalPrefix('api')
|
||||
app.enableVersioning({
|
||||
type: VersioningType.URI,
|
||||
@@ -27,7 +40,7 @@ async function bootstrap() {
|
||||
|
||||
// Enable CORS. You can set `CORS_ORIGINS` to a comma-separated list of allowed origins.
|
||||
// Defaults include common localhost origins used by front-end dev servers.
|
||||
const defaultOrigins = ['http://localhost:3001']
|
||||
const defaultOrigins = ['*', 'http://localhost:3001']
|
||||
const envOrigins = process.env.CORS_ORIGINS
|
||||
? process.env.CORS_ORIGINS.split(',')
|
||||
.map(s => s.trim())
|
||||
@@ -50,6 +63,8 @@ async function bootstrap() {
|
||||
// Register global exception filter to map Prisma and validation errors to proper HTTP codes
|
||||
app.useGlobalFilters(new PrismaExceptionFilter())
|
||||
|
||||
await app.listen(process.env.PORT ?? 3000)
|
||||
app.useGlobalGuards(new JwtAuthGuard(app.get(JwtService), app.get(Reflector)))
|
||||
|
||||
await app.listen(process.env.PORT ?? 5002)
|
||||
}
|
||||
bootstrap()
|
||||
|
||||
Reference in New Issue
Block a user