Skip to content

Commit

Permalink
style: format code to follow new prettier guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
Marwen Dallel authored and Marwen Dallel committed Apr 13, 2021
1 parent cdf21df commit 4506eb7
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/core/domain-events/domain-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class DomainEvents {
private static removeAggregateFromPublishList(
aggregate: AggregateRoot<unknown>,
): void {
const index = this.aggregates.findIndex(a => a.equals(aggregate));
const index = this.aggregates.findIndex((a) => a.equals(aggregate));
this.aggregates.splice(index, 1);
}

Expand All @@ -75,7 +75,7 @@ export class DomainEvents {

if (this.subscribers.has(eventName)) {
const callbacks: EventCallback[] = this.subscribers.get(eventName) || [];
await Promise.all(callbacks.map(callback => callback(event)));
await Promise.all(callbacks.map((callback) => callback(event)));
}
}
}
2 changes: 1 addition & 1 deletion src/core/guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Guard {
if (value.length === 0) {
return true;
}
if (value.every(item => Guard.isEmpty(item))) {
if (value.every((item) => Guard.isEmpty(item))) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils/convert-props-to-object.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function convertPropsToObject(props: any): any {
// eslint-disable-next-line guard-for-in
for (const prop in propsCopy) {
if (Array.isArray(propsCopy[prop])) {
propsCopy[prop] = (propsCopy[prop] as Array<unknown>).map(item =>
propsCopy[prop] = (propsCopy[prop] as Array<unknown>).map((item) =>
convertToRaw(item),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ export abstract class TypeormRepositoryBase<
}

async saveMultiple(entities: Entity[]): Promise<Entity[]> {
const ormEntities = entities.map(entity => this.mapper.toOrmEntity(entity));
const ormEntities = entities.map((entity) =>
this.mapper.toOrmEntity(entity),
);
const result = await this.repository.save(ormEntities);
this.logger.debug(
`[Multiple entities persisted]: ${entities.length} ${this.tableName}`,
);
await Promise.all(
entities.map(entity =>
entities.map((entity) =>
DomainEvents.publishEvents(entity.id, this.logger),
),
);
return result.map(entity => this.mapper.toDomainEntity(entity));
return result.map((entity) => this.mapper.toDomainEntity(entity));
}

async findOne(
Expand Down Expand Up @@ -96,7 +98,7 @@ export abstract class TypeormRepositoryBase<
relations: this.relations,
});

return result.map(item => this.mapper.toDomainEntity(item));
return result.map((item) => this.mapper.toDomainEntity(item));
}

async findManyPaginated({
Expand All @@ -115,7 +117,7 @@ export abstract class TypeormRepositoryBase<
});

const result: DataWithPaginationMeta<Entity[]> = {
data: data.map(item => this.mapper.toDomainEntity(item)),
data: data.map((item) => this.mapper.toDomainEntity(item)),
count,
limit: pagination?.limit,
page: pagination?.page,
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/interceptors/exception.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ExceptionInterceptor implements NestInterceptor {
next: CallHandler,
): Observable<ExceptionBase> {
return next.handle().pipe(
catchError(err => {
catchError((err) => {
if (err instanceof DomainException) {
throw new NestForbiddenException(err.message);
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/user/database/seeding/user.seeder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { userSeeds } from './user.seeds';
export default class CreateUsers implements Seeder {
public async run(factory: Factory): Promise<void> {
await Promise.all(
userSeeds.map(seed => factory(UserOrmEntity)().create(seed)),
userSeeds.map((seed) => factory(UserOrmEntity)().create(seed)),
);
}
}
5 changes: 1 addition & 4 deletions test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@ describe('AppController (e2e)', () => {
});

it('/ (GET)', () =>
request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!'));
request(app.getHttpServer()).get('/').expect(200).expect('Hello World!'));
});

0 comments on commit 4506eb7

Please sign in to comment.