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
99 changes: 1 addition & 98 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest

<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->

## Description

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.

## Project setup

```bash
$ npm install
```

## Compile and run the project

```bash
# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
```

## Run tests

```bash
# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov
```

## Deployment

When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.

If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:

```bash
$ npm install -g @nestjs/mau
$ mau deploy
```

With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.

## Resources

Check out a few resources that may come in handy when working with NestJS:

- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).

## Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).

## Stay in touch

- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)

## License

Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
draw io:https://drive.google.com/file/d/1GG3wKqa1zMOOmao6KpTBBhl0Ykcl00Iv/view?usp=sharing
22 changes: 22 additions & 0 deletions apps/bridage/src/bridage.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { BridageController } from './bridage.controller';
import { BridageService } from './bridage.service';

describe('BridageController', () => {
let bridageController: BridageController;

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

bridageController = app.get<BridageController>(BridageController);
});

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

@Controller()
export class BridageController {
constructor(private readonly bridageService: BridageService) {}

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

@Module({
imports: [],
controllers: [BridageController],
providers: [BridageService],
})
export class BridageModule {}
2 changes: 1 addition & 1 deletion src/app.service.ts → apps/bridage/src/bridage.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {
export class BridageService {
getHello(): string {
return 'Hello World!';
}
Expand Down
20 changes: 20 additions & 0 deletions apps/bridage/src/bridage/bridage.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Test, TestingModule } from '@nestjs/testing';
import { BridageController } from './bridage.controller';
import { BridageService } from './bridage.service';

describe('BridageController', () => {
let controller: BridageController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [BridageController],
providers: [BridageService],
}).compile();

controller = module.get<BridageController>(BridageController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
7 changes: 7 additions & 0 deletions apps/bridage/src/bridage/bridage.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Controller } from '@nestjs/common';
import { BridageService } from './bridage.service';

@Controller('bridage')
export class BridageController {
constructor(private readonly bridageService: BridageService) {}
}
9 changes: 9 additions & 0 deletions apps/bridage/src/bridage/bridage.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { BridageService } from './bridage.service';
import { BridageController } from './bridage.controller';

@Module({
controllers: [BridageController],
providers: [BridageService],
})
export class BridageModule {}
18 changes: 18 additions & 0 deletions apps/bridage/src/bridage/bridage.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { BridageService } from './bridage.service';

describe('BridageService', () => {
let service: BridageService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [BridageService],
}).compile();

service = module.get<BridageService>(BridageService);
});

it('should be defined', () => {
expect(service).toBeDefined();
});
});
4 changes: 4 additions & 0 deletions apps/bridage/src/bridage/bridage.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class BridageService {}
13 changes: 13 additions & 0 deletions apps/bridage/src/bridage/entity/bridage.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { User } from "apps/users/src/user/entity/user.entity";
import { Entity, OneToOne, PrimaryGeneratedColumn } from "typeorm";



@Entity()
export class Bridage {
@PrimaryGeneratedColumn()
id: number;
@OneToOne(() => User, user => user.bridage)
user: User;
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { DataSource } from 'typeorm';
import configuration from './config/configuration';
import { Bridage } from 'apps/bridage/src/bridage/entity/bridage.entity';
import { DailyWorkouts } from 'apps/workouts/src/daily-workouts/entity/daily-workouts.entity';
import { User } from 'apps/users/src/user/entity/user.entity';
const config = configuration();
export const databaseProviders = [
{
Expand All @@ -9,7 +12,7 @@ export const databaseProviders = [
type: 'mongodb',
url: config.db_url,
database: 'test',
entities: [],
entities: [User, Bridage, DailyWorkouts],
synchronize: true,
});

Expand Down
8 changes: 8 additions & 0 deletions apps/bridage/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { BridageModule } from './bridage.module';

async function bootstrap() {
const app = await NestFactory.create(BridageModule);
await app.listen(process.env.port ?? 3000);
}
bootstrap();
9 changes: 4 additions & 5 deletions test/app.e2e-spec.ts → apps/bridage/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { App } from 'supertest/types';
import { AppModule } from './../src/app.module';
import { BridageModule } from './../src/bridage.module';

describe('AppController (e2e)', () => {
let app: INestApplication<App>;
describe('BridageController (e2e)', () => {
let app: INestApplication;

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

app = moduleFixture.createNestApplication();
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions apps/bridage/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/bridage"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { UserModule } from './user/user.module';

@Module({
imports: [UserModule],
controllers: [],
providers: [],
})
export class HackathonApiGatewayModule { }
8 changes: 8 additions & 0 deletions apps/hackathon-api-gateway/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { HackathonApiGatewayModule } from './hackathon-api-gateway.module';

async function bootstrap() {
const app = await NestFactory.create(HackathonApiGatewayModule);
await app.listen(process.env.port ?? 3000);
}
bootstrap();
11 changes: 11 additions & 0 deletions apps/hackathon-api-gateway/src/user/user.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Controller, Get } from '@nestjs/common';
import { UserService } from './user.service';

@Controller('user')
export class UserController {
constructor(private readonly userService: UserService) { }
@Get("findAll")
findAll() {
return this.userService.findAll()
}
}
26 changes: 26 additions & 0 deletions apps/hackathon-api-gateway/src/user/user.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Module } from '@nestjs/common';
import { UserService } from './user.service';
import { UserController } from './user.controller';
import { ClientsModule, Transport } from '@nestjs/microservices';


@Module({
imports: [
ClientsModule.register([
{
name: 'USER_SERVICE',
transport: Transport.RMQ,
options: {
urls: ['amqp://localhost:5672'],
queue: 'user_queue',
queueOptions: {
durable: false
},
},
},
]),
],
controllers: [UserController],
providers: [UserService],
})
export class UserModule { }
14 changes: 14 additions & 0 deletions apps/hackathon-api-gateway/src/user/user.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Inject, Injectable } from '@nestjs/common';
import { ClientProxy } from '@nestjs/microservices';

@Injectable()
export class UserService {
constructor(@Inject("USER_SERVICE") private usersClient: ClientProxy) { }
async findAll() {
console.log("aa")
return this.usersClient.send("user.findAll", {})

}


}
24 changes: 24 additions & 0 deletions apps/hackathon-api-gateway/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 { HackathonApiGatewayModule } from './../src/hackathon-api-gateway.module';

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

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [HackathonApiGatewayModule],
}).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/hackathon-api-gateway/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"
}
}
Loading