Skip to content

Commit

Permalink
feat(pmp-api): create shall an api libraries for project domain
Browse files Browse the repository at this point in the history
Create shell and api libraries
for project domain inside pmp-api.
Create first simply endpoint
for synchronizing local data with the external.

close #38
  • Loading branch information
MaciejSikorski committed Dec 13, 2019
1 parent f9c98a1 commit a2d3c1a
Show file tree
Hide file tree
Showing 27 changed files with 210 additions and 70 deletions.
50 changes: 50 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,56 @@
"styleext": "scss"
}
}
},
"pmp-api-project-api": {
"root": "libs/pmp-api/project/api",
"sourceRoot": "libs/pmp-api/project/api/src",
"projectType": "library",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/pmp-api/project/api/tsconfig.lib.json",
"libs/pmp-api/project/api/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!libs/pmp-api/project/api/**"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/pmp-api/project/api/jest.config.js",
"tsConfig": "libs/pmp-api/project/api/tsconfig.spec.json"
}
}
}
},
"pmp-api-project-shell": {
"root": "libs/pmp-api/project/shell",
"sourceRoot": "libs/pmp-api/project/shell/src",
"projectType": "library",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/pmp-api/project/shell/tsconfig.lib.json",
"libs/pmp-api/project/shell/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!libs/pmp-api/project/shell/**"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/pmp-api/project/shell/jest.config.js",
"tsConfig": "libs/pmp-api/project/shell/tsconfig.spec.json"
}
}
}
}
},
"cli": {
Expand Down
22 changes: 0 additions & 22 deletions apps/pmp-api/src/app/app.controller.spec.ts

This file was deleted.

12 changes: 0 additions & 12 deletions apps/pmp-api/src/app/app.controller.ts

This file was deleted.

8 changes: 2 additions & 6 deletions apps/pmp-api/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Module } from '@nestjs/common';

import { AppController } from './app.controller';
import { AppService } from './app.service';
import { PmpApiProjectShellModule } from '@pimp-my-pr/pmp-api/project/shell';

@Module({
imports: [],
controllers: [AppController],
providers: [AppService]
imports: [PmpApiProjectShellModule]
})
export class AppModule {}
21 changes: 0 additions & 21 deletions apps/pmp-api/src/app/app.service.spec.ts

This file was deleted.

8 changes: 0 additions & 8 deletions apps/pmp-api/src/app/app.service.ts

This file was deleted.

7 changes: 7 additions & 0 deletions libs/pmp-api/project/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pmp-api-project-api

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `ng test pmp-api-project-api` to execute the unit tests via [Jest](https://jestjs.io).
9 changes: 9 additions & 0 deletions libs/pmp-api/project/api/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
name: 'pmp-api-project-api',
preset: '../../../../jest.config.js',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest'
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
coverageDirectory: '../../../../coverage/libs/pmp-api/project/api'
};
20 changes: 20 additions & 0 deletions libs/pmp-api/project/api/src/controller/app.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Test, TestingModule } from '@nestjs/testing';

import { ProjectController } from './project.controller';

describe('ProjectController', () => {
let app: TestingModule;

beforeAll(async () => {
app = await Test.createTestingModule({
controllers: [ProjectController]
}).compile();
});

describe('sync', () => {
it('should return successful response', () => {
const controller = app.get<ProjectController>(ProjectController);
expect(controller.sync()).toBeTruthy();
});
});
});
9 changes: 9 additions & 0 deletions libs/pmp-api/project/api/src/controller/project.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Controller, Get } from '@nestjs/common';

@Controller('project')
export class ProjectController {
@Get('sync')
sync(): any {
return {};
}
}
1 change: 1 addition & 0 deletions libs/pmp-api/project/api/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/pmp-api-project-api.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Module } from '@nestjs/common';
import { ProjectController } from '../controller/project.controller';

@Module({
controllers: [ProjectController]
})
export class PmpApiProjectApiModule {}
7 changes: 7 additions & 0 deletions libs/pmp-api/project/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.json",
"compilerOptions": {
"types": ["node", "jest"]
},
"include": ["**/*.ts"]
}
9 changes: 9 additions & 0 deletions libs/pmp-api/project/api/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"types": []
},
"exclude": ["**/*.spec.ts"],
"include": ["**/*.ts"]
}
15 changes: 15 additions & 0 deletions libs/pmp-api/project/api/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.spec.js",
"**/*.spec.jsx",
"**/*.d.ts"
]
}
1 change: 1 addition & 0 deletions libs/pmp-api/project/api/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "../../../../tslint.json", "rules": [] }
7 changes: 7 additions & 0 deletions libs/pmp-api/project/shell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pmp-api-project-shell

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `ng test pmp-api-project-shell` to execute the unit tests via [Jest](https://jestjs.io).
9 changes: 9 additions & 0 deletions libs/pmp-api/project/shell/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
name: 'pmp-api-project-shell',
preset: '../../../../jest.config.js',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest'
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
coverageDirectory: '../../../../coverage/libs/pmp-api/project/shell'
};
1 change: 1 addition & 0 deletions libs/pmp-api/project/shell/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/pmp-api-project-shell.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Module } from '@nestjs/common';
import { PmpApiProjectApiModule } from '@pimp-my-pr/pmp-api/project/api';

@Module({
imports: [PmpApiProjectApiModule]
})
export class PmpApiProjectShellModule {}
7 changes: 7 additions & 0 deletions libs/pmp-api/project/shell/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.json",
"compilerOptions": {
"types": ["node", "jest"]
},
"include": ["**/*.ts"]
}
9 changes: 9 additions & 0 deletions libs/pmp-api/project/shell/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"types": []
},
"exclude": ["**/*.spec.ts"],
"include": ["**/*.ts"]
}
15 changes: 15 additions & 0 deletions libs/pmp-api/project/shell/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.spec.js",
"**/*.spec.jsx",
"**/*.d.ts"
]
}
1 change: 1 addition & 0 deletions libs/pmp-api/project/shell/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "../../../../tslint.json", "rules": [] }
6 changes: 6 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
},
"pmp-web-shell": {
"tags": ["scope:pmp-web", "type:shell"]
},
"pmp-api-project-api": {
"tags": ["scope:pmp-api", "type:api"]
},
"pmp-api-project-shell": {
"tags": ["scope:pmp-api", "type:shell"]
}
}
}
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@pimp-my-pr/pmp-web/shell": ["libs/pmp-web/shell/src/index.ts"]
"@pimp-my-pr/pmp-web/shell": ["libs/pmp-web/shell/src/index.ts"],
"@pimp-my-pr/pmp-api/project/api": [
"libs/pmp-api/project/api/src/index.ts"
],
"@pimp-my-pr/pmp-api/project/shell": [
"libs/pmp-api/project/shell/src/index.ts"
]
}
},
"exclude": ["node_modules", "tmp"]
Expand Down
4 changes: 4 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
"type:domain"
]
},
{
"sourceTag": "type:api",
"onlyDependOnLibsWithTags": ["type:core"]
},
{
"sourceTag": "type:ui",
"onlyDependOnLibsWithTags": [
Expand Down

0 comments on commit a2d3c1a

Please sign in to comment.