Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions apps/chat-app/src/chat-app.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { ChatAppController } from './chat-app.controller';
import { ChatAppService } from './chat-app.service';

describe('ChatAppController', () => {
let chatAppController: ChatAppController;

beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [ChatAppController],
providers: [ChatAppService],
}).compile();

chatAppController = app.get<ChatAppController>(ChatAppController);
});

describe('root', () => {
it('should return "Hello World!"', () => {
expect(chatAppController.getHello()).toBe('Hello World!');
});
});
});
12 changes: 12 additions & 0 deletions apps/chat-app/src/chat-app.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { ChatAppService } from './chat-app.service';

@Controller()
export class ChatAppController {
constructor(private readonly chatAppService: ChatAppService) {}

@Get()
getHello(): string {
return this.chatAppService.getHello();
}
}
10 changes: 10 additions & 0 deletions apps/chat-app/src/chat-app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { ChatAppController } from './chat-app.controller';
import { ChatAppService } from './chat-app.service';

@Module({
imports: [],
controllers: [ChatAppController],
providers: [ChatAppService],
})
export class ChatAppModule {}
8 changes: 8 additions & 0 deletions apps/chat-app/src/chat-app.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class ChatAppService {
getHello(): string {
return 'Hello World!';
}
}
8 changes: 8 additions & 0 deletions apps/chat-app/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { ChatAppModule } from './chat-app.module';

async function bootstrap() {
const app = await NestFactory.create(ChatAppModule);
await app.listen(3000);
}
bootstrap();
24 changes: 24 additions & 0 deletions apps/chat-app/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { ChatAppModule } from './../src/chat-app.module';

describe('ChatAppController (e2e)', () => {
let app: INestApplication;

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [ChatAppModule],
}).compile();

app = moduleFixture.createNestApplication();
await app.init();
});

it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!');
});
});
File renamed without changes.
9 changes: 9 additions & 0 deletions apps/chat-app/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/chat-app"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main.ts → apps/nestjs-be-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function bootstrap() {
await app.register(fastifyCsrf);

// eslint-disable-next-line @typescript-eslint/no-var-requires
const appData = require('../package.json');
const appData = require('../../../package.json');
const name = appData.name || '';
const version = appData.version || '';
const description = appData.description || '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
UnauthorizedException,
} from '@nestjs/common';
import { Observable } from 'rxjs';
import { getEnv } from 'src/config/env';
import { UsersUtils } from 'src/utils/users.util';
import { getEnv } from '../config/env';
import { UsersUtils } from '../utils/users.util';

@Injectable()
export class AuthGuard implements CanActivate {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsOptional, IsNotEmpty, IsIn } from 'class-validator';
import { ROLE } from 'src/constants/users';
import { ROLE } from '../../../constants/users';

export class CreateUserDto {
@IsOptional()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResponseDTO } from 'src/dtos/response';
import { ResponseDTO } from '../../../dtos/response';

export class LoginResponse extends ResponseDTO {
accessToken?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
UseGuards,
} from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { UserEmail, UserId } from 'src/decorators/user.decorator';
import { ResponseDTO } from 'src/dtos/response';
import { AuthGuard } from 'src/middlewares/auth.guard';
import { UserEmail, UserId } from '../../decorators/user.decorator';
import { ResponseDTO } from '../../dtos/response';
import { AuthGuard } from '../../middlewares/auth.guard';
import {
CreateUserDto,
LoginUserDto,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UsersController } from './users.controller';
import { UsersService } from './users.service';
import { usersProviders } from './users.providers';
import { DatabaseModule } from '../../db.module';
import { UsersUtils } from 'src/utils/users.util';
import { UsersUtils } from '../../utils/users.util';

@Module({
imports: [DatabaseModule],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { USERS_REPOSITORY } from 'src/constants/entity';
import { USERS_REPOSITORY } from '../../constants/entity';
import { User } from './user.entity';

export const usersProviders = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
UpdateUserPasswordDto,
} from './dtos/users-request.dto';
import { User } from './user.entity';
import { STATUS } from 'src/constants/users';
import MESSAGES from 'src/constants/messages';
import { USERS_REPOSITORY } from 'src/constants/entity';
import { UsersUtils } from 'src/utils/users.util';
import { getEnv } from 'src/config/env';
import { STATUS } from '../../constants/users';
import MESSAGES from '../../constants/messages';
import { USERS_REPOSITORY } from '../../constants/entity';
import { UsersUtils } from '../../utils/users.util';
import { getEnv } from '../../config/env';
import { LoginResponse } from './dtos/users-response.dto';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Sequelize } from 'sequelize-typescript';
import { getEnv, isLocalDev } from 'src/config/env';
import { getEnv, isLocalDev } from '../config/env';
import entities from '../entities';

export const databaseProviders = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { v4 as uuidv4 } from 'uuid';
import * as crypto from 'crypto';
import * as jwt from 'jsonwebtoken';
import { UnauthorizedException } from '@nestjs/common/exceptions';
import { getEnv } from 'src/config/env';
import { getEnv } from '../config/env';

export class UsersUtils {
createSalt() {
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions apps/nestjs-be-app/test/jest-e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}
9 changes: 9 additions & 0 deletions apps/nestjs-be-app/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/nestjs-be-app"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}
8 changes: 8 additions & 0 deletions apps/notification-app/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { NotificationAppModule } from './notification-app.module';

async function bootstrap() {
const app = await NestFactory.create(NotificationAppModule);
await app.listen(3000);
}
bootstrap();
22 changes: 22 additions & 0 deletions apps/notification-app/src/notification-app.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { NotificationAppController } from './notification-app.controller';
import { NotificationAppService } from './notification-app.service';

describe('NotificationAppController', () => {
let notificationAppController: NotificationAppController;

beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [NotificationAppController],
providers: [NotificationAppService],
}).compile();

notificationAppController = app.get<NotificationAppController>(NotificationAppController);
});

describe('root', () => {
it('should return "Hello World!"', () => {
expect(notificationAppController.getHello()).toBe('Hello World!');
});
});
});
12 changes: 12 additions & 0 deletions apps/notification-app/src/notification-app.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { NotificationAppService } from './notification-app.service';

@Controller()
export class NotificationAppController {
constructor(private readonly notificationAppService: NotificationAppService) {}

@Get()
getHello(): string {
return this.notificationAppService.getHello();
}
}
10 changes: 10 additions & 0 deletions apps/notification-app/src/notification-app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { NotificationAppController } from './notification-app.controller';
import { NotificationAppService } from './notification-app.service';

@Module({
imports: [],
controllers: [NotificationAppController],
providers: [NotificationAppService],
})
export class NotificationAppModule {}
8 changes: 8 additions & 0 deletions apps/notification-app/src/notification-app.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class NotificationAppService {
getHello(): string {
return 'Hello World!';
}
}
24 changes: 24 additions & 0 deletions apps/notification-app/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { NotificationAppModule } from './../src/notification-app.module';

describe('NotificationAppController (e2e)', () => {
let app: INestApplication;

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [NotificationAppModule],
}).compile();

app = moduleFixture.createNestApplication();
await app.init();
});

it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!');
});
});
9 changes: 9 additions & 0 deletions apps/notification-app/test/jest-e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}
9 changes: 9 additions & 0 deletions apps/notification-app/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/notification-app"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}
39 changes: 36 additions & 3 deletions nest-cli.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,41 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"sourceRoot": "apps/nestjs-be-app/src",
"compilerOptions": {
"deleteOutDir": true
"deleteOutDir": true,
"webpack": true,
"tsConfigPath": "apps/nestjs-be-app/tsconfig.app.json"
},
"monorepo": true,
"root": "apps/nestjs-be-app",
"projects": {
"nestjs-be-app": {
"type": "application",
"root": "apps/nestjs-be-app",
"entryFile": "main",
"sourceRoot": "apps/nestjs-be-app/src",
"compilerOptions": {
"tsConfigPath": "apps/nestjs-be-app/tsconfig.app.json"
}
},
"notification-app": {
"type": "application",
"root": "apps/notification-app",
"entryFile": "main",
"sourceRoot": "apps/notification-app/src",
"compilerOptions": {
"tsConfigPath": "apps/notification-app/tsconfig.app.json"
}
},
"chat-app": {
"type": "application",
"root": "apps/chat-app",
"entryFile": "main",
"sourceRoot": "apps/chat-app/src",
"compilerOptions": {
"tsConfigPath": "apps/chat-app/tsconfig.app.json"
}
}
}
}
}
Loading