TechnionYP5779 / team1

Git repo of team 1 of the yearly project technion CS
6 stars 3 forks source link

Offer new parking spot #192

Closed ofiralexi closed 5 years ago

ofiralexi commented 5 years ago

Description: the user should be able to offer a new parking spot for other users to order.

YarinSh commented 5 years ago

Which technology you guys want to use for the server-side scripting (Sending the data inputted to the database) PHP or Node.js?

yoavz1997 commented 5 years ago

If think for now, maybe just using JavaScript for the server side as well could be an idea since we are trying to abort this project.

YarinSh commented 5 years ago

Ok tried to use the ACCESSDB library but it does not seem to work, so Javascript is not usable to do the sever-side scripting, hence I used PHP as it is less complex.

To run the website XAMPP needs to be installed, and the Apache and MySQL server enabled in its control panel. Also the website files need to be in the htdocs folder in the XAMPP directory. More on this here.

The users table: CREATE TABLE users ( username varchar(20) COLLATE utf8_unicode_ci NOT NULL, email varchar(100) COLLATE utf8_unicode_ci NOT NULL, password varchar(20) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (username), UNIQUE KEY email(email) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

And the parking spots table:

CREATE TABLE parkingspots ( id int(11) NOT NULL AUTO_INCREMENT, username varchar(20) NOT NULL, location varchar(500) NOT NULL, price int(11) NOT NULL, boughtBy varchar(20) NOT NULL DEFAULT 'none', PRIMARY KEY (id), FOREIGN KEY (username) REFERENCES users(username) ON DELETE CASCADE) AUTO_INCREMENT=0

yoavz1997 commented 5 years ago

Why is the username in parking spots, a key?

YarinSh commented 5 years ago

Because it was a weird way to set up username as a foreign key in the Apache GUI, you can just use the FOREIGN KEY REFERENCES and of course add constraints(which I was not able to do int the GUI) accordingly on price, although the JavaScript does not allow to enter negative prices for examples.

yoavz1997 commented 5 years ago

I meant a single user can purchase multiple parking spots and own multiple parking spots. Moreover, I don't see the column for the username who purchased the parking spot

YarinSh commented 5 years ago

Yes it can still happen, a user can own multiple parking spots because the primary key is the id.

Oh, and no there is no username who purchased but can easily be added, I just did not need this column for my features, and it is not mentioned in the wiki about this columns, I though we would use Transactions for this, but I guess we can just update who bought it instead via the new column.

yoavz1997 commented 5 years ago

As I wrote in #188 for the current sprint we do not use transactions. This column is temporary and will help you filter the unavailable parking spots, otherwise, how would you know?

YarinSh commented 5 years ago

Ok will add the new column and the filtering right away.

yoavz1997 commented 5 years ago

Closed after #211 merged