Skip to content

Commit 6eeed16

Browse files
authored
Merge pull request #7 from Moesif/add-companyId-to-userModel
Add: CompanyId to UserModel
2 parents b644a7b + 6c54b30 commit 6eeed16

File tree

5 files changed

+836
-131
lines changed

5 files changed

+836
-131
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ var eventModel = {
9292
request: eventReq,
9393
response: eventRsp,
9494
userId: "my_user_id",
95+
companyId: "my_company_id",
9596
sessionToken: "23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
9697
metadata: {
9798
foo: 'abc',
@@ -177,6 +178,7 @@ var eventModel = {
177178
request: eventReq,
178179
response: eventRsp,
179180
userId: "my_user_id",
181+
companyId: "my_company_id",
180182
sessionToken: "23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f"
181183
};
182184

@@ -208,7 +210,8 @@ config.ApplicationId = "my_application_id";
208210

209211
// 3. Generate a User Model
210212
var user = {
211-
userId: "my_user_id",
213+
userId: "12345",
214+
companyId: "67890",
212215
sessionToken: "23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
213216
metadata: {
214217
@@ -245,6 +248,7 @@ config.ApplicationId = "my_application_id";
245248
// 3. Generate a User Model
246249
var userA = {
247250
userId: "12345",
251+
companyId: "67890",
248252
sessionToken: "23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
249253
metadata: {
250254
@@ -258,7 +262,8 @@ var userA = {
258262
};
259263

260264
var userB = {
261-
userId: "6789",
265+
userId: "1234",
266+
companyId: "6789",
262267
sessionToken: "23jdf0oszfexfqe[lwjfiefovprewv4d8ayrcdx8nu2ng]zfeeadedefx43f",
263268
metadata: {
264269
@@ -297,7 +302,7 @@ config.ApplicationId = "my_application_id";
297302

298303
// 3. Generate a Company Model
299304
var company = {
300-
companyId: "1",
305+
companyId: "12345",
301306
sessionToken: "23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
302307
metadata: {
303308
@@ -331,7 +336,7 @@ config.ApplicationId = "my_application_id";
331336

332337
// 3. Generate a Company Model
333338
var companyA = {
334-
companyId: "1",
339+
companyId: "12345",
335340
sessionToken: "23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
336341
metadata: {
337342
@@ -345,7 +350,7 @@ var companyA = {
345350
};
346351

347352
var companyB = {
348-
companyId: "2",
353+
companyId: "67890",
349354
metadata: {
350355
351356
string_field: "value_1",

lib/Models/UserModel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* ipAddress: Option[String],
77
* sessionToken: Option[String],
88
* userId: String,
9+
* companyId: Option[String],
910
* userAgentString: Option[String],
1011
* metadata: Option[JsObject]
1112
*/
@@ -18,21 +19,25 @@ var BaseModel = require("./BaseModel");
1819
var UserModel = function (obj) {
1920
if(!obj) {
2021
this.userId = null;
22+
this.companyId = null;
2123
this.modifiedTime = null;
2224
this.ipAddress = null;
2325
this.sessionToken = null;
2426
this.userAgentString = null;
2527
this.metadata = null;
2628
// Append to variable dictionary
2729
this._variableDict['userId'] = 'user_id';
30+
this._variableDict['companyId'] = 'company_id';
2831
} else {
2932
this.userId = obj.userId;
33+
this.companyId = obj.companyId;
3034
this.modifiedTime = new Date(obj.modifiedTime);
3135
this.ipAddress = obj.ipAddress;
3236
this.sessionToken = obj.sessionToken;
3337
this.userAgentString = obj.userAgentString;
3438
this.metadata = obj.metadata;
3539
this._variableDict['userId'] = 'user_id';
40+
this._variableDict['companyId'] = 'company_id';
3641
}
3742
};
3843

0 commit comments

Comments
 (0)