Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend #9

Open
wants to merge 401 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
401 commits
Select commit Hold shift + click to select a range
38d331e
Merge pull request #20 from tmgorogers/frontend
Jess20005 Jun 26, 2021
d7752a0
Merge branch 'main' into my-branch
JuliaKiser Jun 26, 2021
087e4a6
Merge branch 'main' into my-branch
JuliaKiser Jun 26, 2021
09c40e6
Merge pull request #21 from tmgorogers/my-branch
JuliaKiser Jun 26, 2021
3dcad91
Merge pull request #21 from tmgorogers/my-branch
JuliaKiser Jun 26, 2021
b3ba1ed
editing toggle working: changes both icon and input field vs readnoly
anishamcdowell Jun 26, 2021
ab7fc6d
editing toggle working: changes both icon and input field vs readnoly
anishamcdowell Jun 26, 2021
b97322e
updating matches page
JuliaKiser Jun 28, 2021
bdb4588
updating matches page
JuliaKiser Jun 28, 2021
7f84cdf
updated functionality for swipe cards
cworth26 Jun 28, 2021
701ca27
updated functionality for swipe cards
cworth26 Jun 28, 2021
5b521fd
Updating Profile.js
tmgorogers Jun 28, 2021
b6d9a80
Updating Profile.js
tmgorogers Jun 28, 2021
d0de608
Merge pull request #22 from tmgorogers/my-branch
anishamcdowell Jun 28, 2021
ec795f3
Merge pull request #22 from tmgorogers/my-branch
anishamcdowell Jun 28, 2021
59fc8ff
fixing font awesome issue
JuliaKiser Jun 28, 2021
fb552d8
fixing font awesome issue
JuliaKiser Jun 28, 2021
b01c8bc
still styling icons and buttons
JuliaKiser Jun 29, 2021
98a548d
still styling icons and buttons
JuliaKiser Jun 29, 2021
21ad998
adding nita files and my changes
JuliaKiser Jun 29, 2021
1b78b00
adding nita files and my changes
JuliaKiser Jun 29, 2021
e4b2c5a
Merge pull request #23 from tmgorogers/frontend
Jess20005 Jun 29, 2021
cb16954
Merge pull request #23 from tmgorogers/frontend
Jess20005 Jun 29, 2021
719ed04
beginning to set up socket.io messagining features
Jess20005 Jul 1, 2021
e07f860
beginning to set up socket.io messagining features
Jess20005 Jul 1, 2021
e7df07c
Merge pull request #24 from tmgorogers/socket
JuliaKiser Jul 1, 2021
0ef2b90
Merge pull request #24 from tmgorogers/socket
JuliaKiser Jul 1, 2021
5709b8e
Updating the help page
tmgorogers Jul 3, 2021
34a81cd
Updating the help page
tmgorogers Jul 3, 2021
9b67c39
Merge pull request #25 from tmgorogers/my-branch
Jess20005 Jul 3, 2021
e6f3f06
Merge pull request #25 from tmgorogers/my-branch
Jess20005 Jul 3, 2021
c85978e
adding socket.io logic
Jess20005 Jul 5, 2021
ccf80b7
adding socket.io logic
Jess20005 Jul 5, 2021
b765704
updated model schema
Jess20005 Jul 5, 2021
fcbad0c
updated model schema
Jess20005 Jul 5, 2021
d49cbc8
Updateing a lot
Jess20005 Jul 6, 2021
6d818bf
Updateing a lot
Jess20005 Jul 6, 2021
4548756
Merge pull request #26 from tmgorogers/Frontend
JuliaKiser Jul 6, 2021
dc88e71
Merge pull request #26 from tmgorogers/Frontend
JuliaKiser Jul 6, 2021
e7fd6da
Committing so I can finish a pull from main branch
anishamcdowell Jul 7, 2021
d181ab8
Committing so I can finish a pull from main branch
anishamcdowell Jul 7, 2021
99e88a7
Fixing merge conflicts in swipe page and app.js
anishamcdowell Jul 7, 2021
9d7a54b
Fixing merge conflicts in swipe page and app.js
anishamcdowell Jul 7, 2021
7c17423
updated yes key id
cworth26 Jul 8, 2021
bea6d82
updated yes key id
cworth26 Jul 8, 2021
396841d
Merge pull request #27 from tmgorogers/Frontend
JuliaKiser Jul 8, 2021
4e1f262
Merge pull request #27 from tmgorogers/Frontend
JuliaKiser Jul 8, 2021
12ba5ce
Committing so I can merge
anishamcdowell Jul 8, 2021
b669a3b
Committing so I can merge
anishamcdowell Jul 8, 2021
045d93e
Fixed merge conflict in user model
anishamcdowell Jul 8, 2021
4ddfd23
Fixed merge conflict in user model
anishamcdowell Jul 8, 2021
26838d2
updated swipe functionality
cworth26 Jul 8, 2021
1b77f18
updated swipe functionality
cworth26 Jul 8, 2021
ffff3fd
minor changes to chat page
Jess20005 Jul 9, 2021
cc7624e
minor changes to chat page
Jess20005 Jul 9, 2021
171376a
Merge branch 'Frontend' of https://github.com/tmgorogers/Connect-Dati…
Jess20005 Jul 9, 2021
179b8d5
Merge branch 'Frontend' of https://github.com/tmgorogers/Connect-Dati…
Jess20005 Jul 9, 2021
3af589a
Login/out issue fixed
anishamcdowell Jul 9, 2021
caaff6c
Login/out issue fixed
anishamcdowell Jul 9, 2021
156499f
Intro card data editing/saving/rerendering real time
anishamcdowell Jul 9, 2021
b74191e
Intro card data editing/saving/rerendering real time
anishamcdowell Jul 9, 2021
7c33f55
Merge pull request #28 from tmgorogers/Frontend
JuliaKiser Jul 9, 2021
d1a4b4a
Merge pull request #28 from tmgorogers/Frontend
JuliaKiser Jul 9, 2021
2c48838
updating match api file from caleb/adding matchseed to randomize matches
JuliaKiser Jul 9, 2021
31d8961
updating match api file from caleb/adding matchseed to randomize matches
JuliaKiser Jul 9, 2021
a8a10fc
Merge pull request #29 from tmgorogers/match-branch
Jess20005 Jul 9, 2021
efcea2a
Merge pull request #29 from tmgorogers/match-branch
Jess20005 Jul 9, 2021
753e11a
creating match component to filter data
JuliaKiser Jul 9, 2021
07a9d0c
creating match component to filter data
JuliaKiser Jul 9, 2021
6043f6e
Merge pull request #30 from tmgorogers/match-branch
Jess20005 Jul 9, 2021
a7caa9f
Merge pull request #30 from tmgorogers/match-branch
Jess20005 Jul 9, 2021
9387ade
Merging to resolve conflict in swipe api routes
anishamcdowell Jul 9, 2021
c3abdf6
Merging to resolve conflict in swipe api routes
anishamcdowell Jul 9, 2021
341701c
Merge pull request #31 from tmgorogers/EditState
Jess20005 Jul 9, 2021
34c4466
Merge pull request #31 from tmgorogers/EditState
Jess20005 Jul 9, 2021
7f3a499
Updating files
tmgorogers Jul 10, 2021
22cb30b
Updating files
tmgorogers Jul 10, 2021
f52214d
Editing the help page and connecting it to EmailJS
tmgorogers Jul 10, 2021
71e7c68
Editing the help page and connecting it to EmailJS
tmgorogers Jul 10, 2021
b21735f
Merge pull request #32 from tmgorogers/my-branch
Jess20005 Jul 10, 2021
086d573
Merge pull request #32 from tmgorogers/my-branch
Jess20005 Jul 10, 2021
9a97b8a
added styling to tindercard/swipes page
cworth26 Jul 10, 2021
7c39004
added styling to tindercard/swipes page
cworth26 Jul 10, 2021
cc28136
merge conflict
cworth26 Jul 10, 2021
2a84710
merge conflict
cworth26 Jul 10, 2021
9fa7522
Merge pull request #33 from tmgorogers/frontend
JuliaKiser Jul 10, 2021
b5e2f7f
Merge pull request #33 from tmgorogers/frontend
JuliaKiser Jul 10, 2021
0137c7c
searchuserpage
JuliaKiser Jul 10, 2021
38458c2
searchuserpage
JuliaKiser Jul 10, 2021
b0ad6f4
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 10, 2021
516b6b7
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 10, 2021
4e4eeac
Separating edit settings into image/text components
anishamcdowell Jul 10, 2021
332cd59
Separating edit settings into image/text components
anishamcdowell Jul 10, 2021
0fb8994
Merge pull request #34 from tmgorogers/match-branch
Jess20005 Jul 10, 2021
f639882
Merge pull request #34 from tmgorogers/match-branch
Jess20005 Jul 10, 2021
c2ff097
Fixing merge conlict in user schema
anishamcdowell Jul 10, 2021
4b854d3
Fixing merge conlict in user schema
anishamcdowell Jul 10, 2021
7d2e681
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 10, 2021
37fa06c
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 10, 2021
1e97ee3
clearing email form
JuliaKiser Jul 10, 2021
c26499b
clearing email form
JuliaKiser Jul 10, 2021
f07d2a0
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 10, 2021
69b9599
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 10, 2021
eea44fd
Fixed emaljs install
anishamcdowell Jul 10, 2021
e805b07
Fixed emaljs install
anishamcdowell Jul 10, 2021
325650e
Merge pull request #36 from tmgorogers/match-branch
Jess20005 Jul 10, 2021
b988880
Merge pull request #36 from tmgorogers/match-branch
Jess20005 Jul 10, 2021
758b7dc
Merge pull request #37 from tmgorogers/master
JuliaKiser Jul 10, 2021
c594676
Merge pull request #37 from tmgorogers/master
JuliaKiser Jul 10, 2021
cf054e8
Updating files
tmgorogers Jul 10, 2021
02675b6
Updating files
tmgorogers Jul 10, 2021
0f5caf2
Updating help page
tmgorogers Jul 10, 2021
8337a00
Updating help page
tmgorogers Jul 10, 2021
7cb274f
Merge pull request #38 from tmgorogers/my-branch
JuliaKiser Jul 10, 2021
a5a6050
Merge pull request #38 from tmgorogers/my-branch
JuliaKiser Jul 10, 2021
b6eefea
fixing package error
JuliaKiser Jul 10, 2021
9dda9c8
fixing package error
JuliaKiser Jul 10, 2021
07ac47f
accepting changes
JuliaKiser Jul 10, 2021
b2c4f6d
accepting changes
JuliaKiser Jul 10, 2021
990b31b
Adding upload photo functionality
anishamcdowell Jul 10, 2021
902fb11
Adding upload photo functionality
anishamcdowell Jul 10, 2021
aba4c3b
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 10, 2021
63233d1
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 10, 2021
4229fe5
fixing errors
JuliaKiser Jul 10, 2021
6ec3b5d
fixing errors
JuliaKiser Jul 10, 2021
67f35ec
Merge pull request #39 from tmgorogers/match-branch
anishamcdowell Jul 10, 2021
2dad55a
Merge pull request #39 from tmgorogers/match-branch
anishamcdowell Jul 10, 2021
5e4c7f1
Committing so I can merge
anishamcdowell Jul 10, 2021
7771236
Committing so I can merge
anishamcdowell Jul 10, 2021
75bf9a5
Commit to accept help.css changes
anishamcdowell Jul 10, 2021
005ea1c
Commit to accept help.css changes
anishamcdowell Jul 10, 2021
b486d30
Profile page UI matches settings page
anishamcdowell Jul 10, 2021
e9bc510
Profile page UI matches settings page
anishamcdowell Jul 10, 2021
30ca485
fixing homepage image/button
JuliaKiser Jul 10, 2021
9843c1b
fixing homepage image/button
JuliaKiser Jul 10, 2021
f043cf9
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 10, 2021
59ff306
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 10, 2021
c7c2573
Merge pull request #41 from tmgorogers/match-branch
Jess20005 Jul 10, 2021
e2120f1
Merge pull request #41 from tmgorogers/match-branch
Jess20005 Jul 10, 2021
a460c5c
WOrking on media queries for settings/profile page
anishamcdowell Jul 10, 2021
50b00f7
WOrking on media queries for settings/profile page
anishamcdowell Jul 10, 2021
337027f
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 10, 2021
cf4d215
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 10, 2021
379b28a
Updating photo upload and matches
anishamcdowell Jul 10, 2021
3dbdf98
Updating photo upload and matches
anishamcdowell Jul 10, 2021
fd9b2fd
Merge pull request #42 from tmgorogers/master
JuliaKiser Jul 10, 2021
26acdca
Merge pull request #42 from tmgorogers/master
JuliaKiser Jul 10, 2021
aac695a
working on match/swipe components to load onto match page
JuliaKiser Jul 10, 2021
14192fb
working on match/swipe components to load onto match page
JuliaKiser Jul 10, 2021
4aceda1
Merge pull request #43 from tmgorogers/match-branch
Jess20005 Jul 10, 2021
b534a81
Merge pull request #43 from tmgorogers/match-branch
Jess20005 Jul 10, 2021
543a3b8
Able to upload profile photo
anishamcdowell Jul 11, 2021
b06502c
Able to upload profile photo
anishamcdowell Jul 11, 2021
bfeff0f
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 11, 2021
2a3351d
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 11, 2021
c3c47ef
updating readme
JuliaKiser Jul 11, 2021
b0a3acc
updating readme
JuliaKiser Jul 11, 2021
b1bab61
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 11, 2021
726992b
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 11, 2021
93ca813
Merge pull request #44 from tmgorogers/match-branch
Jess20005 Jul 11, 2021
386dc8f
Merge pull request #44 from tmgorogers/match-branch
Jess20005 Jul 11, 2021
cbaf4b5
Adding spinner element for photo upload UI
anishamcdowell Jul 11, 2021
c398197
Adding spinner element for photo upload UI
anishamcdowell Jul 11, 2021
be8afbf
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 11, 2021
377239c
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 11, 2021
658cae0
Merge pull request #45 from tmgorogers/master
JuliaKiser Jul 11, 2021
9eed4f0
Merge pull request #45 from tmgorogers/master
JuliaKiser Jul 11, 2021
c57aa44
updating upload image errors and adding default image to settings and…
JuliaKiser Jul 11, 2021
ad3b96f
updating upload image errors and adding default image to settings and…
JuliaKiser Jul 11, 2021
b09fdbc
Merge pull request #46 from tmgorogers/match-branch
Jess20005 Jul 11, 2021
6415d40
Merge pull request #46 from tmgorogers/match-branch
Jess20005 Jul 11, 2021
21f5ffe
Trying to fix default image ft
anishamcdowell Jul 11, 2021
aa5dda5
Trying to fix default image ft
anishamcdowell Jul 11, 2021
28f3dae
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 11, 2021
6ce2dea
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 11, 2021
76eb3a1
updating tindercard buttons
cworth26 Jul 11, 2021
14cdc24
updating tindercard buttons
cworth26 Jul 11, 2021
a9d428c
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
cworth26 Jul 11, 2021
01efcb1
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
cworth26 Jul 11, 2021
552ef37
updated tinder buttons
cworth26 Jul 11, 2021
7e61c26
updated tinder buttons
cworth26 Jul 11, 2021
25e9307
Merge pull request #47 from tmgorogers/frontend
Jess20005 Jul 11, 2021
1dc0923
Merge pull request #47 from tmgorogers/frontend
Jess20005 Jul 11, 2021
8435611
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 11, 2021
e2ac231
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 11, 2021
300175b
Tweaking user schema defauly values
anishamcdowell Jul 11, 2021
7edb0ae
Tweaking user schema defauly values
anishamcdowell Jul 11, 2021
1ee65d2
Merge pull request #48 from tmgorogers/master
JuliaKiser Jul 11, 2021
d7e587f
Merge pull request #48 from tmgorogers/master
JuliaKiser Jul 11, 2021
da121a0
deleting pictures
anishamcdowell Jul 11, 2021
1437c10
deleting pictures
anishamcdowell Jul 11, 2021
c02cee0
changes to package.json
anishamcdowell Jul 11, 2021
3f25490
changes to package.json
anishamcdowell Jul 11, 2021
65e8b41
updated file paths
anishamcdowell Jul 11, 2021
4ca9f66
updated file paths
anishamcdowell Jul 11, 2021
641ea12
changed api/index.js
anishamcdowell Jul 11, 2021
9db6052
changed api/index.js
anishamcdowell Jul 11, 2021
f67f366
more errors
anishamcdowell Jul 11, 2021
91aa383
more errors
anishamcdowell Jul 11, 2021
9663c1e
hello.txt in uploads
anishamcdowell Jul 11, 2021
62666e0
hello.txt in uploads
anishamcdowell Jul 11, 2021
997b917
Merge pull request #49 from tmgorogers/master
JuliaKiser Jul 11, 2021
42035bb
Merge pull request #49 from tmgorogers/master
JuliaKiser Jul 11, 2021
129009e
pushing a couple readme changes
JuliaKiser Jul 11, 2021
787255a
pushing a couple readme changes
JuliaKiser Jul 11, 2021
62baf61
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 11, 2021
746814f
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App into …
JuliaKiser Jul 11, 2021
5600710
Merge pull request #50 from tmgorogers/match-branch
Jess20005 Jul 11, 2021
6752e6b
Merge pull request #50 from tmgorogers/match-branch
Jess20005 Jul 11, 2021
470e405
changes to the signup page
Jess20005 Jul 12, 2021
75747b1
changes to the signup page
Jess20005 Jul 12, 2021
2fbea74
updated login page
Jess20005 Jul 12, 2021
556b60e
updated login page
Jess20005 Jul 12, 2021
8da364c
Updated homepage and navbar
anishamcdowell Jul 12, 2021
fbf74c9
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 12, 2021
b5c3eb8
fixed styled-components error, minor tweak to sign up
Jess20005 Jul 12, 2021
9158d20
fixed styled-components error, minor tweak to sign up
Jess20005 Jul 12, 2021
fae956c
Merge pull request #51 from tmgorogers/Frontend
JuliaKiser Jul 12, 2021
0ab76d8
Merge pull request #51 from tmgorogers/Frontend
JuliaKiser Jul 12, 2021
990c7ce
Revert "changes to the signup page"
anishamcdowell Jul 12, 2021
8d4ce24
Revert "changes to the signup page"
anishamcdowell Jul 12, 2021
1466d76
Merge pull request #52 from tmgorogers/revert-51-Frontend
JuliaKiser Jul 12, 2021
7df2f2e
Merge pull request #52 from tmgorogers/revert-51-Frontend
JuliaKiser Jul 12, 2021
452647d
Changing routes for better user flow
anishamcdowell Jul 12, 2021
36021f9
Slight clean up of swipes UI and loading component on setting photo
anishamcdowell Jul 12, 2021
f95c8d4
Merge branch 'main' of github.com:tmgorogers/Connect-Dating-App
anishamcdowell Jul 15, 2021
c63a05b
Each user card on browse page now links to individual user profile
anishamcdowell Jul 15, 2021
7954016
Deleting psd file that was added by mistake to imgs
anishamcdowell Jul 15, 2021
e04dde4
2nd attempt to remove large psd for push
anishamcdowell Jul 15, 2021
fa2249b
Attemping to store psd in git large file storage bc it will not delete?
anishamcdowell Jul 15, 2021
4fd1f20
adding psd to gitignore
anishamcdowell Jul 15, 2021
09020f0
Deleting upload folder pics
anishamcdowell Jul 15, 2021
47ba362
Manual conflict merge in hella files
anishamcdowell Jul 15, 2021
d48470a
Final conflict merges
anishamcdowell Jul 15, 2021
bc851d6
Merge pull request #53 from tmgorogers/master
JuliaKiser Jul 15, 2021
e798376
**Not the correct iamage - img state reflects profile img of currentl…
anishamcdowell Jul 17, 2021
952af6f
Swipe page showing user photos
anishamcdowell Jul 17, 2021
68a3283
Swipe page doesn't recycl yes swipes, but does recycle no swipes
anishamcdowell Jul 17, 2021
ea87d63
Update to swipe photos
anishamcdowell Jul 20, 2021
a90e650
Merge pull request #54 from tmgorogers/master
JuliaKiser Jul 20, 2021
9103105
Navbar fully mobile responsive
anishamcdowell Jul 22, 2021
b5866f1
.connect logo mobile responsive
anishamcdowell Jul 22, 2021
23a55be
Homepage is mobile responsive
anishamcdowell Jul 22, 2021
4c31cfd
Login and signup mobile responsive
anishamcdowell Jul 22, 2021
95da7f1
swipe page mobile responsive
anishamcdowell Jul 22, 2021
13b93fe
Search users settings switching between sidebar/topbar nav on screen …
anishamcdowell Jul 22, 2021
c39ac58
Merge pull request #55 from tmgorogers/master
Jess20005 Jul 23, 2021
a1cf2ef
email verification confirmation
cworth26 Jul 23, 2021
a6df180
pushing up email verification code
cworth26 Jul 24, 2021
0d542f2
deleted emailConfirmation folder
cworth26 Jul 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions database/models/match.js
Original file line number Diff line number Diff line change
@@ -5,6 +5,10 @@ mongoose.promise = Promise;

// Define chatSchema
const matchSchema = new Schema({
userId: {
type: Schema.Types.ObjectId,
ref: "User",
},
users: [
{
userId: {
@@ -16,9 +20,9 @@ const matchSchema = new Schema({
type: String,
},
match: {
type: Boolean,
required: true
}
type: Boolean,
required: true,
},
},
],
socketRoomName: {
4 changes: 3 additions & 1 deletion database/models/user.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ const bcrypt = require("bcryptjs");
const Schema = mongoose.Schema;
mongoose.promise = Promise;

//each user has a match -> this is an array of users that they swiped yes
// if the user swiped yes and the other user swiped yes, this is a confirmed match
// Define userSchema
const userSchema = new Schema({
username: { type: String, required: true, unique: true },
@@ -31,7 +33,7 @@ const userSchema = new Schema({
url: {
type: String,
},
},
}
});

// Define schema methods
71 changes: 34 additions & 37 deletions routes/api/match.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
const express = require("express");
const router = express.Router();
const { Match } = require("../../database/models/");
const { Match, User } = require("../../database/models/");


// TODO: take a second look
router.get("/all", async (req, res) => {
try {
const matchData = await Match.find({
$and: [
{
"users.userId": req.user._id,
},
{
"users.match": true
"users.userId": req.user._id,
"users.match": {
$ne: false
}
],
});

console.log(matchData);

res.json(matchData);
} catch (err) {
console.log(err);
@@ -28,38 +22,41 @@ router.get("/all", async (req, res) => {

router.post("/", async (req, res) => {
try {


if(req.body.usersArr[1].match) {
const userData = await User.findByIdAndUpdate(req.user._id, {
$push: {
yes: req.body.usersArr[0].userId
}
})
}


// TODO: if allready exists don't create
// find one match where one user.userId is equal to req.user._id
// and one user.userId is equal to given userId
// const matchData = await Match.findOne({
// $and: [
// {
// "users.userId": req.user._id,
// },
// {
// "users.userId": req.body.usersArr[0].userId,
// },
// ],
// });
const matchData = await Match.findOne({
"users.userId": req.user._id,
"users.userId": req.body.usersArr[0].userId
});

// console.log(matchData);
// ? need to update the user match value
// if (matchData) {
// console.log("trying to update")
// console.log(req.user._id, req.body.usersArr[1].match)
// const updatedMatchData = await matchData.update(
// {
// "users.userId": req.user._id,
// },
// {
// $set: {
// "users.$.match": req.body.usersArr[1].match,
// },
// }
// );
// console.log(updatedMatchData);
// return res.json(updatedMatchData);
// }
if (matchData) {
const updatedMatchData = await Match.updateOne(
{
_id: matchData._id,
"users.userId": req.user._id,
},
{
$set: {
"users.$.match": req.body.usersArr[1].match,
},
}
);

return res.json(updatedMatchData);
}

const newMatch = new Match({
users: req.body.usersArr,
30 changes: 4 additions & 26 deletions routes/api/swipe.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const express = require("express");
const router = express.Router();
const User = require("../../database/models/User");
const { matchUsers } = require("/match.js");
const Match = require("../../database/models/match");

//getting home endpoint and finding all user data and displaying it by their id
router.get("/", async (req, res) => {
@@ -14,15 +14,10 @@ router.get("/", async (req, res) => {
$ne: req.user._id,
},
});
// turning user data to Json

if (!myUser.yes) return res.json(userData);

console.log(
"FILTERED USERS",
userData.filter((user) => {
// Check if user exists in my user yes data
return myUser.yes.findIndex((_id) => _id === user._id) === -1;
})
);
//turning user data to JSON
res.json(
userData.filter((user) => {
// Check if user exists in my user yes data
@@ -35,21 +30,4 @@ router.get("/", async (req, res) => {
}
});

//TODO: update swipe API to add to yes key

//filter users based on previous matches
// function matchUsers() {
// return (
// <div>
// {matchData
// .filter((matchUsers) => matchUsers.include("users.match"))
// .map((filteredMatch) => (
// <li>{filteredMatch}</li>
// ))}
// </div>
// );
// }

//add export default matchUsers? or simply call function at the end?

module.exports = router;
75 changes: 75 additions & 0 deletions seeders/matchSeed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
let mongoose = require("mongoose");
let db = require("../database/models");
const { use } = require("../routes/api/swipe");

mongoose.connect("mongodb://localhost/connectDB", {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true,
});

db.Match.deleteMany({})
.then(() => db.User.find({}))
.then((data) => {
// console.log(data);
//first we randomly select a user
let userSelected = Math.floor(Math.random() * data.length);
// console.log(userSelected);
//and then we select a random number
let numberOfMatches = Math.floor(Math.random() * data.length) - 1;
if (numberOfMatches < 0) {
numberOfMatches = 1;
}
console.log(numberOfMatches);
//randomized number of matches depending on amount of users
let matchSeed = [];
for (let i = 0; i < numberOfMatches; i++) {
let match = Math.floor(Math.random() * data.length);
//look up if match is already within the matches
let idCheck = matchSeed.filter((el) => el._id === data[match]._id);
while (match === userSelected || idCheck.length > 0) {
match = Math.floor(Math.random() * data.length);
idCheck = matchSeed.filter((el) => el._id === data[match]._id);
}
console.log(data[match]);
matchSeed.push({
userId: data[match]._id,
name: data[match].firstName + data[match].lastName,
match: Math.floor(Math.random() * 2),
});
}
// console.log(data[userSelected]);
console.log(matchSeed);
db.Match.create({
userId: data[userSelected]._id,
users: matchSeed,
socketRoomName: "YAGA",
}).then((res) => {
console.log(res);
process.exit(0);
});
})
.catch((err) => {
console.error(err);
process.exit(1);
});

//if user swiped yes
//validation if both Match Ids are actually true

//for the user
//find all users they matched to
//then find matched data for user in array
//if they matched, append to data returned to the front
/**
* let arrayReturned = []
* Match.find({userId}).then({
* for users matched (use filter)
* Match.find({userId})
* if match is found
* append it to array
* res.json(arrayReturned)
*
* })
*/