LibreBooking / app

Repository for the last open source version of Booked Scheduler. The "develop" branch contains the most current working code of the project and should be considered beta. The "master" branch is the most current stable release of BookedScheduler. Please read doc/README.md for further details.
GNU General Public License v3.0
383 stars 226 forks source link

Creating Booking error #118

Open sarnison opened 2 years ago

sarnison commented 2 years ago

Adding a reservation '{"description":"reservation description","startDateTime":"2022-06-01T08:00:00","endDateTime":"2022-06-01T17:00:00","resources":[2,3],"invitees":["michael@test.com","bible@test.com"],"resourceId":1,"title":"Reserving the gear","userId":1}'

SLIM throws error all the time for adding a user_id with Foreign Key constraint

There was an error executing your query\nCannot add or update a child row: a foreign key constraint fails (librebooking.reservation_users, CONSTRAINT reservation_users_ibfk_2 FOREIGN KEY (user_id) REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE)

from the logs it is trying to add user_id with value 0 just after it adds reservation instance 147 with user ID = 3 , which works

2022-05-31T21:37:47+01:00 [122398] DEBUG sql - [User= ()] MySql Execute: INSERT INTO reservation_users (reservation_instance_id, user_id, reservation_user_level) VALUES ('147', '0', '3'); Fails

sarnison commented 2 years ago

Resolved - Issue is that I needed to specify UserIDs for the invitees not email addresses, and they needed to exist in the DB