')
@cross_origin()
-def all_users():
- response_object = {'status': 'success'}
+def check_code(code):
+ response_object = {}
+
+ if mongo.db.users.find_one({"username": code}) is not None:
+ response_object['message'] = 'OK'
+
+ else:
+ response_object['message'] = 'NOT FOUND'
+
+ return jsonify(response_object)
+
+
+def get_users(users):
query = []
- for user in mongo.db.users.find():
+ for user in users:
del user['password']
- del user['_id']
query.append(user)
- response_object['users'] = query
+ return query
+
+
+@app.route("/", methods=['GET', 'POST'])
+@cross_origin()
+def all_users():
+ response_object = {}
+
+ if request.method == 'GET':
+ response_object['users'] = get_users(mongo.db.users.find())
+ elif request.method == 'POST':
+ post_data = request.get_json()
+ search_filter = post_data.get('filter')
+ response_object['users'] = get_users(mongo.db.users.find(search_filter))
+
return jsonify(response_object)
@@ -146,7 +163,15 @@ def save_image(filename):
}
})
- return jsonify({'status': 'success'})
+
+@app.route("/prime/", methods=["PUT"])
+@cross_origin()
+def prime_user(user_id):
+ mongo.db.users.update_one({"_id": user_id}, {
+ '$set': {
+ 'type': 'premium'
+ }
+ })
if __name__ == '__main__':
diff --git a/client/public/index.html b/client/public/index.html
index 748a164..418b37c 100644
--- a/client/public/index.html
+++ b/client/public/index.html
@@ -1,19 +1,54 @@
-
+
+
+
+
+
-
-
- Tinder Clone
+
+ MatchBox
-
+
+
+
+
+
diff --git a/client/public/matchbox.ico b/client/public/matchbox.ico
new file mode 100644
index 0000000..131e4c5
Binary files /dev/null and b/client/public/matchbox.ico differ
diff --git a/client/src/App.vue b/client/src/App.vue
index 5f555d9..717ae75 100644
--- a/client/src/App.vue
+++ b/client/src/App.vue
@@ -1,14 +1,16 @@
- Tinder Clone mark 1
+ MatchBox
Hello {{ this.$session.get('user')['username'] }}
@@ -34,11 +36,13 @@ export default {
diff --git a/client/src/components/Account.vue b/client/src/components/Account.vue
index df8c48f..8556305 100644
--- a/client/src/components/Account.vue
+++ b/client/src/components/Account.vue
@@ -1,13 +1,19 @@
-
-
+
+
+
+
@@ -57,7 +63,6 @@
-
-
+
-
-
-
-
-
-
-
-
-
- smoke?
-
- drink?
-
- have children?
-
-
-
+
+
Submit Changes
@@ -158,6 +119,7 @@
import axios from 'axios'
import UserDetails from "@/components/UserDetails";
import Alert from '@/components/Alert.vue'
+import Photo from '@/components/Photo.vue'
export default {
name: "Account",
@@ -195,12 +157,7 @@ export default {
height: this.userForm.height,
hair_colour: this.userForm.hair_colour,
eye_colour: this.userForm.eye_colour,
- sexual_orientation: this.userForm.sexual_orientation,
- education: this.userForm.education,
- smoker: this.userForm.smoker,
- drinker: this.userForm.drinker,
- children: this.userForm.children,
- status: this.userForm.status
+ bio: this.userForm.bio
}
axios.put(this.path, payload).then((res) => {
@@ -230,22 +187,31 @@ export default {
submitFile() {
let formData = new FormData()
-
formData.append('photo', this.file)
formData.append('user', this.$session.get('user')['username'])
-
const path = `http://localhost:5000/img/${this.file.name}`
console.log(path)
axios.post(path, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
- }).then(() => console.log("Success!")).catch((error) => console.error(error))
+ }).then(() => console.log("EZ")).catch((error) => console.error(error))
+ window.location.replace("settings?uploaded=1");
}
},
created() {
this.getUserInfo()
+ if (this.$route.query.uploaded == 1) {
+ setTimeout(function () {
+ window.location.replace("settings");
+ }, 3000);
+ }
+ if (this.$route.query.primePaid == 1) {
+ setTimeout(function () {
+ window.location.replace("settings");
+ }, 100);
+ }
}
}
\ No newline at end of file
diff --git a/client/src/components/Contact.vue b/client/src/components/Contact.vue
new file mode 100644
index 0000000..556f4d5
--- /dev/null
+++ b/client/src/components/Contact.vue
@@ -0,0 +1,80 @@
+
+
+ HELLO WORLD
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/src/components/Login.vue b/client/src/components/Login.vue
index b875e0e..4a1f14e 100644
--- a/client/src/components/Login.vue
+++ b/client/src/components/Login.vue
@@ -3,22 +3,25 @@
Welcome back!
-
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
New here?
Submit
@@ -182,7 +236,7 @@ export default {
evt.preventDefault()
this.$refs.registerModal.hide()
- if (//calculate_age(this.registerForm.birthday) > 17 &&
+ if (calculate_age(new Date(this.registerForm.birthday)) > 17 &&
this.registerForm.password === this.registerForm.repeatPwd) {
const payload = {
email: this.registerForm.email,
@@ -190,7 +244,13 @@ export default {
name: this.registerForm.name,
surname: this.registerForm.surname,
password: this.registerForm.password,
- birthday: this.registerForm.birthday
+ birthday: this.registerForm.birthday,
+ gender: this.registerForm.gender,
+ weight: this.registerForm.weight,
+ height: this.registerForm.height,
+ hair_colour: this.registerForm.hair_colour,
+ eye_colour: this.registerForm.eye_colour,
+ bio: this.registerForm.bio
}
this.signup(payload)
diff --git a/client/src/components/Paypal.vue b/client/src/components/Paypal.vue
new file mode 100644
index 0000000..b0b578a
--- /dev/null
+++ b/client/src/components/Paypal.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/src/components/Photo.vue b/client/src/components/Photo.vue
index 13e2c95..a918e7e 100644
--- a/client/src/components/Photo.vue
+++ b/client/src/components/Photo.vue
@@ -1,9 +1,12 @@
-
-
-
+
+
-
-
-
\ No newline at end of file
diff --git a/client/src/components/Prime.vue b/client/src/components/Prime.vue
index 41e9fd8..b464a5e 100644
--- a/client/src/components/Prime.vue
+++ b/client/src/components/Prime.vue
@@ -1,30 +1,72 @@
- Plan
-
-
-
+
+
+ Plan
+ 1 year plan: {{ price }}€
+
+
+
+
+
+
+ Your referral: {{ this.$session.get('user').username }}
+ Give your friends your referral code and they'll get 50% off their prime membership!
+
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/client/src/components/Profile.vue b/client/src/components/Profile.vue
new file mode 100644
index 0000000..f5720e8
--- /dev/null
+++ b/client/src/components/Profile.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/src/components/UserDetails.vue b/client/src/components/UserDetails.vue
index eb4a85c..3689dbc 100644
--- a/client/src/components/UserDetails.vue
+++ b/client/src/components/UserDetails.vue
@@ -1,23 +1,38 @@
-
- User Details
-
- Username: {{ user.username }}
- Name: {{ user.name }}
- Surname: {{ user.surname }}
- Age: {{ age }}
- Birthday: {{ user.birthday }}
- Bio: {{ user.bio }}
- Gender: {{ user.gender }}
- Weight: {{ user.weight }}kg
- Height: {{ user.height }}m
- Eye colour: {{ user.eye_colour }}
- Sexual orientation: {{ user.sexual_orientation }}
- Education: {{ user.education }}
- Smokes
- Drinks
- Has children
- Status: {{ user.status }}
+
+
+
+
+
+
+
+
+
+ {{ age }} years old
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -40,8 +55,22 @@ export default {
props: ['user'],
+ methods: {
+ goToProfile(user) {
+ this.$router.push(`/profile/${user._id}`)
+ // window.location.replace("/profile/" + user.id);
+ }
+ },
+
created() {
this.age = calculate_age(new Date(this.user.birthday))
+ },
+ updated() {
+ this.age = calculate_age(new Date(this.user.birthday))
+ },
+ mounted() {
+ this.age = calculate_age(new Date(this.user.birthday))
}
}
-
\ No newline at end of file
+
+
diff --git a/client/src/components/Users.vue b/client/src/components/Users.vue
index 767643e..b4bfa5e 100644
--- a/client/src/components/Users.vue
+++ b/client/src/components/Users.vue
@@ -1,15 +1,79 @@
+
+
Recommended Matches
-
- -
-
-
-
+
+
+
+
+
+
+
+
@@ -17,7 +81,7 @@
import axios from 'axios'
import Alert from './Alert.vue'
import UserDetails from "@/components/UserDetails";
-import {calculate_age} from '@/ts/lib'
+import $ from 'jquery'
export default {
name: "Index",
@@ -38,14 +102,143 @@ export default {
components: {
Alert,
- UserDetails
+ UserDetails,
},
methods: {
getUsers() {
axios.get(this.path).then((res) => {
+ if (this.$session.get('user').type === 'free') {
+ for (let i = 0; i < 3; i++) {
+ this.users.push({
+ id: res.data.users[i]._id,
+ pfp: res.data.users[i].pfp,
+ username: res.data.users[i].username,
+ email: res.data.users[i].email,
+ name: res.data.users[i].name,
+ surname: res.data.users[i].surname,
+ birthday: res.data.users[i].birthday,
+ bio: res.data.users[i].bio,
+ gender: res.data.users[i].gender,
+ weight: res.data.users[i].weight,
+ height: res.data.users[i].height,
+ eye_colour: res.data.users[i].eye_colour,
+ hair_colour: res.data.users[i].hair_colour
+ })
+ }
+ } else {
+ res.data.users.forEach(user => {
+ this.users.push({
+ id: user._id,
+ pfp: user.pfp,
+ username: user.username,
+ email: user.email,
+ name: user.name,
+ surname: user.surname,
+ birthday: user.birthday,
+ bio: user.bio,
+ gender: user.gender,
+ weight: user.weight,
+ height: user.height,
+ eye_colour: user.eye_colour,
+ hair_colour: user.hair_colour
+ })
+ })
+ }
+ }
+ )
+ },
+
+ filterSearch(evt) {
+ evt.preventDefault()
+ let min_weight = $('#text_box_weight_minimum').val()
+ let max_weight = $('#text_box_weight_maximum').val()
+ let min_height = $('#text_box_height_minimum').val()
+ let max_height = $('#text_box_height_maximum').val()
+ let blue_eyes_option = $('#blue_eye_checkbox').is(':checked')
+ let brown_eyes_option = $('#brown_eye_checkbox').is(':checked')
+ let green_eyes_option = $('#green_eye_checkbox').is(':checked')
+ let dark_hair_option = $('#dark_hair_checkbox').is(':checked')
+ let blonde_hair_option = $('#blonde_hair_checkbox').is(':checked')
+ let ginger_hair_option = $('#ginger_hair_checkbox').is(':checked')
+
+ min_weight = (min_weight !== '') ? min_weight : null
+ max_weight = (max_weight !== '') ? max_weight : null
+ min_height = (min_height !== '') ? min_height : null
+ max_height = (max_height !== '') ? max_height : null
+ blue_eyes_option = blue_eyes_option ? "Blue" : null
+ brown_eyes_option = brown_eyes_option ? "Brown" : null
+ green_eyes_option = green_eyes_option ? "Green" : null
+ dark_hair_option = dark_hair_option ? "Dark" : null
+ blonde_hair_option = blonde_hair_option ? "Blonde" : null
+ ginger_hair_option = ginger_hair_option ? "Ginger" : null
+
+ let query = '{'
+ let add_comma = false
+ if (min_weight != null || max_weight != null) {
+ query = query.concat('"weight": {')
+ add_comma = true
+ query = (min_weight != null) ? query.concat(`"$gte": ${min_weight}`) : query
+ query = (max_weight != null) ? query.concat(`${(min_weight != null) ? ',' : ''}"$lte": ${max_weight}`) : query
+ query = query.concat('}')
+ }
+
+ if (min_height != null || max_height != null) {
+ if (add_comma)
+ query = query.concat(',')
+ else
+ add_comma = true
+
+ query = query.concat('"height": {')
+ query = (min_height != null) ? query.concat(`"$gte": ${min_height}`) : query
+ query = (max_height != null) ? query.concat(`${(min_height != null) ? ',' : ''}"$lte": ${max_height}`) : query
+ query = query.concat('}')
+ }
+
+ if (blue_eyes_option != null || brown_eyes_option != null || green_eyes_option != null) {
+ if (add_comma)
+ query = query.concat(',')
+ else
+ add_comma = true
+
+ query = query.concat('"eye_colour": {"$in": [')
+ query = (blue_eyes_option != null) ? query.concat(`"${blue_eyes_option}"`) : query
+ query = (brown_eyes_option != null) ? query.concat(`${(blue_eyes_option != null) ? ',' : ''}` +
+ `"${brown_eyes_option}"`) : query
+ query = (green_eyes_option != null) ? query.concat(
+ `${(blue_eyes_option != null) ? ',' : (brown_eyes_option != null) ? ',' : ''}` +
+ `"${green_eyes_option}"`) : query
+ query = query.concat(']}')
+ }
+
+ if (dark_hair_option != null || blonde_hair_option != null || ginger_hair_option != null) {
+ if (add_comma)
+ query = query.concat(',')
+ else
+ add_comma = true
+
+ query = query.concat('"hair_colour": {"$in": [')
+ query = (dark_hair_option != null) ? query.concat(`"${dark_hair_option}"`) : query
+ query = (blonde_hair_option != null) ? query.concat(`${(dark_hair_option != null) ? ',' : ''}` +
+ `"${blonde_hair_option}"`) : query
+ query = (ginger_hair_option != null) ? query.concat(
+ `${(dark_hair_option != null) ? ',' : (blonde_hair_option != null) ? ',' : ''}` +
+ `"${ginger_hair_option}"`) : query
+ query = query.concat(']}')
+ }
+ query = query.concat('}')
+
+ const payload = {
+ filter: JSON.parse(query),
+ prime: this.$session.get('user').type !== "free"
+ }
+
+ axios.post(this.path, payload).then((res) => {
+ console.log(this.users)
+ this.users = []
res.data.users.forEach(user => {
this.users.push({
+ id: user._id,
pfp: user.pfp,
username: user.username,
email: user.email,
@@ -57,12 +250,7 @@ export default {
weight: user.weight,
height: user.height,
eye_colour: user.eye_colour,
- sexual_orientation: user.sexual_orientation,
- education: user.education,
- smoker: user.smoker,
- drinker: user.drinker,
- children: user.children,
- status: user.status,
+ hair_colour: user.hair_colour
})
})
})
@@ -76,5 +264,4 @@ export default {
\ No newline at end of file
diff --git a/client/src/router/index.ts b/client/src/router/index.ts
index 43258f5..dc3079c 100644
--- a/client/src/router/index.ts
+++ b/client/src/router/index.ts
@@ -1,9 +1,12 @@
import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
-import Account from '../components/Account.vue'
-import Login from '../components/Login.vue'
-import Prime from '../components/Prime.vue'
-import Users from '../components/Users.vue'
+import Account from '@/components/Account.vue'
+import Login from '@/components/Login.vue'
+import Prime from '@/components/Prime.vue'
+import Users from '@/components/Users.vue'
+import Profile from '@/components/Profile.vue'
+import Contact from '@/components/Contact.vue'
+import Paypal from '@/components/Paypal.vue'
Vue.use(VueRouter)
@@ -27,6 +30,21 @@ const routes: Array = [
path: '/prime',
name: 'Prime',
component: Prime
+ },
+ {
+ path: '/profile/:id',
+ name: 'Profile',
+ component: Profile
+ },
+ {
+ path: '/contact/:id',
+ name: 'Contact',
+ component: Contact
+ },
+ {
+ path: '/paypal',
+ name: 'Paypal',
+ component: Paypal
}
]
diff --git a/db/init-db.d/seed.js b/db/init-db.d/seed.js
index 7874f74..8a7bf3a 100644
--- a/db/init-db.d/seed.js
+++ b/db/init-db.d/seed.js
@@ -2,26 +2,172 @@ db.users.drop();
db.users.insertMany([
{
_id: 'da3916f299434734b3ac4014a13d231e',
- email: 'foo@email.com',
- username: "foo",
- name: "foo",
- surname: "bar",
- password: 'bar',
+ email: 'giga.chad@hotmale.com',
+ username: "giga.chad",
+ name: "Giga",
+ surname: "Chad",
+ password: '123',
birthday: "1970-01-01",
gender: "Male",
- weight: '80',
- height: '1.75',
- hair_colour: 'black',
- eye_colour: 'blue',
- sexual_orientation: "Heterosexual",
- education: "University",
- smoker: false,
- drinker: false,
- children: false,
- status: "Student",
- bio: "bio here",
+ weight: 100,
+ height: 220,
+ hair_colour: 'Dark',
+ eye_colour: 'Blue',
+ bio: "I am chad",
pfp: "default.jpg",
- photos: "path",
type: "premium"
+ },
+ {
+ _id: '2bb7bbf7e3174bdba8b26fc13f8f90c3',
+ email: 'bog@hotmale.com',
+ username: 'bog',
+ name: 'Igor',
+ surname: 'Bogdanoff',
+ password: '123',
+ birthday: "1949-08-29",
+ gender: "Male",
+ weight: 85,
+ height: 180,
+ hair_colour: 'Ginger',
+ eye_colour: 'Brown',
+ bio: 'I invest in cryptocurrency',
+ pfp: "default.jpg",
+ type: "free"
+ },
+ {
+ _id: '82210c12f80b4532b1bc8e0d2ae2f163',
+ email: 'harold@yahoo.com',
+ username: 'harold',
+ name: 'Harold',
+ surname: 'Harold',
+ password: '123',
+ birthday: '1945-07-11',
+ gender: "Male",
+ weight: 70,
+ height: 170,
+ hair_colour: 'Dark',
+ eye_colour: 'Blue',
+ bio: 'Feel the pain',
+ pfp: "default.jpg",
+ type: "free"
+ },
+ {
+ _id: '927fbcc9d7a8464c909da9b9e1117bb9',
+ email: 'karolidis@uniwa.gr',
+ username: 'karolidis',
+ name: 'Dimitrios',
+ surname: 'Karolidis',
+ password: '123',
+ birthday: '1970-01-01',
+ gender: 'Male',
+ weight: 80,
+ height: 190,
+ hair_colour: 'Dark',
+ eye_colour: 'Green',
+ bio: 'The best professor in ICE UNIWA',
+ pfp: "default.jpg",
+ type: 'free'
+ },
+ {
+ _id: '6c3239dc59814111b60098393bf22cf6',
+ email: 'mia@gmail.com',
+ username: 'mia',
+ name: 'Mia',
+ surname: 'Wallace',
+ password: '123',
+ birthday: '2000-05-29',
+ gender: 'Female',
+ weight: 65,
+ height: 170,
+ hair_colour: 'Dark',
+ eye_colour: 'Blue',
+ bio: 'Why do we feel the need to yak about bs?',
+ pfp: 'default.jpg',
+ type: 'free'
+ },
+ {
+ _id: 'c79932cbc58c4f8bbf1e49a4ac224250',
+ email: 'the.bride@bill.com',
+ username: 'the.bride',
+ name: 'Beatrix',
+ surname: 'Kiddo',
+ password: '123',
+ birthday: '1980-06-21',
+ gender: 'Female',
+ weight: 65,
+ height: 170,
+ hair_colour: 'Blonde',
+ eye_colour: 'Blue',
+ bio: 'It\'s Mercy, Compassion And Forgiveness I Lack. Not Rationality!',
+ pfp: 'default.jpg',
+ type: 'free'
+ },
+ {
+ _id: '0efd901283714e59ad729dc66d80e670',
+ email: 'jules@hotmale.com',
+ username: 'jules',
+ name: 'Jules',
+ surname: 'Winnfield',
+ password: '123',
+ birthday: '1970-05-12',
+ gender: 'Male',
+ weight: 75,
+ height: 200,
+ hair_colour: 'Dark',
+ eye_colour: 'Brown',
+ bio: 'Royale with Cheese',
+ pfp: 'default.jpg',
+ type: 'free'
+ },
+ {
+ _id: '53511fe0da8e43cb89e4dfec511d2cf9',
+ email: 'andriana@soprano.com',
+ username: 'andriana',
+ name: 'Adriana',
+ surname: 'La Cerva',
+ password: '123',
+ birthday: '1990-12-10',
+ gender: 'Female',
+ weight: 60,
+ height: 175,
+ hair_colour: 'Blonde',
+ eye_colour: 'Brown',
+ bio: 'ig: andriana_la_cerva',
+ pfp: 'default.jpg',
+ type: 'free'
+ },
+ {
+ _id: 'a6f87bad71ff4b6fb679775555a1225c',
+ email: 'scarlett@hotmail.com',
+ username: 'scarlett',
+ name: 'Scarlett',
+ surname: 'Johnanson',
+ password: '123',
+ birthday: '1984-11-22',
+ gender: 'Female',
+ weight: 70,
+ height: 180,
+ hair_colour: 'Blonde',
+ eye_colour: 'Green',
+ bio: 'Natasha Romanov in the Avengers',
+ pfp: 'default.jpg',
+ type: 'free'
+ },
+ {
+ _id: 'cf6993a1b4244d918de943c281732919',
+ email: 'margot@hotmail.com',
+ username: 'margot',
+ name: 'Margot',
+ surname: 'Robbie',
+ password: '123',
+ birthday: '1990-07-02',
+ gender: 'Female',
+ weight: 65,
+ height: 170,
+ hair_colour: 'Blonde',
+ eye_colour: 'Blue',
+ bio: 'Harley Quinn',
+ pfp: 'default.jpg',
+ type: 'free'
}
]);
\ No newline at end of file
diff --git a/img/filters.png b/img/filters.png
new file mode 100644
index 0000000..c32129c
Binary files /dev/null and b/img/filters.png differ
diff --git a/img/free_users.png b/img/free_users.png
new file mode 100644
index 0000000..0040305
Binary files /dev/null and b/img/free_users.png differ
diff --git a/img/premium_users.png b/img/premium_users.png
new file mode 100644
index 0000000..2520063
Binary files /dev/null and b/img/premium_users.png differ