@hotstaq/admin-panel 0.3.7 → 0.3.10

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.
Files changed (43) hide show
  1. package/.env +2 -0
  2. package/HotSite.json +0 -1
  3. package/assets/html/admin-header.hott +7 -3
  4. package/assets/js/dashboard.js +0 -46
  5. package/build/AppAPI.d.ts +21 -2
  6. package/build/AppAPI.d.ts.map +1 -1
  7. package/build/AppAPI.js +38 -43
  8. package/build/AppAPI.js.map +1 -1
  9. package/build/WebExport.d.ts.map +1 -1
  10. package/build/WebExport.js +8 -4
  11. package/build/WebExport.js.map +1 -1
  12. package/build/components/admin-button.js.map +1 -1
  13. package/build/components/admin-dropdown.js.map +1 -1
  14. package/build/components/admin-edit.js +4 -4
  15. package/build/components/admin-edit.js.map +1 -1
  16. package/build/components/admin-table-field.js +1 -1
  17. package/build/components/admin-table-field.js.map +1 -1
  18. package/build/components/admin-table-row.js.map +1 -1
  19. package/build/components/admin-table.d.ts +48 -2
  20. package/build/components/admin-table.d.ts.map +1 -1
  21. package/build/components/admin-table.js +139 -24
  22. package/build/components/admin-table.js.map +1 -1
  23. package/build/components/admin-text.d.ts.map +1 -1
  24. package/build/components/admin-text.js +2 -1
  25. package/build/components/admin-text.js.map +1 -1
  26. package/build/tsconfig.tsbuildinfo +1 -0
  27. package/build-web/AdminPanelComponents.js +2 -2
  28. package/build-web/AdminPanelComponents.js.LICENSE.txt +14 -0
  29. package/build-web/AdminPanelWeb_AppAPI.js +804 -39
  30. package/docker-compose.yaml +0 -1
  31. package/env-example +4 -2
  32. package/package.json +13 -6
  33. package/src/AppAPI.ts +54 -57
  34. package/src/WebExport.ts +8 -3
  35. package/src/components/admin-table-field.ts +1 -1
  36. package/src/components/admin-table.ts +215 -19
  37. package/src/components/admin-text.ts +2 -1
  38. package/start.sh +1 -1
  39. package/stop.sh +1 -1
  40. package/webpack-api.config.js +8 -2
  41. package/webpack.config.cjs +7 -1
  42. package/dbstart.sh +0 -14
  43. package/dbstop.sh +0 -3
@@ -43,9 +43,9 @@ function HotStaqPostJSONObject (methodType, url, jsonObj, auth)
43
43
  }
44
44
 
45
45
  /**
46
- * The data API route.
46
+ * The users API route.
47
47
  */
48
- class data
48
+ class users
49
49
  {
50
50
  constructor (baseUrl, connection, db)
51
51
  {
@@ -114,23 +114,23 @@ class data
114
114
  /**
115
115
  * The JSON object to send to the server.
116
116
  *
117
- * @typedef {Object} DATA_ADD_JSON_OBJECT_TYPE
118
- * @property {string} schema The schema to add data to.
119
- * @property {string} fields The fields and their values to add to the database. A key/value object must be passed. Example: { "name": "Test_User" }
117
+ * @typedef {Object} USERS_REGISTER_JSON_OBJECT_TYPE
118
+ * @property {string} email The user's email.
119
+ * @property {string} password The user's password.
120
120
  */
121
121
 
122
122
  /**
123
- * The add method.
123
+ * The register method.
124
124
  *
125
- * @param {DATA_ADD_JSON_OBJECT_TYPE} jsonObj
125
+ * @param {USERS_REGISTER_JSON_OBJECT_TYPE} jsonObj
126
126
  *
127
- * @returns {string} Returns true if successful.
127
+ * @returns {string} Returns true when the user has been registered successfully.
128
128
  */
129
- add (jsonObj)
129
+ register (jsonObj)
130
130
  {
131
131
  var promise = new Promise ((resolve, reject) =>
132
132
  {
133
- const url = `${this.baseUrl}/v1/data/add`;
133
+ const url = `${this.baseUrl}/v1/users/register`;
134
134
  const auth = null;
135
135
 
136
136
  if (this.authorization != null)
@@ -156,24 +156,23 @@ class data
156
156
  /**
157
157
  * The JSON object to send to the server.
158
158
  *
159
- * @typedef {Object} DATA_EDIT_JSON_OBJECT_TYPE
160
- * @property {string} schema The schema to edit data in.
161
- * @property {string} whereFields The where fields and their values to select from the database. A key/value object must be passed. Example: { "name": "Test_User" }
162
- * @property {string} fields The fields and their values to update in the database. A key/value object must be passed. Example: { "name": "Test_User" }
159
+ * @typedef {Object} USERS_VERIFYUSER_JSON_OBJECT_TYPE
160
+ * @property {string} email The user's email.
161
+ * @property {string} verificationCode The user's verification code.
163
162
  */
164
163
 
165
164
  /**
166
- * The edit method.
165
+ * The verifyUser method.
167
166
  *
168
- * @param {DATA_EDIT_JSON_OBJECT_TYPE} jsonObj
167
+ * @param {USERS_VERIFYUSER_JSON_OBJECT_TYPE} jsonObj
169
168
  *
170
- * @returns {string} Returns true if successful.
169
+ * @returns {string} Returns true when the user has been verified successfully.
171
170
  */
172
- edit (jsonObj)
171
+ verifyUser (jsonObj)
173
172
  {
174
173
  var promise = new Promise ((resolve, reject) =>
175
174
  {
176
- const url = `${this.baseUrl}/v1/data/edit`;
175
+ const url = `${this.baseUrl}/v1/users/verifyUser`;
177
176
  const auth = null;
178
177
 
179
178
  if (this.authorization != null)
@@ -199,23 +198,792 @@ class data
199
198
  /**
200
199
  * The JSON object to send to the server.
201
200
  *
202
- * @typedef {Object} DATA_REMOVE_JSON_OBJECT_TYPE
203
- * @property {string} schema The schema to remove data from.
204
- * @property {string} whereFields The where fields and their values to select from the database. A key/value object must be passed. Example: { "name": "Test_User" }
201
+ * @typedef {Object} USERS_LOGIN_JSON_OBJECT_TYPE
202
+ * @property {string} email The user's email.
203
+ * @property {string} password The user's password.
205
204
  */
206
205
 
207
206
  /**
208
- * The remove method.
207
+ * The JSON object returned from the server.
209
208
  *
210
- * @param {DATA_REMOVE_JSON_OBJECT_TYPE} jsonObj
209
+ * @typedef {Object} USERS_LOGIN_JSON_RETURN_TYPE
210
+ * @property {boolean} enabled Is the user enabled?
211
+ * @property {string} id The id.
212
+ * @property {string} userType The user type.
213
+ * @property {string} displayName The user's display name.
214
+ * @property {string} firstName The user's first name.
215
+ * @property {string} lastName The user's last name.
216
+ * @property {string} email The email.
217
+ * @property {string} password The password.
218
+ * @property {string} passwordSalt The password salt.
219
+ * @property {string} verifyCode The verification code.
220
+ * @property {string} registeredDate The registered date.
221
+ * @property {string} loginDate The login date.
222
+ * @property {boolean} verified Indicates if the account has been verified.
223
+ * @property {string} ip The player's ip.
224
+ * @property {string} jwtToken The player's JWT token.
225
+ */
226
+
227
+ /**
228
+ * The login method.
229
+ *
230
+ * @param {USERS_LOGIN_JSON_OBJECT_TYPE} jsonObj
231
+ *
232
+ * @returns {USERS_LOGIN_JSON_RETURN_TYPE} The user object.
233
+ */
234
+ login (jsonObj)
235
+ {
236
+ var promise = new Promise ((resolve, reject) =>
237
+ {
238
+ const url = `${this.baseUrl}/v1/users/login`;
239
+ const auth = null;
240
+
241
+ if (this.authorization != null)
242
+ {
243
+ if (this.authorization.toAuthorizationHeaderString != null)
244
+ auth = this.authorization.toAuthorizationHeaderString ();
245
+ }
246
+
247
+
248
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
249
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
250
+ function (response)
251
+ {
252
+ var result = response.json ();
253
+
254
+ resolve (result);
255
+ });
256
+ });
257
+
258
+ return (promise);
259
+ }
260
+
261
+ /**
262
+ * The JSON object to send to the server.
263
+ *
264
+ * @typedef {Object} USERS_LOGOUT_JSON_OBJECT_TYPE
265
+ * @property {string} jwtToken The user's JWT token to verify.
266
+ */
267
+
268
+ /**
269
+ * The logOut method.
270
+ *
271
+ * @param {USERS_LOGOUT_JSON_OBJECT_TYPE} jsonObj
272
+ *
273
+ * @returns {string} Returns true when the user has been logged out successfully.
274
+ */
275
+ logOut (jsonObj)
276
+ {
277
+ var promise = new Promise ((resolve, reject) =>
278
+ {
279
+ const url = `${this.baseUrl}/v1/users/logOut`;
280
+ const auth = null;
281
+
282
+ if (this.authorization != null)
283
+ {
284
+ if (this.authorization.toAuthorizationHeaderString != null)
285
+ auth = this.authorization.toAuthorizationHeaderString ();
286
+ }
287
+
288
+
289
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
290
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
291
+ function (response)
292
+ {
293
+ var result = response.json ();
294
+
295
+ resolve (result);
296
+ });
297
+ });
298
+
299
+ return (promise);
300
+ }
301
+
302
+ /**
303
+ * The JSON object to send to the server.
304
+ *
305
+ * @typedef {Object} USERS_FORGOTPASSWORD_JSON_OBJECT_TYPE
306
+ * @property {string} email The user's email to use to reset the password.
307
+ */
308
+
309
+ /**
310
+ * The forgotPassword method.
311
+ *
312
+ * @param {USERS_FORGOTPASSWORD_JSON_OBJECT_TYPE} jsonObj
313
+ *
314
+ * @returns {string} Returns true when the verification code has been sent.
315
+ */
316
+ forgotPassword (jsonObj)
317
+ {
318
+ var promise = new Promise ((resolve, reject) =>
319
+ {
320
+ const url = `${this.baseUrl}/v1/users/forgotPassword`;
321
+ const auth = null;
322
+
323
+ if (this.authorization != null)
324
+ {
325
+ if (this.authorization.toAuthorizationHeaderString != null)
326
+ auth = this.authorization.toAuthorizationHeaderString ();
327
+ }
328
+
329
+
330
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
331
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
332
+ function (response)
333
+ {
334
+ var result = response.json ();
335
+
336
+ resolve (result);
337
+ });
338
+ });
339
+
340
+ return (promise);
341
+ }
342
+
343
+ /**
344
+ * The JSON object to send to the server.
345
+ *
346
+ * @typedef {Object} USERS_VERIFYFORGOTPASSWORDCODE_JSON_OBJECT_TYPE
347
+ * @property {string} email The user's email to reset.
348
+ * @property {string} verificationCode The user's verification code to authorize the password reset.
349
+ * @property {string} newPassword The new password to set.
350
+ */
351
+
352
+ /**
353
+ * The verifyForgotPasswordCode method.
354
+ *
355
+ * @param {USERS_VERIFYFORGOTPASSWORDCODE_JSON_OBJECT_TYPE} jsonObj
356
+ *
357
+ * @returns {string} Returns true when the user has been logged out successfully.
358
+ */
359
+ verifyForgotPasswordCode (jsonObj)
360
+ {
361
+ var promise = new Promise ((resolve, reject) =>
362
+ {
363
+ const url = `${this.baseUrl}/v1/users/verifyForgotPasswordCode`;
364
+ const auth = null;
365
+
366
+ if (this.authorization != null)
367
+ {
368
+ if (this.authorization.toAuthorizationHeaderString != null)
369
+ auth = this.authorization.toAuthorizationHeaderString ();
370
+ }
371
+
372
+
373
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
374
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
375
+ function (response)
376
+ {
377
+ var result = response.json ();
378
+
379
+ resolve (result);
380
+ });
381
+ });
382
+
383
+ return (promise);
384
+ }
385
+ }
386
+
387
+
388
+ /**
389
+ * The admins API route.
390
+ */
391
+ class admins
392
+ {
393
+ constructor (baseUrl, connection, db)
394
+ {
395
+
396
+
397
+ if (baseUrl == null)
398
+ baseUrl = "http://127.0.0.1:3243";
399
+
400
+ if (connection === undefined)
401
+ connection = null;
402
+
403
+ if (db === undefined)
404
+ db = null;
405
+
406
+ /**
407
+ * The base url to make calls to.
408
+ */
409
+ this.baseUrl = baseUrl;
410
+ /**
411
+ * The connection to the server/client.
412
+ */
413
+ this.connection = connection;
414
+ /**
415
+ * The bearer token used to connect to the server.
416
+ */
417
+ this.bearerToken = null;
418
+ /**
419
+ * The database connection, if any.
420
+ */
421
+ this.db = db;
422
+ }
423
+
424
+ /**
425
+ * Make a call to the API. THIS CANNOT upload files yet.
426
+ */
427
+ makeCall (route, data, httpMethod = "post", files = {}, bearer = "")
428
+ {
429
+ var promise = new Promise ((resolve, reject) =>
430
+ {
431
+ let url = this.baseUrl;
432
+
433
+ if (url[(url.length - 1)] === "/")
434
+ url = url.substr (0, (url.length - 1));
435
+
436
+ if (route[0] !== "/")
437
+ url += "/";
438
+
439
+ url += route;
440
+
441
+ if (bearer === "")
442
+ {
443
+ if (Hot.BearerToken != null)
444
+ bearer = Hot.BearerToken;
445
+ }
446
+
447
+ HotStaqPostJSONObject (httpMethod, url, data, bearer).then (
448
+ function (response)
449
+ {
450
+ var result = response.json ();
451
+ resolve (result);
452
+ });
453
+ });
454
+ return (promise);
455
+ }
456
+
457
+ /**
458
+ * The JSON object to send to the server.
459
+ *
460
+ * @typedef {Object} ADMINS_REGISTER_JSON_OBJECT_TYPE
461
+ * @property {string} email The user's email.
462
+ * @property {string} password The user's password.
463
+ */
464
+
465
+ /**
466
+ * The register method.
467
+ *
468
+ * @param {ADMINS_REGISTER_JSON_OBJECT_TYPE} jsonObj
469
+ *
470
+ * @returns {string} Returns true when the user has been registered successfully.
471
+ */
472
+ register (jsonObj)
473
+ {
474
+ var promise = new Promise ((resolve, reject) =>
475
+ {
476
+ const url = `${this.baseUrl}/v1/admins/register`;
477
+ const auth = null;
478
+
479
+ if (this.authorization != null)
480
+ {
481
+ if (this.authorization.toAuthorizationHeaderString != null)
482
+ auth = this.authorization.toAuthorizationHeaderString ();
483
+ }
484
+
485
+
486
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
487
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
488
+ function (response)
489
+ {
490
+ var result = response.json ();
491
+
492
+ resolve (result);
493
+ });
494
+ });
495
+
496
+ return (promise);
497
+ }
498
+
499
+ /**
500
+ * The JSON object to send to the server.
501
+ *
502
+ * @typedef {Object} ADMINS_VERIFYUSER_JSON_OBJECT_TYPE
503
+ * @property {string} email The user's email.
504
+ * @property {string} verificationCode The user's verification code.
505
+ */
506
+
507
+ /**
508
+ * The verifyUser method.
509
+ *
510
+ * @param {ADMINS_VERIFYUSER_JSON_OBJECT_TYPE} jsonObj
511
+ *
512
+ * @returns {string} Returns true when the user has been verified successfully.
513
+ */
514
+ verifyUser (jsonObj)
515
+ {
516
+ var promise = new Promise ((resolve, reject) =>
517
+ {
518
+ const url = `${this.baseUrl}/v1/admins/verifyUser`;
519
+ const auth = null;
520
+
521
+ if (this.authorization != null)
522
+ {
523
+ if (this.authorization.toAuthorizationHeaderString != null)
524
+ auth = this.authorization.toAuthorizationHeaderString ();
525
+ }
526
+
527
+
528
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
529
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
530
+ function (response)
531
+ {
532
+ var result = response.json ();
533
+
534
+ resolve (result);
535
+ });
536
+ });
537
+
538
+ return (promise);
539
+ }
540
+
541
+ /**
542
+ * The JSON object to send to the server.
543
+ *
544
+ * @typedef {Object} ADMINS_LOGIN_JSON_OBJECT_TYPE
545
+ * @property {string} email The user's email.
546
+ * @property {string} password The user's password.
547
+ */
548
+
549
+ /**
550
+ * The JSON object returned from the server.
551
+ *
552
+ * @typedef {Object} ADMINS_LOGIN_JSON_RETURN_TYPE
553
+ * @property {boolean} enabled Is the user enabled?
554
+ * @property {string} id The id.
555
+ * @property {string} userType The user type.
556
+ * @property {string} displayName The user's display name.
557
+ * @property {string} firstName The user's first name.
558
+ * @property {string} lastName The user's last name.
559
+ * @property {string} email The email.
560
+ * @property {string} password The password.
561
+ * @property {string} passwordSalt The password salt.
562
+ * @property {string} verifyCode The verification code.
563
+ * @property {string} registeredDate The registered date.
564
+ * @property {string} loginDate The login date.
565
+ * @property {boolean} verified Indicates if the account has been verified.
566
+ * @property {string} ip The player's ip.
567
+ * @property {string} jwtToken The player's JWT token.
568
+ */
569
+
570
+ /**
571
+ * The login method.
572
+ *
573
+ * @param {ADMINS_LOGIN_JSON_OBJECT_TYPE} jsonObj
574
+ *
575
+ * @returns {ADMINS_LOGIN_JSON_RETURN_TYPE} The user object.
576
+ */
577
+ login (jsonObj)
578
+ {
579
+ var promise = new Promise ((resolve, reject) =>
580
+ {
581
+ const url = `${this.baseUrl}/v1/admins/login`;
582
+ const auth = null;
583
+
584
+ if (this.authorization != null)
585
+ {
586
+ if (this.authorization.toAuthorizationHeaderString != null)
587
+ auth = this.authorization.toAuthorizationHeaderString ();
588
+ }
589
+
590
+
591
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
592
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
593
+ function (response)
594
+ {
595
+ var result = response.json ();
596
+
597
+ resolve (result);
598
+ });
599
+ });
600
+
601
+ return (promise);
602
+ }
603
+
604
+ /**
605
+ * The JSON object to send to the server.
606
+ *
607
+ * @typedef {Object} ADMINS_LOGOUT_JSON_OBJECT_TYPE
608
+ * @property {string} jwtToken The user's JWT token to verify.
609
+ */
610
+
611
+ /**
612
+ * The logOut method.
613
+ *
614
+ * @param {ADMINS_LOGOUT_JSON_OBJECT_TYPE} jsonObj
615
+ *
616
+ * @returns {string} Returns true when the user has been logged out successfully.
617
+ */
618
+ logOut (jsonObj)
619
+ {
620
+ var promise = new Promise ((resolve, reject) =>
621
+ {
622
+ const url = `${this.baseUrl}/v1/admins/logOut`;
623
+ const auth = null;
624
+
625
+ if (this.authorization != null)
626
+ {
627
+ if (this.authorization.toAuthorizationHeaderString != null)
628
+ auth = this.authorization.toAuthorizationHeaderString ();
629
+ }
630
+
631
+
632
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
633
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
634
+ function (response)
635
+ {
636
+ var result = response.json ();
637
+
638
+ resolve (result);
639
+ });
640
+ });
641
+
642
+ return (promise);
643
+ }
644
+
645
+ /**
646
+ * The JSON object to send to the server.
647
+ *
648
+ * @typedef {Object} ADMINS_FORGOTPASSWORD_JSON_OBJECT_TYPE
649
+ * @property {string} email The user's email to use to reset the password.
650
+ */
651
+
652
+ /**
653
+ * The forgotPassword method.
654
+ *
655
+ * @param {ADMINS_FORGOTPASSWORD_JSON_OBJECT_TYPE} jsonObj
656
+ *
657
+ * @returns {string} Returns true when the verification code has been sent.
658
+ */
659
+ forgotPassword (jsonObj)
660
+ {
661
+ var promise = new Promise ((resolve, reject) =>
662
+ {
663
+ const url = `${this.baseUrl}/v1/admins/forgotPassword`;
664
+ const auth = null;
665
+
666
+ if (this.authorization != null)
667
+ {
668
+ if (this.authorization.toAuthorizationHeaderString != null)
669
+ auth = this.authorization.toAuthorizationHeaderString ();
670
+ }
671
+
672
+
673
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
674
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
675
+ function (response)
676
+ {
677
+ var result = response.json ();
678
+
679
+ resolve (result);
680
+ });
681
+ });
682
+
683
+ return (promise);
684
+ }
685
+
686
+ /**
687
+ * The JSON object to send to the server.
688
+ *
689
+ * @typedef {Object} ADMINS_VERIFYFORGOTPASSWORDCODE_JSON_OBJECT_TYPE
690
+ * @property {string} email The user's email to reset.
691
+ * @property {string} verificationCode The user's verification code to authorize the password reset.
692
+ * @property {string} newPassword The new password to set.
693
+ */
694
+
695
+ /**
696
+ * The verifyForgotPasswordCode method.
697
+ *
698
+ * @param {ADMINS_VERIFYFORGOTPASSWORDCODE_JSON_OBJECT_TYPE} jsonObj
699
+ *
700
+ * @returns {string} Returns true when the user has been logged out successfully.
701
+ */
702
+ verifyForgotPasswordCode (jsonObj)
703
+ {
704
+ var promise = new Promise ((resolve, reject) =>
705
+ {
706
+ const url = `${this.baseUrl}/v1/admins/verifyForgotPasswordCode`;
707
+ const auth = null;
708
+
709
+ if (this.authorization != null)
710
+ {
711
+ if (this.authorization.toAuthorizationHeaderString != null)
712
+ auth = this.authorization.toAuthorizationHeaderString ();
713
+ }
714
+
715
+
716
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
717
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
718
+ function (response)
719
+ {
720
+ var result = response.json ();
721
+
722
+ resolve (result);
723
+ });
724
+ });
725
+
726
+ return (promise);
727
+ }
728
+
729
+ /**
730
+ * The JSON object to send to the server.
731
+ *
732
+ * @typedef {Object} ADMINS_EDITUSER_JSON_OBJECT_TYPE
733
+ * @property {boolean} enabled Is the user enabled?
734
+ * @property {string} id The id.
735
+ * @property {string} userType The user type.
736
+ * @property {string} displayName The user's display name.
737
+ * @property {string} firstName The user's first name.
738
+ * @property {string} lastName The user's last name.
739
+ * @property {string} email The email.
740
+ * @property {string} password The password.
741
+ * @property {string} passwordSalt The password salt.
742
+ * @property {string} verifyCode The verification code.
743
+ * @property {string} registeredDate The registered date.
744
+ * @property {string} loginDate The login date.
745
+ * @property {boolean} verified Indicates if the account has been verified.
746
+ * @property {string} ip The player's ip.
747
+ * @property {string} jwtToken The player's JWT token.
748
+ */
749
+
750
+ /**
751
+ * The editUser method.
752
+ *
753
+ * @param {ADMINS_EDITUSER_JSON_OBJECT_TYPE} jsonObj
754
+ *
755
+ * @returns {string} Returns true if the user was edited.
756
+ */
757
+ editUser (jsonObj)
758
+ {
759
+ var promise = new Promise ((resolve, reject) =>
760
+ {
761
+ const url = `${this.baseUrl}/v1/admins/editUser`;
762
+ const auth = null;
763
+
764
+ if (this.authorization != null)
765
+ {
766
+ if (this.authorization.toAuthorizationHeaderString != null)
767
+ auth = this.authorization.toAuthorizationHeaderString ();
768
+ }
769
+
770
+
771
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
772
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
773
+ function (response)
774
+ {
775
+ var result = response.json ();
776
+
777
+ resolve (result);
778
+ });
779
+ });
780
+
781
+ return (promise);
782
+ }
783
+
784
+ /**
785
+ * The JSON object to send to the server.
786
+ *
787
+ * @typedef {Object} ADMINS_DELETEUSER_JSON_OBJECT_TYPE
788
+ * @property {boolean} enabled Is the user enabled?
789
+ * @property {string} id The id.
790
+ * @property {string} userType The user type.
791
+ * @property {string} displayName The user's display name.
792
+ * @property {string} firstName The user's first name.
793
+ * @property {string} lastName The user's last name.
794
+ * @property {string} email The email.
795
+ * @property {string} password The password.
796
+ * @property {string} passwordSalt The password salt.
797
+ * @property {string} verifyCode The verification code.
798
+ * @property {string} registeredDate The registered date.
799
+ * @property {string} loginDate The login date.
800
+ * @property {boolean} verified Indicates if the account has been verified.
801
+ * @property {string} ip The player's ip.
802
+ * @property {string} jwtToken The player's JWT token.
803
+ */
804
+
805
+ /**
806
+ * The deleteUser method.
807
+ *
808
+ * @param {ADMINS_DELETEUSER_JSON_OBJECT_TYPE} jsonObj
809
+ *
810
+ * @returns {string} Returns true if the user was deleted.
811
+ */
812
+ deleteUser (jsonObj)
813
+ {
814
+ var promise = new Promise ((resolve, reject) =>
815
+ {
816
+ const url = `${this.baseUrl}/v1/admins/deleteUser`;
817
+ const auth = null;
818
+
819
+ if (this.authorization != null)
820
+ {
821
+ if (this.authorization.toAuthorizationHeaderString != null)
822
+ auth = this.authorization.toAuthorizationHeaderString ();
823
+ }
824
+
825
+
826
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
827
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
828
+ function (response)
829
+ {
830
+ var result = response.json ();
831
+
832
+ resolve (result);
833
+ });
834
+ });
835
+
836
+ return (promise);
837
+ }
838
+
839
+ /**
840
+ * The JSON object to send to the server.
841
+ *
842
+ * @typedef {Object} ADMINS_CHANGEPASSWORD_JSON_OBJECT_TYPE
843
+ * @property {boolean} enabled Is the user enabled?
844
+ * @property {string} id The id.
845
+ * @property {string} userType The user type.
846
+ * @property {string} displayName The user's display name.
847
+ * @property {string} firstName The user's first name.
848
+ * @property {string} lastName The user's last name.
849
+ * @property {string} email The email.
850
+ * @property {string} password The password.
851
+ * @property {string} passwordSalt The password salt.
852
+ * @property {string} verifyCode The verification code.
853
+ * @property {string} registeredDate The registered date.
854
+ * @property {string} loginDate The login date.
855
+ * @property {boolean} verified Indicates if the account has been verified.
856
+ * @property {string} ip The player's ip.
857
+ * @property {string} jwtToken The player's JWT token.
858
+ * @property {string} newPassword The new password to set.
859
+ */
860
+
861
+ /**
862
+ * The changePassword method.
863
+ *
864
+ * @param {ADMINS_CHANGEPASSWORD_JSON_OBJECT_TYPE} jsonObj
865
+ *
866
+ * @returns {string} Returns true if the user's password was changed.
867
+ */
868
+ changePassword (jsonObj)
869
+ {
870
+ var promise = new Promise ((resolve, reject) =>
871
+ {
872
+ const url = `${this.baseUrl}/v1/admins/changePassword`;
873
+ const auth = null;
874
+
875
+ if (this.authorization != null)
876
+ {
877
+ if (this.authorization.toAuthorizationHeaderString != null)
878
+ auth = this.authorization.toAuthorizationHeaderString ();
879
+ }
880
+
881
+
882
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
883
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
884
+ function (response)
885
+ {
886
+ var result = response.json ();
887
+
888
+ resolve (result);
889
+ });
890
+ });
891
+
892
+ return (promise);
893
+ }
894
+
895
+ /**
896
+ * The JSON object to send to the server.
897
+ *
898
+ * @typedef {Object} ADMINS_GETUSER_JSON_OBJECT_TYPE
899
+ * @property {string} id The id of the user to retrieve.
900
+ */
901
+
902
+ /**
903
+ * The JSON object returned from the server.
904
+ *
905
+ * @typedef {Object} ADMINS_GETUSER_JSON_RETURN_TYPE
906
+ * @property {boolean} enabled Is the user enabled?
907
+ * @property {string} id The id.
908
+ * @property {string} userType The user type.
909
+ * @property {string} displayName The user's display name.
910
+ * @property {string} firstName The user's first name.
911
+ * @property {string} lastName The user's last name.
912
+ * @property {string} email The email.
913
+ * @property {string} password The password.
914
+ * @property {string} passwordSalt The password salt.
915
+ * @property {string} verifyCode The verification code.
916
+ * @property {string} registeredDate The registered date.
917
+ * @property {string} loginDate The login date.
918
+ * @property {boolean} verified Indicates if the account has been verified.
919
+ * @property {string} ip The player's ip.
920
+ * @property {string} jwtToken The player's JWT token.
921
+ */
922
+
923
+ /**
924
+ * The getUser method.
925
+ *
926
+ * @param {ADMINS_GETUSER_JSON_OBJECT_TYPE} jsonObj
927
+ *
928
+ * @returns {ADMINS_GETUSER_JSON_RETURN_TYPE} The user object.
929
+ */
930
+ getUser (jsonObj)
931
+ {
932
+ var promise = new Promise ((resolve, reject) =>
933
+ {
934
+ const url = `${this.baseUrl}/v1/admins/getUser`;
935
+ const auth = null;
936
+
937
+ if (this.authorization != null)
938
+ {
939
+ if (this.authorization.toAuthorizationHeaderString != null)
940
+ auth = this.authorization.toAuthorizationHeaderString ();
941
+ }
942
+
943
+
944
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
945
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
946
+ function (response)
947
+ {
948
+ var result = response.json ();
949
+
950
+ resolve (result);
951
+ });
952
+ });
953
+
954
+ return (promise);
955
+ }
956
+
957
+ /**
958
+ * The JSON object to send to the server.
959
+ *
960
+ * @typedef {Object} ADMINS_LISTUSERS_JSON_OBJECT_TYPE
961
+ * @property {string} search Searches for a user by their first name, last name, or email.
962
+ * @property {integer} offset
963
+ * @property {integer} limit The number of users to return. The maximum is 1000
964
+ * @property {string} orderBy The column to order by.
965
+ */
966
+
967
+ /**
968
+ * The JSON object returned from the server.
969
+ *
970
+ * @typedef {Object} ADMINS_LISTUSERS_JSON_RETURN_TYPE
971
+ * @property {integer} length The number of users returned.
972
+ * @property {array} data The list of users.
973
+ */
974
+
975
+ /**
976
+ * The listUsers method.
977
+ *
978
+ * @param {ADMINS_LISTUSERS_JSON_OBJECT_TYPE} jsonObj
211
979
  *
212
- * @returns {string} Returns true if successful.
980
+ * @returns {ADMINS_LISTUSERS_JSON_RETURN_TYPE} Returns the list of users.
213
981
  */
214
- remove (jsonObj)
982
+ listUsers (jsonObj)
215
983
  {
216
984
  var promise = new Promise ((resolve, reject) =>
217
985
  {
218
- const url = `${this.baseUrl}/v1/data/remove`;
986
+ const url = `${this.baseUrl}/v1/admins/listUsers`;
219
987
  const auth = null;
220
988
 
221
989
  if (this.authorization != null)
@@ -241,26 +1009,22 @@ class data
241
1009
  /**
242
1010
  * The JSON object to send to the server.
243
1011
  *
244
- * @typedef {Object} DATA_LIST_JSON_OBJECT_TYPE
245
- * @property {string} schema The schema to access.
246
- * @property {array} whereFields The where fields and their values to select from the database. A key/value object must be passed. Example: { "name": "Test_User" }
247
- * @property {array} fields The list of fields in the schema to access.
248
- * @property {int} offset The offset.
249
- * @property {int} limit The max number of results to return. Default is 20.
1012
+ * @typedef {Object} ADMINS_IMPERSONATE_JSON_OBJECT_TYPE
1013
+ * @property {string} email The user's email.
250
1014
  */
251
1015
 
252
1016
  /**
253
- * The list method.
1017
+ * The impersonate method.
254
1018
  *
255
- * @param {DATA_LIST_JSON_OBJECT_TYPE} jsonObj
1019
+ * @param {ADMINS_IMPERSONATE_JSON_OBJECT_TYPE} jsonObj
256
1020
  *
257
- * @returns {string} Returns the results from the schema.
1021
+ * @returns {string} The JWT token of the logged in user.
258
1022
  */
259
- list (jsonObj)
1023
+ impersonate (jsonObj)
260
1024
  {
261
1025
  var promise = new Promise ((resolve, reject) =>
262
1026
  {
263
- const url = `${this.baseUrl}/v1/data/list`;
1027
+ const url = `${this.baseUrl}/v1/admins/impersonate`;
264
1028
  const auth = null;
265
1029
 
266
1030
  if (this.authorization != null)
@@ -294,7 +1058,8 @@ if (typeof (AdminPanelWeb.AppAPI) === "undefined")
294
1058
  {
295
1059
  super (baseUrl, connection, db);
296
1060
 
297
- this.data = new data (baseUrl, connection, db);
1061
+ this.users = new users (baseUrl, connection, db);
1062
+ this.admins = new admins (baseUrl, connection, db);
298
1063
  }
299
1064
  }
300
1065
  }