Skip to content

Commit

Permalink
feat(core): change scope
Browse files Browse the repository at this point in the history
Changed scope for all package deps and fixed lint issues

BREAKING CHANGE:
scope for all packages changed

SFO-20
  • Loading branch information
samarpan-b committed Jun 11, 2020
1 parent 6c16c1c commit d4bf68a
Show file tree
Hide file tree
Showing 46 changed files with 355 additions and 97 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"dist/__tests__\"",
"test": "echo \"No tests !\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"clean": "lb-clean dist *.tsbuildinfo .eslintcache"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@ export abstract class DefaultUserModifyCrudRepository<

async create(entity: DataObject<T>, options?: Options): Promise<T> {
let currentUser = await this.getCurrentUser();
currentUser = currentUser || options?.currentUser;
currentUser = currentUser ?? options?.currentUser;
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
const uid = currentUser?.userTenantId || currentUser?.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
entity.createdBy = uid;
entity.modifiedBy = uid;
return super.create(entity, options);
}

async createAll(entities: DataObject<T>[], options?: Options): Promise<T[]> {
let currentUser = await this.getCurrentUser();
currentUser = currentUser || options?.currentUser;
currentUser = currentUser ?? options?.currentUser;
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
const uid = currentUser?.userTenantId || currentUser?.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
entities.forEach(entity => {
entity.createdBy = uid || '';
entity.modifiedBy = uid || '';
entity.createdBy = uid ?? '';
entity.modifiedBy = uid ?? '';
});
return super.createAll(entities, options);
}
Expand All @@ -55,7 +55,7 @@ export abstract class DefaultUserModifyCrudRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
const uid = currentUser?.userTenantId || currentUser?.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
entity.modifiedBy = uid;
return super.save(entity, options);
}
Expand All @@ -65,7 +65,7 @@ export abstract class DefaultUserModifyCrudRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
const uid = currentUser?.userTenantId || currentUser?.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
entity.modifiedBy = uid;
return super.update(entity, options);
}
Expand All @@ -76,11 +76,11 @@ export abstract class DefaultUserModifyCrudRepository<
options?: Options,
): Promise<Count> {
let currentUser = await this.getCurrentUser();
currentUser = currentUser || options?.currentUser;
currentUser = currentUser ?? options?.currentUser;
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
const uid = currentUser?.userTenantId || currentUser?.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
data.modifiedBy = uid;
return super.updateAll(data, where, options);
}
Expand All @@ -91,11 +91,11 @@ export abstract class DefaultUserModifyCrudRepository<
options?: Options,
): Promise<void> {
let currentUser = await this.getCurrentUser();
currentUser = currentUser || options?.currentUser;
currentUser = currentUser ?? options?.currentUser;
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
const uid = currentUser?.userTenantId || currentUser?.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
data.modifiedBy = uid;
return super.updateById(id, data, options);
}
Expand All @@ -108,7 +108,7 @@ export abstract class DefaultUserModifyCrudRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
const uid = currentUser?.userTenantId || currentUser?.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
data.modifiedBy = uid;
return super.replaceById(id, data, options);
}
Expand Down
2 changes: 1 addition & 1 deletion services/authentication-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"dist/__tests__\"",
"test": "echo \"No tests !\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"clean": "lb-clean dist *.tsbuildinfo .eslintcache"
Expand Down
4 changes: 1 addition & 3 deletions services/authentication-service/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ import {Component, ProviderMap} from '@loopback/core';
export class AuthenticationServiceComponent implements Component {
constructor() {}

providers?: ProviderMap = {
};

providers?: ProviderMap = {};
}
2 changes: 1 addition & 1 deletion services/in-mail-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"dist/__tests__\"",
"test": "echo \"No tests !\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"clean": "lb-clean dist *.tsbuildinfo .eslintcache"
Expand Down
4 changes: 1 addition & 3 deletions services/in-mail-service/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ import {Component, ProviderMap} from '@loopback/core';
export class InMailServiceComponent implements Component {
constructor() {}

providers?: ProviderMap = {
};

providers?: ProviderMap = {};
}
2 changes: 1 addition & 1 deletion services/notification-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"dist/__tests__\"",
"test": "echo \"No tests !\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"clean": "lb-clean dist *.tsbuildinfo .eslintcache"
Expand Down
1 change: 1 addition & 0 deletions services/scheduler-service/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
dist/
coverage/
migrations/
1 change: 1 addition & 0 deletions services/scheduler-service/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
*.json
migrations/
3 changes: 1 addition & 2 deletions services/scheduler-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"dist/__tests__\"",
"test": "echo \"No tests !\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"clean": "lb-clean dist *.tsbuildinfo .eslintcache",
Expand All @@ -49,7 +49,6 @@
"@loopback/repository": "^2.5.1",
"@loopback/rest": "^5.0.1",
"@sourceloop/core": "^0.0.0",
"@sourcefuse-service-catalog/core": "^0.0.0",
"db-migrate": "^0.11.11",
"db-migrate-pg": "^1.2.2",
"loopback4-authentication": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion services/scheduler-service/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
BearerVerifierType,
CoreComponent,
ServiceSequence,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {AuthenticationComponent} from 'loopback4-authentication';
import {
AuthorizationBindings,
Expand Down
10 changes: 5 additions & 5 deletions services/scheduler-service/src/keys.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BindingKey } from '@loopback/core';
import { ISchedulerConfig } from './types';
import {BindingKey} from '@loopback/core';
import {ISchedulerConfig} from './types';

export namespace SchedulerBindings {
export const Config = BindingKey.create<ISchedulerConfig | null>(
'sf.scheduler.config',
);
export const Config = BindingKey.create<ISchedulerConfig | null>(
'sf.scheduler.config',
);
}
8 changes: 6 additions & 2 deletions services/scheduler-service/src/models/attachment.model.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import {belongsTo, model, property} from '@loopback/repository';
import {UserModifiableEntity, ExternalIdentifierEnabledEntity} from '@sourcefuse-service-catalog/core';
import {
UserModifiableEntity,
ExternalIdentifierEnabledEntity,
} from '@sourceloop/core';
import {Event, EventWithRelations} from './event.model';

@model({
name: 'attachments',
})
export class Attachment extends UserModifiableEntity implements ExternalIdentifierEnabledEntity{
export class Attachment extends UserModifiableEntity
implements ExternalIdentifierEnabledEntity {
@property({
type: 'string',
id: true,
Expand Down
2 changes: 1 addition & 1 deletion services/scheduler-service/src/models/attendee.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {belongsTo, model, property} from '@loopback/repository';
import {
ExternalIdentifierEnabledEntity,
UserModifiableEntity,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {ResponseStatusType} from './enums/response-status.enum';
import {Event, EventWithRelations} from './event.model';

Expand Down
5 changes: 3 additions & 2 deletions services/scheduler-service/src/models/audit-log.model.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ExternalIdentifierEnabledEntity } from '@sourcefuse-service-catalog/core';
import {ExternalIdentifierEnabledEntity} from '@sourceloop/core';

import {Entity, model, property} from '@loopback/repository';

@model({
name: 'audit_logs',
})
export class AuditLog extends Entity implements ExternalIdentifierEnabledEntity{
export class AuditLog extends Entity
implements ExternalIdentifierEnabledEntity {
@property({
type: 'string',
id: true,
Expand Down
2 changes: 1 addition & 1 deletion services/scheduler-service/src/models/calendar.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {hasMany, model, property} from '@loopback/repository';
import {
ExternalIdentifierEnabledEntity,
UserModifiableEntity,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {Event} from './event.model';
import {Subscription} from './subscription.model';
import {WorkingHour} from './working-hour.model';
Expand Down
2 changes: 1 addition & 1 deletion services/scheduler-service/src/models/event.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {belongsTo, hasMany, model, property} from '@loopback/repository';
import {
ExternalIdentifierEnabledEntity,
UserModifiableEntity,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {Attachment, Attendee} from '.';
import {Calendar, CalendarWithRelations} from './calendar.model';
import {StatusType} from './enums/status.enum';
Expand Down
8 changes: 6 additions & 2 deletions services/scheduler-service/src/models/settings.model.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import {model, property} from '@loopback/repository';
import {OwnerType} from './enums/owner-type.enum';
import { UserModifiableEntity, ExternalIdentifierEnabledEntity } from '@sourcefuse-service-catalog/core';
import {
UserModifiableEntity,
ExternalIdentifierEnabledEntity,
} from '@sourceloop/core';

@model({
name: 'settings',
})
export class Settings extends UserModifiableEntity implements ExternalIdentifierEnabledEntity{
export class Settings extends UserModifiableEntity
implements ExternalIdentifierEnabledEntity {
@property({
type: 'string',
id: true,
Expand Down
8 changes: 6 additions & 2 deletions services/scheduler-service/src/models/subscription.model.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import {belongsTo, model, property} from '@loopback/repository';
import { UserModifiableEntity, ExternalIdentifierEnabledEntity } from '@sourcefuse-service-catalog/core';
import {
UserModifiableEntity,
ExternalIdentifierEnabledEntity,
} from '@sourceloop/core';
import {Calendar, CalendarWithRelations} from './calendar.model';
import {AccessRoleType} from './enums/access-role.enum';

@model({
name: 'subscriptions',
})
export class Subscription extends UserModifiableEntity implements ExternalIdentifierEnabledEntity{
export class Subscription extends UserModifiableEntity
implements ExternalIdentifierEnabledEntity {
@property({
type: 'string',
id: true,
Expand Down
8 changes: 6 additions & 2 deletions services/scheduler-service/src/models/theme.model.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import {model, property} from '@loopback/repository';
import { UserModifiableEntity, ExternalIdentifierEnabledEntity } from '@sourcefuse-service-catalog/core';
import {
UserModifiableEntity,
ExternalIdentifierEnabledEntity,
} from '@sourceloop/core';

@model({
name: 'themes',
})
export class Theme extends UserModifiableEntity implements ExternalIdentifierEnabledEntity{
export class Theme extends UserModifiableEntity
implements ExternalIdentifierEnabledEntity {
@property({
type: 'string',
id: true,
Expand Down
8 changes: 6 additions & 2 deletions services/scheduler-service/src/models/working-hour.model.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import {belongsTo, model, property} from '@loopback/repository';
import { UserModifiableEntity, ExternalIdentifierEnabledEntity } from '@sourcefuse-service-catalog/core';
import {
UserModifiableEntity,
ExternalIdentifierEnabledEntity,
} from '@sourceloop/core';
import {Calendar, CalendarWithRelations} from './calendar.model';
import {DayOfWeekType} from './enums/day-of-week.enum';

@model({
name: 'working_hours',
})
export class WorkingHour extends UserModifiableEntity implements ExternalIdentifierEnabledEntity{
export class WorkingHour extends UserModifiableEntity
implements ExternalIdentifierEnabledEntity {
@property({
type: 'string',
id: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import {Provider} from '@loopback/context';
import {HttpErrors} from '@loopback/rest';
import { CustomPermissionFn } from '../types';

import {CustomPermissionFn} from '../types';

/**
* A provider for custom permissions
*
* It will just throw an error saying Not Implemented
*/
export class CustomPermissionsProvider
implements Provider<CustomPermissionFn> {
export class CustomPermissionsProvider implements Provider<CustomPermissionFn> {
constructor() {}

value(): CustomPermissionFn {
return async (user) => {
return async user => {
throw new HttpErrors.NotImplemented(
`CustomPermissionFn is not implemented`,
);
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {BelongsToAccessor, juggler, repository} from '@loopback/repository';
import {
DefaultUserModifyCrudRepository,
IAuthUserWithPermissions,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {AuthenticationBindings} from 'loopback4-authentication';
import {Attachment, AttachmentRelations, Event} from '../models';
import {EventRepository} from './event.repository';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {BelongsToAccessor, juggler, repository} from '@loopback/repository';
import {
DefaultUserModifyCrudRepository,
IAuthUserWithPermissions,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {AuthenticationBindings} from 'loopback4-authentication';
import {Attendee, AttendeeRelations, Event} from '../models';
import {EventRepository} from './event.repository';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import {
DefaultUserModifyCrudRepository,
IAuthUserWithPermissions,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {AuthenticationBindings} from 'loopback4-authentication';
import {
Calendar,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import {
DefaultUserModifyCrudRepository,
IAuthUserWithPermissions,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {AuthenticationBindings} from 'loopback4-authentication';
import {Attachment, Attendee, Calendar, Event, EventRelations} from '../models';
import {AttachmentRepository} from './attachment.repository';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {juggler} from '@loopback/repository';
import {
DefaultUserModifyCrudRepository,
IAuthUserWithPermissions,
} from '@sourcefuse-service-catalog/core';
} from '@sourceloop/core';
import {AuthenticationBindings} from 'loopback4-authentication';
import {Settings} from '../models';

Expand Down
Loading

0 comments on commit d4bf68a

Please sign in to comment.