Переглянути джерело

:construction: Began connecting survey to Home of app

juan-filtering-match-pool
tomit4 2 роки тому
джерело
коміт
77a104ae3c

+ 110
- 35
backend/db/data-generator/mock.js Переглянути файл

@@ -430,7 +430,8 @@ module.exports = {
430 430
         {
431 431
             response_key_id: 1,
432 432
             response_key_category: 'visionary_vs_implementer',
433
-            response_key_prompt: 'Do you prefer to work with those who are driven by their Visionary insights, or those who are driven more by their Implementation?',
433
+            response_key_prompt:
434
+                'Do you prefer to work with those who are driven by their Visionary insights, or those who are driven more by their Implementation?',
434 435
             response_key_description: 'first round draft scoring question',
435 436
             aspect: 'visionary_vs_implementer',
436 437
             category: 'aspect',
@@ -440,7 +441,8 @@ module.exports = {
440 441
         {
441 442
             response_key_id: 2,
442 443
             response_key_category: 'creative_vs_methodical',
443
-            response_key_prompt: 'Have you found more success working with employees that are more Creative or those that are more Methodical?',
444
+            response_key_prompt:
445
+                'Have you found more success working with employees that are more Creative or those that are more Methodical?',
444 446
             response_key_description: 'first round draft scoring question',
445 447
             aspect: 'creative_vs_methodical',
446 448
             category: 'aspect',
@@ -450,7 +452,8 @@ module.exports = {
450 452
         {
451 453
             response_key_id: 3,
452 454
             response_key_category: 'dynamic_vs_ordered',
453
-            response_key_prompt: 'Which do you find to be the ideal working environment, one that is more Collaborative or one that is more Independent?',
455
+            response_key_prompt:
456
+                'Which do you find to be the ideal working environment, one that is more Collaborative or one that is more Independent?',
454 457
             response_key_description: 'first round draft scoring question',
455 458
             aspect: 'dynamic_vs_ordered',
456 459
             category: 'aspect',
@@ -460,7 +463,8 @@ module.exports = {
460 463
         {
461 464
             response_key_id: 4,
462 465
             response_key_category: 'precise_vs_resourceful',
463
-            response_key_prompt: 'Is the success of your team more likely if it includes individuals who are more Innovative, or those that are more Conventional when fulfilling their job duties?',
466
+            response_key_prompt:
467
+                'Is the success of your team more likely if it includes individuals who are more Innovative, or those that are more Conventional when fulfilling their job duties?',
464 468
             response_key_description: 'first round draft scoring question',
465 469
             aspect: 'precise_vs_resourceful',
466 470
             category: 'aspect',
@@ -470,7 +474,8 @@ module.exports = {
470 474
         {
471 475
             response_key_id: 5,
472 476
             response_key_category: 'big_Picture_vs_focused',
473
-            response_key_prompt: 'When fulfilling the role of the hiring leader, do you find yourself focusing more on the Big Picture or The Task At Hand?',
477
+            response_key_prompt:
478
+                'When fulfilling the role of the hiring leader, do you find yourself focusing more on the Big Picture or The Task At Hand?',
474 479
             response_key_description: 'first round draft scoring question',
475 480
             aspect: 'big_Picture_vs_focused',
476 481
             category: 'aspect',
@@ -480,7 +485,8 @@ module.exports = {
480 485
         {
481 486
             response_key_id: 6,
482 487
             response_key_category: 'guided_vs_self-managed',
483
-            response_key_prompt: 'Do you prefer to Guide your employees towards achieving the team goals, or do you prefer your employees to be Self-Managed?',
488
+            response_key_prompt:
489
+                'Do you prefer to Guide your employees towards achieving the team goals, or do you prefer your employees to be Self-Managed?',
484 490
             response_key_description: 'first round draft scoring question',
485 491
             aspect: 'guided_vs_self-managed',
486 492
             category: 'aspect',
@@ -490,7 +496,8 @@ module.exports = {
490 496
         {
491 497
             response_key_id: 7,
492 498
             response_key_category: 'profile',
493
-            response_key_prompt: 'First things first, could you provide us with your name? [break] I am called [break] when others address me.',
499
+            response_key_prompt:
500
+                'First things first, could you provide us with your name? [break] I am called [break] when others address me.',
494 501
             response_key_description: 'required for profile creation',
495 502
             aspect: null,
496 503
             category: 'input',
@@ -500,122 +507,150 @@ module.exports = {
500 507
         {
501 508
             response_key_id: 8,
502 509
             response_key_category: 'profile',
503
-            response_key_prompt: 'In order for others to reach out to you on Siimee, we will need you to provide your email address.[break]When reaching out to me, [break] is my preferred email.',
510
+            response_key_prompt:
511
+                'In order for others to reach out to you on Siimee, we will need you to provide your email address.[break]When reaching out to me, [break] is my preferred email.',
504 512
             response_key_description: 'required for profile creation',
505 513
             aspect: null,
506 514
             category: 'input',
507 515
             placeholder: 'joe@mailme.com',
508
-            invalidInputPrompt: 'It looks like that email is not valid, try en email that is formatted like so: joe@joe.com',
516
+            invalidInputPrompt:
517
+                'It looks like that email is not valid, try en email that is formatted like so: joe@joe.com',
509 518
         },
510 519
         {
511 520
             response_key_id: 9,
512 521
             response_key_category: 'profile',
513
-            response_key_prompt: 'So far so good! Next we will need you to establish a super secret password. Your password should be at least 14 characters long and have at least 2 special characters.[break]My [break] is a very secure passcode that only I will have access to!',
522
+            response_key_prompt:
523
+                'So far so good! Next we will need you to establish a super secret password. Your password should be at least 14 characters long and have at least 2 special characters.[break]My [break] is a very secure passcode that only I will have access to!',
514 524
             response_key_description: 'required for profile creation',
515 525
             aspect: null,
516 526
             category: 'input',
517 527
             placeholder: 'supersecr3tp@ssword',
518
-            invalidInputPrompt: 'That password does not fit our requirements, please follow the above instructions to generate a secure password.',
528
+            invalidInputPrompt:
529
+                'That password does not fit our requirements, please follow the above instructions to generate a secure password.',
519 530
         },
520 531
         {
521 532
             response_key_id: 10,
522 533
             response_key_category: 'profile',
523
-            response_key_prompt: 'Looking good! Doing great. The next piece of info needed is your zip code. That way we can be sure to only show you other people in your area.[break]My zip code, [break] is the general area where I wish to see results in.',
534
+            response_key_prompt:
535
+                'Looking good! Doing great. The next piece of info needed is your zip code. That way we can be sure to only show you other people in your area.[break]My zip code, [break] is the general area where I wish to see results in.',
524 536
             response_key_description: 'required for distance calculations',
525 537
             aspect: null,
526 538
             category: 'input',
527 539
             placeholder: '90012',
528
-            invalidInputPrompt: 'Oops! That is not a recognized zipcode, please enter a 5 digit zipcode like: 97869',
540
+            invalidInputPrompt:
541
+                'Oops! That is not a recognized zipcode, please enter a 5 digit zipcode like: 97869',
529 542
         },
530 543
         {
531 544
             response_key_id: 11,
532 545
             response_key_category: 'profile',
533
-            response_key_prompt: 'What are you seeking? Are you looking to find a position to be employed in, or are you looking to employ a candidate?[break] I am a [break] seeking an employer/employee.',
546
+            response_key_prompt:
547
+                'What are you seeking? Are you looking to find a position to be employed in, or are you looking to employ a candidate?[break] I am a [break] seeking an employer/employee.',
534 548
             response_key_description: 'required for profile generation',
535 549
             aspect: null,
536 550
             category: 'choice',
537 551
             placeholder: null,
538
-            invalidInputPrompt: 'In order to provide you with the best results, Siimee will need to know whether you are an employer looking to fill a position, or a candidate looking for an employment. Please take a look at our above options and choose one.',
552
+            invalidInputPrompt:
553
+                'In order to provide you with the best results, Siimee will need to know whether you are an employer looking to fill a position, or a candidate looking for an employment. Please take a look at our above options and choose one.',
539 554
         },
540 555
         {
541 556
             response_key_id: 12,
542 557
             response_key_category: 'profile',
543
-            response_key_prompt: 'Hey, you are almost done! Please provide an image of yourself so others can recognize you if you ever meet up IRL:',
558
+            response_key_prompt:
559
+                'Hey, you are almost done! Please provide an image of yourself so others can recognize you if you ever meet up IRL:',
544 560
             response_key_description: 'required for profile pictures',
545 561
             aspect: null,
546 562
             category: 'input',
547 563
             placeholder: null,
548
-            invalidInputPrompt: 'It appears you have yet to upload an image. Please provide Siimee with an image in case you want to show others what you look like.',
564
+            invalidInputPrompt:
565
+                'It appears you have yet to upload an image. Please provide Siimee with an image in case you want to show others what you look like.',
549 566
         },
550 567
         {
551 568
             response_key_id: 13,
552 569
             response_key_category: 'profile',
553
-            response_key_prompt: 'What language is your native language?[break] I consider [break] language as my native language.',
554
-            response_key_description: 'programming and spoken language preference',
570
+            response_key_prompt:
571
+                'What language is your native language?[break] I consider [break] language as my native language.',
572
+            response_key_description:
573
+                'programming and spoken language preference',
555 574
             aspect: null,
556 575
             category: 'choice',
557 576
             placeholder: null,
558
-            invalidInputPrompt: 'We try our best to provide results in the language of your choosing. ¿Prefieres ver resultados en español? Ou peut-être parlez-vous français? Or would you prefer to see results in english?',
577
+            invalidInputPrompt:
578
+                'We try our best to provide results in the language of your choosing. ¿Prefieres ver resultados en español? Ou peut-être parlez-vous français? Or would you prefer to see results in english?',
559 579
         },
560 580
         {
561 581
             response_key_id: 14,
562 582
             response_key_category: 'profile',
563
-            response_key_prompt: 'What kind of duration would you prefer? Are you looking for part-time, full-time, other?[break] Currently, I am looking for a [break] job at this time.',
564
-            response_key_description: 'duration preference for hours able to dedicate to work',
583
+            response_key_prompt:
584
+                'What kind of duration would you prefer? Are you looking for part-time, full-time, other?[break] Currently, I am looking for a [break] job at this time.',
585
+            response_key_description:
586
+                'duration preference for hours able to dedicate to work',
565 587
             aspect: null,
566 588
             category: 'choice',
567 589
             placeholder: null,
568
-            invalidInputPrompt: 'Looks like you have yet to  fill out what kind of work you are most interested in. As in, part-time, full-time. Take a look at our above options and choose whatever feels right for you right now. You can always edit them later!',
590
+            invalidInputPrompt:
591
+                'Looks like you have yet to  fill out what kind of work you are most interested in. As in, part-time, full-time. Take a look at our above options and choose whatever feels right for you right now. You can always edit them later!',
569 592
         },
570 593
         {
571 594
             response_key_id: 15,
572 595
             response_key_category: 'profile',
573
-            response_key_prompt: 'Would you prefer remote, hybrid, in-person work?[break] Personally I would prefer a [break] job right now. It is just what works best for me.',
574
-            response_key_description: 'location preference for where work happens',
596
+            response_key_prompt:
597
+                'Would you prefer remote, hybrid, in-person work?[break] Personally I would prefer a [break] job right now. It is just what works best for me.',
598
+            response_key_description:
599
+                'location preference for where work happens',
575 600
             aspect: null,
576 601
             category: 'choice',
577 602
             placeholder: null,
578
-            invalidInputPrompt: 'Hold up! So sorry to put a pause here, but it looks like you have not chosen whether to work remotely or in person. No worries, if you are unsure, just choose the flexible option.',
603
+            invalidInputPrompt:
604
+                'Hold up! So sorry to put a pause here, but it looks like you have not chosen whether to work remotely or in person. No worries, if you are unsure, just choose the flexible option.',
579 605
         },
580 606
         {
581 607
             response_key_id: 16,
582 608
             response_key_category: 'profile',
583
-            response_key_prompt: 'Please provide us with a short blurb about yourself. What is your backstory?[break] My origin story starts like this:[break]',
609
+            response_key_prompt:
610
+                'Please provide us with a short blurb about yourself. What is your backstory?[break] My origin story starts like this:[break]',
584 611
             response_key_description: 'required for profile description',
585 612
             aspect: null,
586 613
             category: 'input',
587 614
             placeholder: 'my backstory starts long long ago...',
588
-            invalidInputPrompt: 'Whoa! Cool story. Unfortunately your backstory is either too long or too short. Please tell us a bit about yourself between 1 and 100 characters.',
615
+            invalidInputPrompt:
616
+                'Whoa! Cool story. Unfortunately your backstory is either too long or too short. Please tell us a bit about yourself between 1 and 100 characters.',
589 617
         },
590 618
         {
591 619
             response_key_id: 17,
592 620
             response_key_category: 'profile',
593
-            response_key_prompt: 'How soon do you need the position filled or you need to be employed? [break]I am currently [break] when it comes to employment opportunities right now.',
621
+            response_key_prompt:
622
+                'How soon do you need the position filled or you need to be employed? [break]I am currently [break] when it comes to employment opportunities right now.',
594 623
             response_key_description: 'urgency for when work is required',
595 624
             aspect: null,
596 625
             category: 'choice',
597 626
             placeholder: null,
598
-            invalidInputPrompt: 'Looks like you left this field blank. Take a look at our provided options and tell us when you would like be employed.',
627
+            invalidInputPrompt:
628
+                'Looks like you left this field blank. Take a look at our provided options and tell us when you would like be employed.',
599 629
         },
600 630
         {
601 631
             response_key_id: 18,
602 632
             response_key_category: 'profile',
603
-            response_key_prompt: 'When others refer to you, what pronouns do you prefer they use?[break]I prefer to be called [break] when others refer to me.',
633
+            response_key_prompt:
634
+                'When others refer to you, what pronouns do you prefer they use?[break]I prefer to be called [break] when others refer to me.',
604 635
             response_key_description: 'required for profile pronouns',
605 636
             aspect: null,
606 637
             category: 'choice',
607 638
             placeholder: null,
608
-            invalidInputPrompt: 'Ensuring that others on our platform are aware of what your preferred pronouns are is important to us. Please choose from one of the above options.',
639
+            invalidInputPrompt:
640
+                'Ensuring that others on our platform are aware of what your preferred pronouns are is important to us. Please choose from one of the above options.',
609 641
         },
610 642
         {
611 643
             response_key_id: 19,
612 644
             response_key_category: 'profile',
613
-            response_key_prompt: 'What distance from your home are you looking to work in?[break] Preferably, I would like to work [break] from my place of residence.',
614
-            response_key_description: 'preference for commuting distance cutoff',
645
+            response_key_prompt:
646
+                'What distance from your home are you looking to work in?[break] Preferably, I would like to work [break] from my place of residence.',
647
+            response_key_description:
648
+                'preference for commuting distance cutoff',
615 649
             aspect: null,
616 650
             category: 'input',
617 651
             placeholder: '5 mi',
618
-            invalidInputPrompt: 'Whoa! You either left this field blank or tried to input an astronomically large distance you would like to see results from. Please input a distance you would like to see results in.',
652
+            invalidInputPrompt:
653
+                'Whoa! You either left this field blank or tried to input an astronomically large distance you would like to see results from. Please input a distance you would like to see results in.',
619 654
         },
620 655
     ],
621 656
     responses: [],
@@ -697,5 +732,45 @@ module.exports = {
697 732
             target_id: 46,
698 733
             is_deleted: false,
699 734
         },
735
+        // NOTE: profile_id 139 is chosen based off of GENERATED data,
736
+        // after running 'npm run generate', replace 139 in mock to next profile_id to be genearted
737
+        // i.e. last profile_id number + 1
738
+        // TODO: remove from mock data once bare bones matching logic can show poorly matched matches...
739
+        {
740
+            match_queue_id: 17,
741
+            profile_id: 139,
742
+            target_id: 46,
743
+            is_deleted: false,
744
+        },
745
+        {
746
+            match_queue_id: 18,
747
+            profile_id: 139,
748
+            target_id: 46,
749
+            is_deleted: false,
750
+        },
751
+        {
752
+            match_queue_id: 19,
753
+            profile_id: 139,
754
+            target_id: 44,
755
+            is_deleted: false,
756
+        },
757
+        {
758
+            match_queue_id: 20,
759
+            profile_id: 139,
760
+            target_id: 43,
761
+            is_deleted: false,
762
+        },
763
+        {
764
+            match_queue_id: 21,
765
+            profile_id: 139,
766
+            target_id: 42,
767
+            is_deleted: false,
768
+        },
769
+        {
770
+            match_queue_id: 22,
771
+            profile_id: 139,
772
+            target_id: 41,
773
+            is_deleted: false,
774
+        },
700 775
     ],
701 776
 }

+ 2
- 1
frontend/src/App.vue Переглянути файл

@@ -58,7 +58,8 @@ export default {
58 58
             if (currentProfile.isLoggedIn) {
59 59
                 currentProfile.logout()
60 60
             }
61
-
61
+            // TODO: grab JWT from cookie and add JWT as third argument here
62
+            // (see views/OnboardingView.vue)
62 63
             await currentProfile.login(profileId, this.$waveui.notify)
63 64
             console.log('---')
64 65
 

+ 1
- 1
frontend/src/entities/profile/profile.js Переглянути файл

@@ -13,7 +13,6 @@ class Profile extends _baseRecord {
13 13
      */
14 14
     constructor({ email, ...profileData }) {
15 15
         super()
16
-
17 16
         this.type = this.constructor.name.toLowerCase()
18 17
 
19 18
         /**  Fields */
@@ -29,6 +28,7 @@ class Profile extends _baseRecord {
29 28
      * @return {boolean} is it valid or not?
30 29
      */
31 30
     isValid() {
31
+        console.log('this :=>', this)
32 32
         const validate = profileSchema.validate(this)
33 33
 
34 34
         /**

+ 1
- 0
frontend/src/services/index.js Переглянути файл

@@ -6,3 +6,4 @@ export * from './queue.service.js'
6 6
 export * from './chat.service.js'
7 7
 export * from './notification.service.js'
8 8
 export * from './login.service.js'
9
+export * from './auth.service.js'

+ 2
- 2
frontend/src/services/login.service.js Переглянути файл

@@ -77,13 +77,13 @@ class Login {
77 77
      * @param {number} profileId
78 78
      * @returns {number} stored reactive id
79 79
      */
80
-    async login(profileId, cb) {
80
+    async login(profileId, cb, sessionToken = null) {
81 81
         this._loading.value = true
82 82
         // First check if profile exists
83 83
         console.warn('[Login Service warn]: Logging in:', profileId)
84 84
 
85 85
         // TODO: You can probably use this call to get responses, groupings and tags
86
-        this._profile = await fetchProfileByProfileId(profileId)
86
+        this._profile = await fetchProfileByProfileId(profileId, sessionToken)
87 87
         this.id.value = this._profile.profile_id
88 88
 
89 89
         if (!this.id.value) {

+ 1
- 0
frontend/src/views/HomeView.vue Переглянути файл

@@ -1,4 +1,5 @@
1 1
 <template lang="pug">
2
+// TODO: Add router link to OnboardingView.vue's survey
2 3
 main.view--home
3 4
     article.w-flex.sm-column.md-row.align-center
4 5
         template(v-if='isLoading')

+ 15
- 1
frontend/src/views/OnboardingView.vue Переглянути файл

@@ -34,11 +34,12 @@ main.view--onboarding
34 34
 </template>
35 35
 
36 36
 <script>
37
-import { Authenticator } from '../services/auth.service.js'
37
+import { currentProfile, Authenticator } from '../services'
38 38
 import { surveyFactory } from '@/utils'
39 39
 import stepViews from '@/components/onboarding'
40 40
 import SurveyCompleteView from './SurveyCompleteView.vue'
41 41
 let hashedAccessToken = null
42
+// TODO: remove once currentProfile from services is fully enforced
42 43
 let currentProfileId = null
43 44
 
44 45
 export default {
@@ -63,6 +64,18 @@ export default {
63 64
         try {
64 65
             const sessionData = await this.verifySession(hashedAccessToken)
65 66
             currentProfileId = sessionData.profileId
67
+            await currentProfile.login(
68
+                currentProfileId,
69
+                this.$waveui.notify,
70
+                sessionData.accessToken,
71
+            )
72
+            // TODO: responses can now be gotten from currentProfile.responses
73
+            // TODO: assign token to currentProfile object?
74
+            console.log('currentProfile :=>', currentProfile)
75
+            // TODO: create a boolean toggle on currentProfile that determines
76
+            // whether user has returned to survey from HomeView?
77
+            this.$router.push('/')
78
+
66 79
             this.responses = sessionData.responses
67 80
             this.currentStep = this.responses.length + 3
68 81
             this.goToStep(this.currentStep)
@@ -122,6 +135,7 @@ export default {
122 135
             }
123 136
             // NOTE: If user has finished minimum profile creation,
124 137
             // Adds survey answers to responses table and verifies tokens on each step
138
+            // TODO: currentProfileId can now be gotten from currentProfile.responses
125 139
             if (currentProfileId) {
126 140
                 await surveyFactory.addNewSurveyAnswer(
127 141
                     this.responses[this.responses.length - 1],

Завантаження…
Відмінити
Зберегти