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

Cursor pointer #122

Open
wants to merge 183 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
e45d66b
Add docs dir and its contents
josemourinho333 Aug 4, 2022
b5655e9
Changed to function component
josemourinho333 Aug 4, 2022
96e43bb
Merge pull request #1 from josemourinho333/dont-use-db-setup-practice
josemourinho333 Aug 4, 2022
05bd103
Add sample routes and api
josemourinho333 Aug 5, 2022
5136815
Add db -> server -> browser
josemourinho333 Aug 5, 2022
056487c
Merge pull request #2 from josemourinho333/dont-use-db-setup-practice
josemourinho333 Aug 5, 2022
5098b27
Add json to browser
josemourinho333 Aug 5, 2022
0e04da9
Merge pull request #3 from josemourinho333/dont-use-db-setup-practice
josemourinho333 Aug 5, 2022
3bf6b7f
db schema first review
ukflava Aug 5, 2022
6837c46
add api routes to get users and messages
ukflava Aug 5, 2022
bb7b3f2
add tables and seeds
ukflava Aug 6, 2022
c585e7c
schema
josemourinho333 Aug 6, 2022
a4e1475
Update with newest code
josemourinho333 Aug 6, 2022
391b4c6
Add update to schema, seeds, and clean up on touched files. Queries a…
josemourinho333 Aug 6, 2022
83250ef
Merge pull request #4 from josemourinho333/py-from-denis
josemourinho333 Aug 6, 2022
abb80f8
Update initial API call done in each render inside useEffect hook, []…
josemourinho333 Aug 6, 2022
28e8076
Merge pull request #5 from josemourinho333/py/update-app-initial-state
ukflava Aug 6, 2022
b6605c9
testing query for join tables
ukflava Aug 6, 2022
bdf42ab
pass value from middle tables to user
ukflava Aug 6, 2022
80d8d22
adding user preferences
avacadok Aug 6, 2022
ff95586
Merge branch 'master' into core/update-preferences
avacadok Aug 6, 2022
71a5f9e
queries and init block user function
ukflava Aug 6, 2022
abe9826
rename branch
ukflava Aug 6, 2022
62fad06
Add cookie-session as dependency
josemourinho333 Aug 6, 2022
773ee17
Add login post request handle on server side and user validation
josemourinho333 Aug 6, 2022
f471da4
Add controlled form for log in
josemourinho333 Aug 6, 2022
ec3c5c0
Add post request handle for log out
josemourinho333 Aug 6, 2022
991241f
Add post request functionality in front-end
josemourinho333 Aug 6, 2022
ad01c38
merged with py/feature/login-signout-init
ukflava Aug 6, 2022
d0d7b9a
Merge pull request #6 from josemourinho333/py/feature/login-signout-init
ukflava Aug 6, 2022
bea78ce
merged with login/logout query done, block done
ukflava Aug 6, 2022
76e8742
linted code, delete get route for blocked
ukflava Aug 6, 2022
be207fb
Merge pull request #8 from josemourinho333/core/updateQandBlockuser
josemourinho333 Aug 6, 2022
68c595c
add new state for preference when click on update preference
avacadok Aug 6, 2022
a0f6b7f
edit the syntax
avacadok Aug 6, 2022
b3974d9
merge with master
avacadok Aug 6, 2022
0106cf5
add test table for select preferences
avacadok Aug 6, 2022
3ad4a30
update preferences for users
avacadok Aug 6, 2022
c1b98f1
Merge pull request #9 from josemourinho333/core/update-preferences
josemourinho333 Aug 6, 2022
b4c6075
install tailwind to app
avacadok Aug 7, 2022
15da2ec
Add update to gitignore, some database config changes and updates to …
josemourinho333 Aug 7, 2022
5d43cfc
Add nodemon
josemourinho333 Aug 7, 2022
a855c36
Add fix to updating pref
josemourinho333 Aug 7, 2022
6b459de
Add updates to set pref and clean up
josemourinho333 Aug 7, 2022
d1b44b5
Merge pull request #10 from josemourinho333/py-pref-db-fix
josemourinho333 Aug 7, 2022
54c2e7a
add style to button
avacadok Aug 7, 2022
b422268
add preferences for users
avacadok Aug 7, 2022
525d1ea
Merge pull request #11 from josemourinho333/tailwind
josemourinho333 Aug 7, 2022
a37854e
Add clean up
josemourinho333 Aug 7, 2022
303287a
add login form to components
avacadok Aug 7, 2022
68a6b8e
Add update
josemourinho333 Aug 7, 2022
65a6fab
initial commit after tailwind install
ukflava Aug 7, 2022
53571d5
Add new photos
josemourinho333 Aug 7, 2022
10a6537
Add updates to users query for array of photos
josemourinho333 Aug 7, 2022
8e26c26
Add initial css reset
josemourinho333 Aug 7, 2022
6533499
Add profile card import
josemourinho333 Aug 7, 2022
de77e43
Add gitginore
josemourinho333 Aug 7, 2022
5299f06
add pw and username input for login form
avacadok Aug 7, 2022
e732b56
first version of navbar
ukflava Aug 8, 2022
d5e611b
Add update for query on all users
josemourinho333 Aug 8, 2022
458eea1
Add profile card template
josemourinho333 Aug 8, 2022
9d7bc1d
dropdown for navbar
ukflava Aug 8, 2022
6148678
dropdown position right
ukflava Aug 8, 2022
8d66fc4
add couplr picture for login page
avacadok Aug 8, 2022
23bda6b
add style for login form
avacadok Aug 8, 2022
a2addda
add login form to App and move the loginhandler to login-form
avacadok Aug 8, 2022
5538e6a
props passed to nav
ukflava Aug 8, 2022
48a2989
implement onBlur for menu
ukflava Aug 8, 2022
2159669
add picture for login page
avacadok Aug 8, 2022
e968299
Remove comments
josemourinho333 Aug 8, 2022
ab21082
Add react-tinder-card hook dependency
josemourinho333 Aug 8, 2022
6c589a1
Add stacked profile cards and swiping
josemourinho333 Aug 8, 2022
779d3ce
add ternary on initial load
ukflava Aug 8, 2022
a8903e2
Added new user for testing
josemourinho333 Aug 8, 2022
5c87941
add set state when input login info and set the cookie
avacadok Aug 8, 2022
f28aa0a
Add final touches to users profile cards
josemourinho333 Aug 8, 2022
af406df
add project contributor info to login form
avacadok Aug 8, 2022
9d75118
edit font style
avacadok Aug 8, 2022
b824e8f
organize file
avacadok Aug 8, 2022
7b7ac08
Updates to seeds and queries matching functionality
josemourinho333 Aug 8, 2022
60351fb
Add bug fix and separate match list for dynamic updates as user swipes
josemourinho333 Aug 8, 2022
c67c806
add router and routes to nav
ukflava Aug 9, 2022
4d5102b
change queries for routes
ukflava Aug 9, 2022
8569f72
update and lint code
ukflava Aug 9, 2022
e32a711
Add updates for routes and queries
josemourinho333 Aug 9, 2022
895be25
Add routes, user profile view, edit, img replacer comp
josemourinho333 Aug 9, 2022
21f5619
merge login form with nav bar
avacadok Aug 9, 2022
5f2a88f
Final merge
josemourinho333 Aug 9, 2022
8623027
Merge pull request #12 from josemourinho333/copy/profile-card
josemourinho333 Aug 9, 2022
c04ea77
Add login page clean up
josemourinho333 Aug 9, 2022
a482355
Add more clean up and log in and out functionality
josemourinho333 Aug 9, 2022
7ca4570
Add clean up for Navs
josemourinho333 Aug 9, 2022
ad49490
Add fix for viewheight issue with nav and profile cards
josemourinho333 Aug 9, 2022
445f8b2
Merge pull request #13 from josemourinho333/merge-test/fix/clean-up
josemourinho333 Aug 9, 2022
5b2575d
Add update to user id 1
josemourinho333 Aug 9, 2022
651dbb7
Add update to drinks, exercises, dating goals table for values
josemourinho333 Aug 9, 2022
f20c79f
Add important view height css fix
josemourinho333 Aug 9, 2022
b5fcd57
Swap second pic on user 1
josemourinho333 Aug 9, 2022
cc3af07
simple structure for matches without style
ukflava Aug 9, 2022
074c20c
Add update to how user photos are fetched
josemourinho333 Aug 9, 2022
1c71217
Add updates to edit profile query and fetching users info
josemourinho333 Aug 9, 2022
29c9122
Add updates to accomodate user photos data structure
josemourinho333 Aug 9, 2022
4d5920a
refactored structure with columns
ukflava Aug 9, 2022
5b74288
Add bug fixes for queries
josemourinho333 Aug 10, 2022
cabd6ce
Add beginning files for matches page
josemourinho333 Aug 10, 2022
adfed5f
Add final touches to height bug on cards
josemourinho333 Aug 10, 2022
03b2158
add message_seen and unread
ukflava Aug 10, 2022
d355328
check for queries or front end statements to use
ukflava Aug 10, 2022
c699544
Add updates to seeds
josemourinho333 Aug 10, 2022
2c1c554
Add update to queries
josemourinho333 Aug 10, 2022
7cae97c
Add updates and files for chat section of the matches page no websocket
josemourinho333 Aug 10, 2022
2da0e1d
Add install and use of moment.js
josemourinho333 Aug 10, 2022
951cb88
Add date format and click to show time sent
josemourinho333 Aug 10, 2022
d928773
Add input clear, setting msg history to render msgs
josemourinho333 Aug 10, 2022
899fa92
Add post request to insert new message
josemourinho333 Aug 10, 2022
67b83c2
Add new message display rendering from latest list of msgs db
josemourinho333 Aug 10, 2022
0145209
Add chatbox overflow settings and match header fix
josemourinho333 Aug 10, 2022
900b3f0
Add styling updates
josemourinho333 Aug 10, 2022
d00f969
add seeds to db
ukflava Aug 10, 2022
fba34d6
Add react-emoji-picker and functionality implementation
josemourinho333 Aug 10, 2022
0f4524f
Add comments
josemourinho333 Aug 10, 2022
4db55a5
delete seeds, clean matches
ukflava Aug 10, 2022
fee6543
linted bell
ukflava Aug 10, 2022
c258c87
Add bug fix to chat room scrollbar
josemourinho333 Aug 10, 2022
883197c
Merge branch 'feature/matches' into merge/core/matches
josemourinho333 Aug 10, 2022
1998fda
delete messages component
ukflava Aug 10, 2022
6a10bc1
Merge conflict resolved
josemourinho333 Aug 10, 2022
c1c5258
Add initial merge of matches sections
josemourinho333 Aug 10, 2022
9018e25
Add quick fix to select view function
josemourinho333 Aug 10, 2022
a71a53c
Add more matched users, see filtered messages per user id
josemourinho333 Aug 10, 2022
add14ed
socket IO message
ukflava Aug 11, 2022
ce52299
socket IO message passed to server and back
ukflava Aug 11, 2022
d99fdb8
socket IO messages passed, but need id for children
ukflava Aug 11, 2022
c758ca6
socket IO index as id for children not work
ukflava Aug 11, 2022
cb82540
Update to matches query
josemourinho333 Aug 11, 2022
8397eda
Add updates to rendering list of matches
josemourinho333 Aug 11, 2022
f39431a
Add post route for updating message_seen
josemourinho333 Aug 11, 2022
fd02b32
Add functionality to bold unread messages and unbold when match clicked
josemourinho333 Aug 11, 2022
02402fb
Add updates to read/unread indicator on match list
josemourinho333 Aug 11, 2022
03a229f
Add no user left message and component
josemourinho333 Aug 11, 2022
55c6b2f
switch axios to socket - rendered by useeffect from DB
ukflava Aug 11, 2022
7568196
Add finishing touches to unread/newmatch indicators
josemourinho333 Aug 11, 2022
b2bc7dc
Merge pull request #14 from josemourinho333/merge/core/matches
josemourinho333 Aug 11, 2022
be7a06d
switch new messages from axios to socketIO
ukflava Aug 11, 2022
dd84fc6
Switch from hardcoded api routes now to dynamic with users id and upd…
josemourinho333 Aug 11, 2022
2bb8c33
Merge pull request #15 from josemourinho333/merge/core/matches
josemourinho333 Aug 11, 2022
6eefc2e
clean code nefore merging
ukflava Aug 11, 2022
9a52b87
Merge branch 'master' of github.com:josemourinho333/Keen-Dating-App i…
ukflava Aug 11, 2022
a5b5021
Add bug fix and user is now an object instead
josemourinho333 Aug 11, 2022
fe1f69f
Merge pull request #16 from josemourinho333/merge/core/matches
josemourinho333 Aug 11, 2022
0a04afc
Add bug fix and move user state to its own
josemourinho333 Aug 11, 2022
3a53de7
Merge pull request #17 from josemourinho333/Preferences
josemourinho333 Aug 11, 2022
55c3b5c
try to get messages betwwe 2 users
ukflava Aug 12, 2022
b8623c9
changed to socketIO ID client ad reciever
ukflava Aug 12, 2022
aaf2167
Add update preferences feature
josemourinho333 Aug 12, 2022
4cea51c
Merge pull request #18 from josemourinho333/Preferences
josemourinho333 Aug 12, 2022
23a5012
return first solution for socketIO
ukflava Aug 12, 2022
7b4e929
socket IO ready to merge to master
ukflava Aug 13, 2022
fe0f48a
Merge branch 'master' of github.com:josemourinho333/Keen-Dating-App i…
ukflava Aug 13, 2022
12b579e
fixed small bugs from merging
ukflava Aug 13, 2022
3c368a6
Add fix to match-seen bug
josemourinho333 Aug 13, 2022
50fca86
Merge pull request #19 from josemourinho333/fix/new-match-seen
josemourinho333 Aug 13, 2022
6532278
Merge branch 'master' of github.com:josemourinho333/Keen-Dating-App i…
ukflava Aug 13, 2022
4c6b613
trigger turn off, merged master
ukflava Aug 13, 2022
f988183
Merge pull request #20 from josemourinho333/connection/socetio
josemourinho333 Aug 13, 2022
34f2c1e
add feature to checkout matched users profile when click on their pro…
avacadok Aug 13, 2022
1c3ef53
edit matching routes to get info for the matched users
avacadok Aug 13, 2022
716cbe3
add link to nav profile so user can check the matched users profile i…
avacadok Aug 13, 2022
efa8170
Merge pull request #21 from josemourinho333/feature/check-userprofile
josemourinho333 Aug 13, 2022
cb07c85
Add fix for swiped users showing up again when back to home page afte…
josemourinho333 Aug 13, 2022
e42efcc
Merge pull request #22 from josemourinho333/fix/swiped-user-reshowing
josemourinho333 Aug 13, 2022
4bdf402
Update page header depending on which page user is one
josemourinho333 Aug 13, 2022
7356373
Merge pull request #23 from josemourinho333/fix/update-nav-header-on-…
josemourinho333 Aug 13, 2022
4f3c2eb
Add fixes to show current changes toggling view/edit and update to se…
josemourinho333 Aug 13, 2022
aca1f1c
Add updates to add few more data added on fetching users info
josemourinho333 Aug 13, 2022
a4debe2
Merge pull request #24 from josemourinho333/fix/update-profile
josemourinho333 Aug 13, 2022
dfd9bbd
Add font to logo header, update browser tab icon and name
josemourinho333 Aug 13, 2022
45a0f35
Merge pull request #25 from josemourinho333/fix/logo-font
josemourinho333 Aug 13, 2022
ff13859
Add fix to msg preview not being bolded if new/unread
josemourinho333 Aug 13, 2022
be14399
Merge pull request #26 from josemourinho333/fix/match-bubble-unseen-i…
josemourinho333 Aug 13, 2022
85fc432
Remove console logs
josemourinho333 Aug 13, 2022
e238ee5
add cursor pointer to the match bubble
avacadok Aug 13, 2022
3dc5078
add cursor pointer to areas that are clickable on preferences page
avacadok Aug 13, 2022
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
Binary file added docs/ERD.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/mvp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# MVP

## Users can log in and sign out

## Users can like or pass and browse profiles

## Users can match with other users based on likes

## Users can set preferences

## Users can edit their profile

## Users can message with the matches


## Users can register and create an account/profile*

16 changes: 16 additions & 0 deletions docs/project-description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Project Description

### Title
- Keen

### Description
- A dating app for everyone

### Target Audience
- Anyone but mostly 18 - 35

### Team Members
- Phil Yoo, Ava Kuang, Denis Krutetskii

### Wireframe
- https://www.figma.com/file/6kh9WnCO1SFSV8ycjo6UsZ/mock-up-design?node-id=6%3A121
75 changes: 75 additions & 0 deletions docs/routes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
## Routes and states

### all after login

props.matches = map = create chatrooms
current view = chat with id 5
filter api/users/:id/messages (props.messages) to_id: 5

#### url : /
api: api/users, api/users/:id, api/users/:id/messages, api/user/:id/matching/, ??api/user/:id/matching/:id/messages?? (from_user_id)
states: -->
const [state, setState] = useState({
user: you
users: []
messages: [{your messages}]
likedBy: [5] get: api/user/:id/matching/ -> select * from matching where to_id = your id
matches: [5] put/patch: api/user/:id/matching/ -> update columns in matching where your_id
blocked: [id1, id2, id3]
matching: []
})
const [like, setLike] = useState()

matching = {
id,
from_user_id - always your id
to_id
like_value
seen
}

see a user (id: 3)
<!-- you swipe left - setLike({user[dislikedUserID]: like})
you swipe right - setLike({user[likedUserID]: like}) -->

you swipe left ==> matching[seen]: true // matching[like_value] :false
you swipe right ==> matching[seen]: true // matching[like_value] :true


displayed: users[] - this is where swiping happens


#### url: /matches (api/users/:id/messages)
api: Websockets function
states: props.user, props.matches, props.messages
feature: emoji table, GIPHY(stretch)

#### urls: /preferences (can be accessed from /matches and /profile)
api: none needed
states: props.user
*need to pass it back up after saves

#### url: /profile
api: none needed atm
states: props.user
*need to pass it back up after saves

#### Stretch: external APIs
Video call: WebRTC?
GIPHY API: feature in chat
Spotify: allow user to set a song AND/OR list top fav listend artists (shown in their profile)
Location: Start with hardcode -> maybe maps api after


<!-- params id

axios.get('/api/data')



states: -->




<!-- / api to users -->
58 changes: 58 additions & 0 deletions docs/user_stories.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# User Stories

### User comes to log in page (/)
### User can login if they signed up
- user authenication (email and pass match)
- cookies

### User is redirected to "/index" which is basically swiping section

### User can like or pass on profiles on home page (/index)
- Start with buttons, swiping as stretch

### Matches will be shown in shuffle mode
- After any preferences that are set
- User won't see profiles that they passed on, previously matched or blocked(stretch)

### Match logic: if user.liked.includes(user.id) = the user you liked, will show up in msg/match section.
- This should also show some kind of sign on nav button to indicate new change(stretch)

### User has access to preferences, msgs/matches, and dropdown for user specific actions (edit profile, settings, sign out)

### Matches page: user can see list of matches
- matchListItem has: thumbnail, name, msg preview, and last update time

### Matches page: user can select a matchListItem and start messaging
- If user clicks on the name of currentMessageItem, they can see the match's profile
- Messages will have time sent and its content (styling like smartphone)
- User can click on phone and video call optins beside match's name
- User can click to block besides ^ buttons
- User can select emojis
- User can select gifs (GIPHY API) - stretch

### User will see preferences page when clicked on
- User can select gender, age, distance, any user properties (if applicable)
- If user clicks on one of the properties, new screen will follow where user can change their preferences and save or cancel which will go back to preferences page

### User can click on Profile link and will see its own profile and have a button to edit
- User can switch between view and edit mode. user will have to save if any changes are made to see the change reflected on view mode and other matches.
- Images will be stored via URLs - maybe for stretch we can have them stored in cloud

### User will see settings page when clicked on
- On settings page, user can see user's account details such as their email.
- User will see links for privacy, ToS, Tips, Code of conduct etc. STRETCH - these details can be filled for stretch

### User can click on sign out button and sign out, will be redirected to (/) home page which is a login page.
- Basically no access to any of the sites for visitors.


## Stretch
- "Premium" User has another page where they can see (one at a time, like in the swiping section) who has liked their profile and swipe based on the list

- User can swipe left to pass or right to like a profile

- More Stretch to come....




2 changes: 1 addition & 1 deletion express-back-end/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
.env
.env
20 changes: 20 additions & 0 deletions express-back-end/db/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// psql connection config
require('dotenv').config();
const pg = require('pg');
const Pool = pg.Pool;

const config = {
host: process.env.PGHOST,
port: process.env.PGPORT,
user: process.env.PGUSER,
password: process.env.PGPASSWORD,
database: process.env.PGDATABASE
};

const db = new Pool(config);

db.connect(() => {
console.log('connected to database');
})

module.exports = db;
6 changes: 6 additions & 0 deletions express-back-end/db/queries/01_test.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- INSERT INTO messages (from_user_id, to_user_id, message, message_seen, date_sent)
-- VALUES
-- (4, 1, '4----1 hey from id.1 to id.2', false, CURRENT_TIMESTAMP),
-- (1, 4, '1----4 hey from id.2 to id.1', false, CURRENT_TIMESTAMP),
-- (4, 1, '4----1 hey again from id.1 to id.5', true, CURRENT_TIMESTAMP),
-- (4, 1, '4-----1 hey again from id.1 to id.4', true, CURRENT_TIMESTAMP);
84 changes: 84 additions & 0 deletions express-back-end/db/queries/02_seeds.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
INSERT INTO users (name, email, password, bio, age, gender_id, location, height_in_cm, education,
occupation, drink_id, exercise_id, dating_goal_id, is_active)
VALUES
('Brennan Padilla','[email protected]', '1111', 'I have never seen a straight banana.', 25, 1, 'Vancouver', 180 , 'high school', 'student', 3, 3, 2, true),
('Belle Hendrick','[email protected]', '1111', 'lorem bio', 30, 0, 'Toronto', 155 , 'University', 'Barista', 1, 2, 1, true),
('dfasdf Hendrick','[email protected]', '1111', 'lorem bio', 22, 1, 'Vancouver', 145 , 'high school', 'student', 1, 2, 1, true),
('new person','[email protected]', '1111', 'lorem bio', 50, 1, 'Vancouver', 199 , 'high school', 'Plumber', 1, 2, 1, true),
('New User 5','[email protected]', '1111', 'lorem bio', 22, 1, 'Vancouver', 145 , 'high school', 'student', 1, 2, 1, true);


INSERT INTO user_photos (user_id, url, is_profile)
VALUES
(1, 'https://images.genius.com/51f5c16c628a0d96dd7285f7fdf26348.1000x1000x1.jpg', true),
(1, 'https://pbs.twimg.com/media/ENLQQLJVUAATN8a.jpg', false),
(2, 'http://d17zbv0kd7tyek.cloudfront.net/wp-content/uploads/2015/06/leonardo-dicaprio-fb.jpg', true),
(2, 'https://d1jyxxz9imt9yb.cloudfront.net/person/1571/detail_image/mobile/LDC-High-Res-Headshot.jpg', false),
(3, 'https://www.xtrafondos.com/wallpapers/vertical/ana-de-armas-en-photoshoot-5501.jpg', true),
(3, 'https://www.xtrafondos.com/wallpapers/vertical/ana-de-armas-2020-6113.jpg', false),
(3, 'https://images.hola.com/us/images/025b-0ee0dbb57971-3e4d042ce881-1000/vertical-800/ana-de-armas-luciendo-sus-looks-de-cabello-oscuro.jpg', false),
(4, 'https://www.xtrafondos.com/wallpapers/vertical/ana-de-armas-en-photoshoot-5501.jpg', false),
(4, 'https://www.xtrafondos.com/wallpapers/vertical/ana-de-armas-2020-6113.jpg', true),
(4, 'https://images.hola.com/us/images/025b-0ee0dbb57971-3e4d042ce881-1000/vertical-800/ana-de-armas-luciendo-sus-looks-de-cabello-oscuro.jpg', false),
(5, 'https://media.vogue.co.uk/photos/5e81ba5e138bdd00089677d9/2:3/w_2560%2Cc_limit/shutterstock_editorial_10576430d.jpg', true),
(5, 'https://media.glamour.com/photos/617ed8cd81d28bb722b6812b/master/pass/1194078278', false);


INSERT INTO messages (from_user_id, to_user_id, message, message_seen, date_sent)
VALUES
(1, 2, 'hey - seen by id2', true, CURRENT_TIMESTAMP),
(2, 1, 'hey back - seen by id1', true, CURRENT_TIMESTAMP),
(1, 2, 'hey - seen by id2', true, CURRENT_TIMESTAMP),
(2, 1, 'hey - seen by id1', true, CURRENT_TIMESTAMP),
(1, 2, 'hey - seen by id2', true, CURRENT_TIMESTAMP),
(2, 1, 'set seen true', false, CURRENT_TIMESTAMP),

(1, 4, 'hey - seen by id4', true, CURRENT_TIMESTAMP),
(4, 1, 'hey back - seen by id1', true, CURRENT_TIMESTAMP),
(1, 4, 'hey - seen by id4', true, CURRENT_TIMESTAMP),
(4, 1, 'hey - seen by id1', true, CURRENT_TIMESTAMP),
(1, 4, 'read from list, received has not seen', false, CURRENT_TIMESTAMP),

(1, 5, 'hey - seen by id5', true, CURRENT_TIMESTAMP),
(5, 1, 'hey back - seen by id1', true, CURRENT_TIMESTAMP),
(1, 5, 'hey - seen by id5', true, CURRENT_TIMESTAMP),
(5, 1, 'hey - seen by id1', true, CURRENT_TIMESTAMP),
(1, 5, 'hey - seen by id5', true, CURRENT_TIMESTAMP),
(5, 1, 'set seen true', false, CURRENT_TIMESTAMP);


INSERT INTO matchings (from_user_id, to_user_id, like_value, seen, matched_date)
VALUES
(1, 2, true, true, CURRENT_TIMESTAMP),
(2, 1, true, true, CURRENT_TIMESTAMP),
(1, 4, true, true, CURRENT_TIMESTAMP),
(4, 1, true, true, CURRENT_TIMESTAMP),
(1, 5, true, true, CURRENT_TIMESTAMP),
(5, 1, true, true, CURRENT_TIMESTAMP),

(3, 1, true, false, CURRENT_TIMESTAMP);

INSERT INTO genders (value)
VALUES
('Woman'), ('Man'), ('Everyone');

INSERT INTO drinks (value)
VALUES
('Never'), ('Sometimes'), ('Socially'), ('Yes');

INSERT INTO exercises (value)
VALUES
('Never'), ('Sometimes'), ('Often'), ('Everyday');

INSERT INTO dating_goals (value)
VALUES
('Not sure yet'), ('Short-term / Casual'), ('Long-term'), ('Life partner');


INSERT INTO preferences
(user_id, gender_id, drink_id, exercise_id, dating_goal_id)
VALUES
(1, 1, 1, 1, 1),
(2,2,2,2,2),
(3,3,3,3,3),
(4,1,1,1,1);
98 changes: 98 additions & 0 deletions express-back-end/db/schema/01_DB_layout.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
DROP TABLE IF EXISTS users CASCADE;
DROP TABLE IF EXISTS user_photos CASCADE;
DROP TABLE IF EXISTS messages CASCADE;
DROP TABLE IF EXISTS matchings CASCADE;
DROP TABLE IF EXISTS block_users CASCADE;
DROP TABLE IF EXISTS preferences CASCADE;
DROP TABLE IF EXISTS genders CASCADE;
DROP TABLE IF EXISTS drinks CASCADE;
DROP TABLE IF EXISTS exercises CASCADE;
DROP TABLE IF EXISTS dating_goals CASCADE;

SET timezone = 'America/Los_Angeles';

CREATE TABLE users (
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(20) NOT NULL,
bio TEXT NOT NULL,
age INTEGER NOT NULL,
gender_id INTEGER NOT NULL,
location VARCHAR(255) NOT NULL,
height_in_cm INTEGER NOT NULL,
education VARCHAR(255) NOT NULL,
occupation VARCHAR(255) NOT NULL,
drink_id INTEGER NOT NULL,
exercise_id INTEGER NOT NULL,
dating_goal_id INTEGER NOT NULL,
-- {dont know yet, short-term, long-term, life-partner,}
is_active BOOLEAN NOT NULL DEFAULT true
);



CREATE TABLE genders (
id SERIAL PRIMARY KEY NOT NULL,
value TEXT NOT NULL
);

CREATE TABLE drinks (
id SERIAL PRIMARY KEY NOT NULL,
value TEXT NOT NULL
);

CREATE TABLE exercises (
id SERIAL PRIMARY KEY NOT NULL,
value TEXT NOT NULL
);

CREATE TABLE dating_goals (
id SERIAL PRIMARY KEY NOT NULL,
value TEXT NOT NULL
);

CREATE TABLE user_photos (
id SERIAL PRIMARY KEY NOT NULL,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
url TEXT NOT NULL,
is_profile BOOLEAN NOT NULL DEFAULT false
);

CREATE TABLE messages (
id SERIAL PRIMARY KEY NOT NULL,
from_user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
to_user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
message VARCHAR(255) NOT NULL,
message_seen BOOLEAN NOT NULL DEFAULT false,
date_sent TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE matchings (
id SERIAL PRIMARY KEY NOT NULL,
from_user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
to_user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
like_value BOOLEAN DEFAULT NULL,
seen BOOLEAN NOT NULL DEFAULT false,
matched_date TIMESTAMP
);

CREATE TABLE block_users (
id SERIAL PRIMARY KEY NOT NULL,
blocked_by_user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
blocked_user_id INTEGER REFERENCES users(id) ON DELETE CASCADE
);

CREATE TABLE preferences (
id SERIAL PRIMARY KEY NOT NULL,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
min_age INTEGER DEFAULT 18,
max_age INTEGER DEFAULT 80,
location TEXT DEFAULT 'Earth',
min_height_in_cm INTEGER DEFAULT 130,
max_height_in_cm INTEGER DEFAULT 200,
gender_id INTEGER REFERENCES genders(id) ON DELETE CASCADE DEFAULT 1,
drink_id INTEGER REFERENCES drinks(id) ON DELETE CASCADE DEFAULT 1,
exercise_id INTEGER REFERENCES exercises(id) ON DELETE CASCADE DEFAULT 1,
dating_goal_id INTEGER REFERENCES dating_goals(id) ON DELETE CASCADE DEFAULT 1
);
Loading