Backend Complete: Interface Refactoring & Service Container Enhancements
Repository Interface Optimization: - Created IBaseRepository.ts and IPaginatedRepository.ts - Refactored all 7 repository interfaces to extend base interfaces - Eliminated ~200 lines of redundant code (70% reduction) - Improved type safety and maintainability Dependency Injection Improvements: - Added EmailService and GameTokenService to DIContainer - Updated CreateUserCommandHandler constructor for DI - Updated RequestPasswordResetCommandHandler constructor for DI - Enhanced testability and service consistency Environment Configuration: - Created comprehensive .env.example with 40+ variables - Organized into 12 logical sections (Database, Security, Email, etc.) - Added security guidelines and best practices - Documented all backend environment requirements Documentation: - Added comprehensive codebase review - Created refactoring summary report - Added frontend implementation guide Impact: Improved code quality, reduced maintenance overhead, enhanced developer experience
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
import swaggerJSDoc from 'swagger-jsdoc';
|
||||
import path from 'path';
|
||||
|
||||
export const swaggerOptions = {
|
||||
definition: {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: 'SerpentRace API',
|
||||
version: '1.0.0',
|
||||
description: 'Comprehensive API documentation for SerpentRace Backend',
|
||||
contact: {
|
||||
name: 'SerpentRace Development Team',
|
||||
email: 'dev@serpentrace.com'
|
||||
},
|
||||
license: {
|
||||
name: 'MIT',
|
||||
url: 'https://opensource.org/licenses/MIT'
|
||||
}
|
||||
},
|
||||
servers: [
|
||||
{
|
||||
url: 'http://localhost:3001',
|
||||
description: 'Local development server'
|
||||
},
|
||||
{
|
||||
url: 'http://localhost:3000',
|
||||
description: 'Local development server (alt)'
|
||||
},
|
||||
{
|
||||
url: 'https://api.serpentrace.com',
|
||||
description: 'Production server'
|
||||
}
|
||||
],
|
||||
components: {
|
||||
securitySchemes: {
|
||||
bearerAuth: {
|
||||
type: 'http',
|
||||
scheme: 'bearer',
|
||||
bearerFormat: 'JWT',
|
||||
description: 'Enter JWT token obtained from /api/users/login'
|
||||
}
|
||||
}
|
||||
},
|
||||
security: [{ bearerAuth: [] }],
|
||||
tags: [
|
||||
{
|
||||
name: 'Users',
|
||||
description: 'User authentication and profile management'
|
||||
},
|
||||
{
|
||||
name: 'Organizations',
|
||||
description: 'Organization management and authentication'
|
||||
},
|
||||
{
|
||||
name: 'Decks',
|
||||
description: 'Deck creation, management, and gameplay'
|
||||
},
|
||||
{
|
||||
name: 'Chats',
|
||||
description: 'Real-time chat and messaging system'
|
||||
},
|
||||
{
|
||||
name: 'Contacts',
|
||||
description: 'Contact form and support requests'
|
||||
},
|
||||
{
|
||||
name: 'Deck Import/Export',
|
||||
description: 'Import and export deck functionality'
|
||||
},
|
||||
{
|
||||
name: 'Games',
|
||||
description: 'Game management and gameplay'
|
||||
},
|
||||
{
|
||||
name: 'Admin - Users',
|
||||
description: 'Admin user management operations'
|
||||
},
|
||||
{
|
||||
name: 'Admin - Decks',
|
||||
description: 'Admin deck management operations'
|
||||
},
|
||||
{
|
||||
name: 'Admin - Organizations',
|
||||
description: 'Admin organization management operations'
|
||||
},
|
||||
{
|
||||
name: 'Admin - Chats',
|
||||
description: 'Admin chat management operations'
|
||||
},
|
||||
{
|
||||
name: 'Admin - Contacts',
|
||||
description: 'Admin contact management operations'
|
||||
}
|
||||
]
|
||||
},
|
||||
apis: [
|
||||
'./src/Api/swagger/swaggerDefinitionsFixed.ts'
|
||||
],
|
||||
};
|
||||
|
||||
export const swaggerSpec = swaggerJSDoc(swaggerOptions);
|
||||
Reference in New Issue
Block a user