@loomcore/api 0.1.134 → 0.1.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,9 @@ export class AuthController {
25
25
  async login(req, res, next) {
26
26
  const { email, password } = req.body;
27
27
  res.set('Content-Type', 'application/json');
28
+ console.log('auth controller login', email);
28
29
  const loginResponse = await this.authService.attemptLogin(req, res, email, password);
30
+ console.log('auth controller login response', loginResponse);
29
31
  apiUtils.apiResponse(res, 200, { data: loginResponse }, LoginResponseSpec);
30
32
  }
31
33
  async registerUser(req, res) {
@@ -33,9 +33,12 @@ export class AuthService extends MultiTenantApiService {
33
33
  this.authConfig = config.auth;
34
34
  }
35
35
  async attemptLogin(req, res, email, password) {
36
+ console.log('auth service attemptLogin', email, password);
36
37
  const lowerCaseEmail = email.toLowerCase();
37
38
  const user = await this.getUserByEmail(lowerCaseEmail);
39
+ console.log('auth service attemptLogin user', user);
38
40
  const organization = await this.organizationService.findOne(EmptyUserContext, { filters: { _id: { eq: user?._orgId } } });
41
+ console.log('auth service attemptLogin organization', organization);
39
42
  if (!user) {
40
43
  throw new BadRequestError('Invalid Credentials');
41
44
  }
@@ -44,15 +47,20 @@ export class AuthService extends MultiTenantApiService {
44
47
  throw new BadRequestError('Invalid Credentials');
45
48
  }
46
49
  const person = await this.personService.findOne(EmptyUserContext, { filters: { _id: { eq: user.personId } } });
50
+ console.log('auth service attemptLogin person', person);
47
51
  const authorizations = await getUserContextAuthorizations(this.database, user);
52
+ console.log('auth service attemptLogin authorizations', authorizations);
48
53
  const userContext = {
49
54
  user: user,
50
55
  person: person ?? undefined,
51
56
  organization: organization ?? undefined,
52
57
  authorizations: authorizations
53
58
  };
59
+ console.log('auth service attemptLogin userContext', userContext);
54
60
  const deviceId = this.getAndSetDeviceIdCookie(req, res);
61
+ console.log('auth service attemptLogin deviceId', deviceId);
55
62
  const loginResponse = await this.logUserIn(userContext, deviceId);
63
+ console.log('auth service attemptLogin loginResponse', loginResponse);
56
64
  return loginResponse;
57
65
  }
58
66
  async logUserIn(userContext, deviceId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcore/api",
3
- "version": "0.1.134",
3
+ "version": "0.1.135",
4
4
  "private": false,
5
5
  "description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb or PostgreSQL",
6
6
  "scripts": {