Issue #39
Small refactoring - extracting code from server.js to db.js and config.js
Added a directory called albums to host all user dedicated directory - for each user a new directory will be created named as his id property from the SQL 'users' table.
Added a SQL Table named 'photos' :
This will create the photos table
CREATE TABLE photos (
id serial PRIMARY KEY,
user_id integer not null,
classification VARCHAR(100),
location VARCHAR(300) not null
);
new file controller\files.js :
createDir function that checks for a User ID if a dedicated directory for him exist (e.g. for user where user id = 5, if there is a directory 'albums\5'), if not exists creates it.
This function used in controller\register.js and controller\profile.js to make sure new and existing users will get a directory.
controller\image.js :
uploadFromUrlHandler function handle a image upload from URL
client side :
myPhotos\src\App.js :
in onPictureSubmit method:
on fetch('http://localhost:3001/imageurl') callback: added id property to req body.
Issue #39 Small refactoring - extracting code from server.js to db.js and config.js Added a directory called albums to host all user dedicated directory - for each user a new directory will be created named as his id property from the SQL 'users' table. Added a SQL Table named 'photos' : This will create the photos table CREATE TABLE photos (
id serial PRIMARY KEY, user_id integer not null, classification VARCHAR(100), location VARCHAR(300) not null );
new file controller\files.js : createDir function that checks for a User ID if a dedicated directory for him exist (e.g. for user where user id = 5, if there is a directory 'albums\5'), if not exists creates it. This function used in controller\register.js and controller\profile.js to make sure new and existing users will get a directory.
controller\image.js : uploadFromUrlHandler function handle a image upload from URL
client side : myPhotos\src\App.js : in onPictureSubmit method: on fetch('http://localhost:3001/imageurl') callback: added id property to req body.