chore: migrate backend to monorepo apps and biome

This commit is contained in:
2026-04-03 18:04:59 +03:00
parent 33ca299632
commit 6032451b17
52 changed files with 956 additions and 1198 deletions

View File

@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
describe('AuthController', () => {
let authController: AuthController;
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [AuthController],
providers: [AuthService],
}).compile();
authController = app.get<AuthController>(AuthController);
});
describe('root', () => {
it('should return "Hello World!"', () => {
expect(authController.getHello()).toBe('Hello World!');
});
});
});

View File

@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { AuthService } from './auth.service';
@Controller()
export class AuthController {
constructor(private readonly authService: AuthService) {}
@Get()
getHello(): string {
return this.authService.getHello();
}
}

View File

@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
@Module({
imports: [],
controllers: [AuthController],
providers: [AuthService],
})
export class AuthModule {}

View File

@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class AuthService {
getHello(): string {
return 'Hello World!';
}
}

8
apps/auth/src/main.ts Normal file
View File

@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { AuthModule } from './auth.module';
async function bootstrap() {
const app = await NestFactory.create(AuthModule);
await app.listen(process.env.AUTH_PORT ?? 3000);
}
bootstrap();

View File

@@ -0,0 +1,21 @@
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import * as request from 'supertest';
import { AuthModule } from './../src/auth.module';
describe('AuthController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AuthModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
});
});

View File

@@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/auth"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}

View File

@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { BookingsController } from './bookings.controller';
import { BookingsService } from './bookings.service';
describe('BookingsController', () => {
let bookingsController: BookingsController;
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [BookingsController],
providers: [BookingsService],
}).compile();
bookingsController = app.get<BookingsController>(BookingsController);
});
describe('root', () => {
it('should return "Hello World!"', () => {
expect(bookingsController.getHello()).toBe('Hello World!');
});
});
});

View File

@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { BookingsService } from './bookings.service';
@Controller()
export class BookingsController {
constructor(private readonly bookingsService: BookingsService) {}
@Get()
getHello(): string {
return this.bookingsService.getHello();
}
}

View File

@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { BookingsController } from './bookings.controller';
import { BookingsService } from './bookings.service';
@Module({
imports: [],
controllers: [BookingsController],
providers: [BookingsService],
})
export class BookingsModule {}

View File

@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class BookingsService {
getHello(): string {
return 'Hello World!';
}
}

View File

@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { BookingsModule } from './bookings.module';
async function bootstrap() {
const app = await NestFactory.create(BookingsModule);
await app.listen(process.env.BOOKING_PORT ?? 3004);
}
bootstrap();

View File

@@ -0,0 +1,21 @@
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import * as request from 'supertest';
import { BookingsModule } from './../src/bookings.module';
describe('BookingsController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [BookingsModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
});
});

View File

@@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/bookings"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}

View File

@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { GatewayController } from './gateway.controller';
import { GatewayService } from './gateway.service';
describe('GatewayController', () => {
let gatewayController: GatewayController;
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [GatewayController],
providers: [GatewayService],
}).compile();
gatewayController = app.get<GatewayController>(GatewayController);
});
describe('root', () => {
it('should return "Hello World!"', () => {
expect(gatewayController.getHello()).toBe('Hello World!');
});
});
});

View File

@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { GatewayService } from './gateway.service';
@Controller()
export class GatewayController {
constructor(private readonly gatewayService: GatewayService) {}
@Get()
getHello(): string {
return this.gatewayService.getHello();
}
}

View File

@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { GatewayController } from './gateway.controller';
import { GatewayService } from './gateway.service';
@Module({
imports: [],
controllers: [GatewayController],
providers: [GatewayService],
})
export class GatewayModule {}

View File

@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class GatewayService {
getHello(): string {
return 'Hello World!';
}
}

8
apps/gateway/src/main.ts Normal file
View File

@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { GatewayModule } from './gateway.module';
async function bootstrap() {
const app = await NestFactory.create(GatewayModule);
await app.listen(process.env.GATEWAY_PORT ?? 3001);
}
bootstrap();

View File

@@ -0,0 +1,21 @@
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import request from 'supertest';
import { GatewayModule } from './../src/gateway.module';
describe('GatewayController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [GatewayModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
});
});

View File

@@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/gateway"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}

View File

@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { NotificationsModule } from './notifications.module';
async function bootstrap() {
const app = await NestFactory.create(NotificationsModule);
await app.listen(process.env.NOTIFICATIONS_PORT ?? 3003);
}
bootstrap();

View File

@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { NotificationsController } from './notifications.controller';
import { NotificationsService } from './notifications.service';
describe('NotificationsController', () => {
let notificationsController: NotificationsController;
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [NotificationsController],
providers: [NotificationsService],
}).compile();
notificationsController = app.get<NotificationsController>(NotificationsController);
});
describe('root', () => {
it('should return "Hello World!"', () => {
expect(notificationsController.getHello()).toBe('Hello World!');
});
});
});

View File

@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { NotificationsService } from './notifications.service';
@Controller()
export class NotificationsController {
constructor(private readonly notificationsService: NotificationsService) {}
@Get()
getHello(): string {
return this.notificationsService.getHello();
}
}

View File

@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { NotificationsController } from './notifications.controller';
import { NotificationsService } from './notifications.service';
@Module({
imports: [],
controllers: [NotificationsController],
providers: [NotificationsService],
})
export class NotificationsModule {}

View File

@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class NotificationsService {
getHello(): string {
return 'Hello World!';
}
}

View File

@@ -0,0 +1,21 @@
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import * as request from 'supertest';
import { NotificationsModule } from './../src/notifications.module';
describe('NotificationsController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [NotificationsModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
});
});

View File

@@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/notifications"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}

8
apps/tasks/src/main.ts Normal file
View File

@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { TasksModule } from './tasks.module';
async function bootstrap() {
const app = await NestFactory.create(TasksModule);
await app.listen(process.env.TASKS_PORT ?? 3002);
}
bootstrap();

View File

@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { TasksController } from './tasks.controller';
import { TasksService } from './tasks.service';
describe('TasksController', () => {
let tasksController: TasksController;
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [TasksController],
providers: [TasksService],
}).compile();
tasksController = app.get<TasksController>(TasksController);
});
describe('root', () => {
it('should return "Hello World!"', () => {
expect(tasksController.getHello()).toBe('Hello World!');
});
});
});

View File

@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { TasksService } from './tasks.service';
@Controller()
export class TasksController {
constructor(private readonly tasksService: TasksService) {}
@Get()
getHello(): string {
return this.tasksService.getHello();
}
}

View File

@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { TasksController } from './tasks.controller';
import { TasksService } from './tasks.service';
@Module({
imports: [],
controllers: [TasksController],
providers: [TasksService],
})
export class TasksModule {}

View File

@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class TasksService {
getHello(): string {
return 'Hello World!';
}
}

View File

@@ -0,0 +1,21 @@
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import * as request from 'supertest';
import { TasksModule } from './../src/tasks.module';
describe('TasksController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [TasksModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
});
});

View File

@@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/tasks"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}