HelloMum / COMP47360-Smart-Tourist-Guide

GNU General Public License v2.0
2 stars 0 forks source link

Backend usr mgmt tugrul #145

Closed TugrulGit closed 2 months ago

TugrulGit commented 2 months ago

All tests are passed, no new bugs spotted, below tables needs to be modified

CREATE TABLE itinerary_saved (
    id SERIAL PRIMARY KEY,
    user_id SERIAL NOT NULL,
    start_date DATE NOT NULL,
    end_date DATE NOT NULL,
    FOREIGN KEY (user_id) REFERENCES users(id)
);

CREATE TABLE itinerary_saved_items (
    id SERIAL PRIMARY KEY,
    itinerary_id INTEGER NOT NULL,
    item_id INTEGER,
    event_id UUID,
    is_event BOOLEAN NOT NULL,
    start_time TIMESTAMP NOT NULL,
    end_time TIMESTAMP NOT NULL,
    FOREIGN KEY (itinerary_id) REFERENCES itinerary_saved(id),
    CHECK (
        (is_event = TRUE AND event_id IS NOT NULL AND item_id IS NULL) OR
        (is_event = FALSE AND item_id IS NOT NULL AND event_id IS NULL)
    )
);

After this PR, these functionalities can be added deleting the itinerary (I can integrate if you give me the button to delete) changing password (pass the token, old password, new password) you can fetch the email of user

HelloMum commented 2 months ago

Tested and working, should autoupdate by default.