Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Feature: Preferences

sreen020 edited this page Jun 22, 2020 · 6 revisions

Nerdr Banner

While using this dating app you can select your own skill level, occupation and languages you are interested to learn. Other people can find the perfect match because they can adjust the search using preferences. So if you are looking for an amateur back-end developer that writes C and .NET, you can.

This preference page takes the values of the database and select them as default. If you want to adjust these values just select a new one and press the “change” button. The new values will be updated in the database and after this you can search the perfect match.

Database structure preferences
preferences: {
skillLevel: String,
occupation: String,
languages: [],
},

Code
const prefSkill = req.body.skillLevel;
const prefOccupation = req.body.prefOccupation;
const prefLanguages = req.body.prefLanguages;

// preferences
if (prefSkill != undefined) {
buildBlock.preferences.skillLevel = prefSkill;
} else {
buildBlock.preferences.skillLevel = req.session.user.preferences.skillLevel;
}

if (prefOccupation != undefined) {
buildBlock.preferences.occupation = prefOccupation;
} else {
buildBlock.preferences.occupation = req.session.user.preferences.occupation;
}

if (prefLanguages != undefined) {
buildBlock.preferences.languages = prefLanguages;
} else {
buildBlock.preferences.languages = req.session.user.preferences.languages;
}