MCPcopy
hub / github.com/ever-co/ever-demand / UsersService

Class UsersService

packages/core/src/services/users/UsersService.ts:68–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66@injectable()
67@routerName('user')
68export class UsersService
69 extends DBService<User>
70 implements IUserRouter, IService
71{
72 public readonly DBObject: any = User;
73
74 // TODO: this and other Stripe related things should be inside separate Payments Service
75 private stripe = new Stripe(env.STRIPE_SECRET_KEY, {
76 apiVersion: '2020-08-27',
77 });
78
79 protected readonly log: Logger = createEverLogger({
80 name: 'usersService',
81 });
82
83 public watchedFiles: IWatchedFiles;
84
85 constructor(
86 @inject(new LazyServiceIdentifer(() => InvitesService))
87 protected invitesService: InvitesService,
88 @inject(new LazyServiceIdentifer(() => DevicesService))
89 protected devicesService: DevicesService,
90 @inject(new LazyServiceIdentifer(() => WarehousesService))
91 protected _storesService: WarehousesService
92 ) {
93 super();
94 // TODO: too many hardcoded constants used below. Refactor!
95 this.watchedFiles = _.zipObject(
96 ['aboutUs', 'privacy', 'termsOfUse', 'help'],
97 _.map(['about_us', 'privacy', 'terms_of_use', 'help'], (folder) =>
98 _.zipObject(
99 ['en-US', 'he-IL', 'ru-RU', 'bg-BG', 'fr-FR'],
100 _.map(
101 ['en-US', 'he-IL', 'ru-RU', 'bg-BG', 'fr-FR'],
102 (language) =>
103 observeFile(
104 `${path.resolve(
105 __dirname,
106 '../../../',
107 ...['res', 'templates']
108 )}/${folder}/${language}.hbs`
109 ).pipe(
110 tap({ error: (err) => this.log.error(err) }),
111 publishReplay(1),
112 refCount<string>()
113 )
114 )
115 )
116 )
117 ) as any;
118 }
119
120 /**
121 * Verify if customer with given email already exists
122 *
123 * @param {string} email
124 * @returns {Promise<boolean>}
125 * @memberof UsersService

Callers

nothing calls this directly

Calls 1

createEverLoggerFunction · 0.90

Tested by

no test coverage detected