Skip to content

Commit 1f5960d

Browse files
Alexander Kharkoveyklerick
authored andcommitted
chore(json-api-nestjs): format code
1 parent b844938 commit 1f5960d

File tree

128 files changed

+5879
-4589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+5879
-4589
lines changed

apps/example/src/app/app.module.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import { Module } from '@nestjs/common';
22
import { LoggerModule } from 'nestjs-pino';
33

4-
import {DatabaseModule} from 'database';
5-
import {ResourcesModule} from './resources/resources.module';
6-
4+
import { DatabaseModule } from 'database';
5+
import { ResourcesModule } from './resources/resources.module';
76

87
@Module({
98
imports: [
109
DatabaseModule,
1110
ResourcesModule,
1211
LoggerModule.forRoot({
1312
pinoHttp: {
14-
level: 'debug'
15-
}
16-
})
13+
level: 'debug',
14+
},
15+
}),
1716
],
1817
controllers: [],
1918
providers: [],

apps/example/src/app/resources/controllers/extend-user/extend-user.controller.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1-
import {Get, Param, Inject} from '@nestjs/common';
2-
3-
import {Users} from 'database';
4-
import {JsonApi, excludeMethod, JsonBaseController, InjectService, JsonApiService, QueryParams} from 'json-api-nestjs';
5-
import {ExampleService} from '../../service/example/example.service';
6-
1+
import { Get, Param, Inject } from '@nestjs/common';
72

3+
import { Users } from 'database';
4+
import {
5+
JsonApi,
6+
excludeMethod,
7+
JsonBaseController,
8+
InjectService,
9+
JsonApiService,
10+
QueryParams,
11+
} from 'json-api-nestjs';
12+
import { ExampleService } from '../../service/example/example.service';
813

914
@JsonApi(Users, {
1015
allowMethod: excludeMethod(['deleteRelationship']),
11-
requiredSelectField: true
16+
requiredSelectField: true,
1217
})
13-
export class ExtendUserController extends JsonBaseController<Users>{
18+
export class ExtendUserController extends JsonBaseController<Users> {
1419
@InjectService() public service: JsonApiService<Users>;
15-
@Inject(ExampleService) protected exampleService: ExampleService
20+
@Inject(ExampleService) protected exampleService: ExampleService;
1621

17-
public override getAll(query: QueryParams<Users>){
18-
return this.service.getAll({query})
22+
public override getAll(query: QueryParams<Users>) {
23+
return this.service.getAll({ query });
1924
}
2025

2126
@Get(':id/example')
Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
import { Module } from '@nestjs/common';
2-
import {JsonApiModule} from 'json-api-nestjs';
3-
import {Users, Addresses, Comments, Roles} from 'database';
2+
import { JsonApiModule } from 'json-api-nestjs';
3+
import { Users, Addresses, Comments, Roles } from 'database';
44

5-
import {ExtendUserController} from './controllers/extend-user/extend-user.controller';
6-
import {ExampleService} from './service/example/example.service';
5+
import { ExtendUserController } from './controllers/extend-user/extend-user.controller';
6+
import { ExampleService } from './service/example/example.service';
77

88
@Module({
99
imports: [
1010
JsonApiModule.forRoot({
11-
entities: [
12-
Users,
13-
Addresses,
14-
Comments,
15-
Roles
16-
],
17-
controllers: [
18-
ExtendUserController
19-
],
20-
providers: [
21-
ExampleService
22-
],
11+
entities: [Users, Addresses, Comments, Roles],
12+
controllers: [ExtendUserController],
13+
providers: [ExampleService],
2314
options: {
2415
debug: true,
2516
maxExecutionTime: 3000,
26-
requiredSelectField: false
27-
}
28-
})
29-
]
17+
requiredSelectField: false,
18+
},
19+
}),
20+
],
3021
})
3122
export class ResourcesModule {}

apps/example/src/app/resources/service/example/example.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export class ExampleService{
1+
export class ExampleService {
22
testMethode(id: string): string {
33
return id;
44
}

apps/example/src/main.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@
33
* This is only a minimal backend to get started.
44
*/
55

6-
import {VersioningType} from '@nestjs/common';
7-
import {NestFactory} from '@nestjs/core';
8-
import {DocumentBuilder, SwaggerModule} from '@nestjs/swagger';
9-
import {Logger} from 'nestjs-pino';
10-
11-
import {AppModule} from './app/app.module';
6+
import { VersioningType } from '@nestjs/common';
7+
import { NestFactory } from '@nestjs/core';
8+
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
9+
import { Logger } from 'nestjs-pino';
1210

11+
import { AppModule } from './app/app.module';
1312

1413
async function bootstrap() {
15-
const app = await NestFactory.create(AppModule, {bufferLogs: true});
16-
const ligerInst = app.get(Logger)
14+
const app = await NestFactory.create(AppModule, { bufferLogs: true });
15+
const ligerInst = app.get(Logger);
1716
app.useLogger(ligerInst);
1817
app.flushLogs();
1918
const globalPrefix = 'api';
2019
app.setGlobalPrefix(globalPrefix);
2120

2221
app.enableVersioning({
2322
type: VersioningType.URI,
24-
defaultVersion: '1'
23+
defaultVersion: '1',
2524
});
2625

2726
const config = new DocumentBuilder()

decorate-angular-cli.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ let output;
2929
try {
3030
output = require('@nrwl/workspace').output;
3131
} catch (e) {
32-
console.warn('Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.');
32+
console.warn(
33+
'Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.'
34+
);
3335
process.exit(0);
3436
}
3537

@@ -46,24 +48,32 @@ function symlinkNgCLItoNxCLI() {
4648
* This is the most reliable way to create symlink-like behavior on Windows.
4749
* Such that it works in all shells and works with npx.
4850
*/
49-
['', '.cmd', '.ps1'].forEach(ext => {
50-
if (fs.existsSync(nxPath + ext)) fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
51+
['', '.cmd', '.ps1'].forEach((ext) => {
52+
if (fs.existsSync(nxPath + ext))
53+
fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
5154
});
5255
} else {
5356
// If unix-based, symlink
5457
cp.execSync(`ln -sf ./nx ${ngPath}`);
5558
}
56-
}
57-
catch(e) {
58-
output.error({ title: 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + e.message });
59+
} catch (e) {
60+
output.error({
61+
title:
62+
'Unable to create a symlink from the Angular CLI to the Nx CLI:' +
63+
e.message,
64+
});
5965
throw e;
6066
}
6167
}
6268

6369
try {
6470
symlinkNgCLItoNxCLI();
6571
require('nx/src/adapter/decorate-cli').decorateCli();
66-
output.log({ title: 'Angular CLI has been decorated to enable computation caching.' });
67-
} catch(e) {
68-
output.error({ title: 'Decoration of the Angular CLI did not complete successfully' });
72+
output.log({
73+
title: 'Angular CLI has been decorated to enable computation caching.',
74+
});
75+
} catch (e) {
76+
output.error({
77+
title: 'Decoration of the Angular CLI did not complete successfully',
78+
});
6979
}

libs/database/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * from './lib/database.module';
2-
export * from './lib/entities'
2+
export * from './lib/entities';
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
import { DataSource, DataSourceOptions } from 'typeorm';
2-
import {join} from 'path';
2+
import { join } from 'path';
33

44
const config: DataSourceOptions = {
5-
type: "postgres",
6-
host: "localhost",
5+
type: 'postgres',
6+
host: 'localhost',
77
port: 5432,
8-
username: "postgres",
9-
password: "password",
10-
database: "example_new",
8+
username: 'postgres',
9+
password: 'password',
10+
database: 'example_new',
1111
logging: true,
1212
migrations: [join(__dirname, '/migrations/**/*{.ts,.js}')],
1313
entities: [join(__dirname, '/entities/**/*{.ts,.js}')],
14-
15-
}
14+
};
1615

1716
const configSeeder = {
18-
seeders: ["./libs/database/src/lib/seeders/*.ts"],
19-
defaultSeeder: "RootSeeder"
20-
}
21-
22-
export {config, configSeeder};
17+
seeders: ['./libs/database/src/lib/seeders/*.ts'],
18+
defaultSeeder: 'RootSeeder',
19+
};
2320

21+
export { config, configSeeder };
2422

25-
export default new DataSource({...config, ...configSeeder});
23+
export default new DataSource({ ...config, ...configSeeder });

libs/database/src/lib/config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {TypeOrmModuleOptions} from '@nestjs/typeorm';
1+
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
22

3-
import {config as ormConfig} from './config-cli';
4-
import {Roles, Comments, Users, Addresses} from './entities';
3+
import { config as ormConfig } from './config-cli';
4+
import { Roles, Comments, Users, Addresses } from './entities';
55

66
export const config: TypeOrmModuleOptions = {
77
...ormConfig,
88
...{
9-
entities: [Roles, Comments, Users, Addresses]
10-
}
9+
entities: [Roles, Comments, Users, Addresses],
10+
},
1111
};
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import { Module } from '@nestjs/common';
22
import { TypeOrmModule } from '@nestjs/typeorm';
33

4-
import {config} from './config';
4+
import { config } from './config';
55

66
@Module({
7-
imports: [
8-
TypeOrmModule.forRoot(config)
9-
],
10-
exports: [
11-
TypeOrmModule
12-
],
7+
imports: [TypeOrmModule.forRoot(config)],
8+
exports: [TypeOrmModule],
139
})
1410
export class DatabaseModule {}

0 commit comments

Comments
 (0)