chenbachar / daycare Goto Github PK
View Code? Open in Web Editor NEWFinal Project
Final Project
all API routes will go through /api
therefore the route will be: http://serverIP:serverPORT/api
for 'Routes' use: #26
Updates from Nanny - Fix second help picture (Problem: Text isn't visible enough!)
Maybe change text color...
list
and from contact_list
fieldsContact list should have more fields such as:
Daycare
• name
– name of the daycare
• phone
– daycare's phone number
• address
– daycare's location (address)
User
• password
– nanny password
• name
– nanny's name
• phone
– nanny's phone
• userID
– nanny's id
The registration also create a new user for the nanny
uid
– unique id for the daycare. (will be generated automatically in the server).DB will be created using 'mongodb' and 'mongoose'.
/* login credentials: */
userID: {type: String, required: true },
hashed_password: {type: String, required: true}, // hashed_password = the password after using digestion
salt: {type: String, required: true}, // salt = random string; added to the password when digestion happens
/* Personal details */
profile_picture: {type: String, trim: true},
name: {type: String, required: true},
birthdate: {type: Date, required: true},
father_name: {type: String, required: true},
mother_name: {type: String, required: true},
phone_numbers : [
{
parent: String,
phone: Number
}
],
address: String,
/* Matching between a user and his daycare */
daycareID: String,
/* Permissions */
permissionLevel: { type: Number, required: true }, //permissionLevel is a must! Determines who's the user (Nanny or Parents)
/* Logging */
created_at: {type: Date, default: Date.now()},
last_login: {type: Date, default: Date.now()}
name: {type: String, required: true}, // name = name of the daycare
uid: {type: Number, unique: true, required: true}, // uid = unique id for each daycare
phone: {type: Number, required: true}, // phone = phone number of the daycare
address: {type: String, required: true}, // address = daycare's city and address
pictures: [{type: String}], // pictures = Array of URL links to pictures
videos: [{type: String}], // videos = Array of URL links to videos
created_at: {type: Date, required: true, default: Date.now()}, // created_at = Date the daycare (model) created
list: [{type: Schema.Types.ObjectId, ref: 'User'}], // list = list of all users (kids) in the daycare
global_messages: [ // global_messages = Messages from the daycare / nanny.
{
message: {type: String, trim: true},
date: {type: Date, default: Date.now()}
}
],
events: [ // events = Calendar events.
{
title: {type: String, trim: true, required: true},
date: {type: Date, default: Date.now()},
content: {type: String, trim: true},
event_type: {type: String, trim: true} //event_type = birthday, party, day-off...
}
],
classes: [
{
title: {type: String, trim: true, required: true},
info: {type: String, trim: true, required: true},
picture_url: {type: String, trim: true}
}
],
contact_list: [
{
user: {type: Schema.Types.ObjectId, ref: 'User'},
name: {type: String}, //name = name of the kid
profile_picture: {type: String},
phone_numbers: [
{
parent: String, //parent = 'Mother' or 'Father'
phone: Number
}
],
father_name: {type: String},
mother_name: {type: String}
}
]
Date is not showing properly!!
Date.now()
is not giving the right time! for some reason the time is not advancing!!
GridView should be replaced with RecyclerView for better performance.
Consider removing animations.
Route definition takes the following structure:
app.METHOD(PATH, HANDLER)
Where:
The following examples illustrate defining simple routes.
Respond with Hello World! on the homepage:
app.get('/', function (req, res) { res.send('Hello World!'); });
Respond to POST request on the root route (/), the application’s home page:
app.post('/', function (req, res) { res.send('Got a POST request'); });
Respond to a PUT request to the /user route:
app.put('/user', function (req, res) { res.send('Got a PUT request at /user'); });
Respond to a DELETE request to the /user route:
app.delete('/user', function (req, res) { res.send('Got a DELETE request at /user'); });
Reference: http://expressjs.com/en/starter/basic-routing.html
Add: static final String TAG_NAME = " tag "
"salt" is a random string used to improve security.
The general workflow for account registration and authentication in a hash-based account system is as follows:
And in details:
To Store a Password:
Example:
var crypto = require('crypto');
var rand = require('csprng');
var x = email;
var temp =rand(160, 36);
var newpass = temp + password;
var token = crypto.createHash('sha512').update(email +rand).digest("hex");
var hashed_password = crypto.createHash('sha512').update(newpass).digest("hex");
To Validate a Password:
ALWAYS HASH IN THE SERVER -- NEVER HASH IN CLIENT!
Salt should be different and unique for every user
Reference: Salted Password Hashing - Doing it Right
Mongoose is a Node.js library that provides MongoDB object mapping similar to ORM (Object-relational mapping) with a familiar interface within Node.js
DB Structure: Issue #29
Change main activity background to be more visible and distract less; Emphasize the buttons more than background.
check for security while using API. ( at "middleware"? )
consider generating some sort of an API_KEY. (auth?)
Note - Route will be: ip:port/registration
getNannyUpdates
function to get new updatesremoveNannyUpdates
function to delete an update (Used by Nanny
only)AddNannyUpdates
function to add a new update (Used by Nanny
only)getClasses
function to get the daycare's classesaddNewClass
function to add a new class (Used by Nanny
only)removeClass
function to delete a class from daycare (Used by Nanny
only)Login
functionUser
class to save all the data.getEvents
function to receive all daycare's eventsremoveEvent
function to delete a specific event from the daycare (Used by Nanny
only)addEvent
function to add new events to the daycare (Used by Nanny
only)getMedia
function to receive all daycare's mediaremoveMedia
function to delete a specific media from the daycare (Used by Nanny
only)addMedia
function to add new media (url) to the daycare (Used by Nanny
only)getPrivateMessages
functionremovePrivateMessages
functionaddPrivateMessages
functionregister
functionA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.