Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Booking function #8

Open
fkmeland opened this issue Nov 3, 2022 · 21 comments
Open

Booking function #8

fkmeland opened this issue Nov 3, 2022 · 21 comments

Comments

@fkmeland
Copy link

fkmeland commented Nov 3, 2022

image
single-room.zip

Originally posted by @ff12345678 in #7 (comment)

@fkmeland
Copy link
Author

fkmeland commented Nov 3, 2022

A fork that has implemented this and could be used for inspiration:

Originally posted by @ff12345678 in #7 (comment)

@ff12345678
Copy link

ff12345678 commented Nov 3, 2022 via email

@fkmeland
Copy link
Author

fkmeland commented Nov 4, 2022

Hmm... sorry I didn't have much time to work on it yesterday 😅 But, it should mostly work, I tested it briefly, booking, and extend/end/book after should also work.

You will need to grant another permisson to the application in Azure, the permission Calendars.ReadWrite is needed for booking, did you add this permission and grant it? Any errors in the terminal when booking?

@ff12345678
Copy link

ff12345678 commented Nov 4, 2022 via email

@fkmeland
Copy link
Author

fkmeland commented Nov 4, 2022

It's strange that your terminal isn't outputting anything, you are starting it manually in the terminal / command line, or are you starting it via script etc?

Try starting the application with npm run start, it should output some data in the terminal / commandline.
When you click the "Book Now" button it should log:

  • Route Room Booking
  • email-address | displayname | start datetime | end datetime | booking type
  • Response / Error from MSGRAPH

This is a screenshot from my terminal / command line after running npm run start and extending a meeting:
image
As you can see, the response from MSGRAPH is also printed out, any errors should also be displayed.

@ff12345678
Copy link

ff12345678 commented Nov 4, 2022 via email

@fkmeland
Copy link
Author

fkmeland commented Nov 4, 2022

Glad you got it working, the code is messy, and needs more work, and I'm still learning node / javascript, my goto language is golang, which is one of the reason I want to port the node backend to golang, and embed the react-ui inside the golang executable.

It sounds like a good idea, to be able to show a modified flightboard with only available rooms, and perhaps a book now button to be able to book that room from the device/room you are currently at. Shouldn't be too much work to implement this as the elements required for this should already exist in the codebase, just a matter of desiging the react-component and reusing some queries etc, would need to modify the getRooms query to only show available rooms.

I don't think I have any more time to work on it this week, but I wil have a look at it next week.

@ff12345678
Copy link

ff12345678 commented Nov 4, 2022 via email

@ff12345678
Copy link

ff12345678 commented Nov 8, 2022 via email

@fkmeland
Copy link
Author

fkmeland commented Nov 9, 2022

Good morning.

I haven't had any time yet to work on this project, as it has been busy at work, but I might have some time later tonight after gym, if I didn't die at the gym 💪😂, and maybe some time tomorrow as well.

I think I might have a POC ready before the weekend.

The feature you are talking about should be straight forward to implement.
There was no image attached to your reply to illustrate what you where thinking the feature should look like,
it could be that Github doesn't like images in email-replies...

@ff12345678
Copy link

ff12345678 commented Nov 9, 2022 via email

@Axel-Roy
Copy link

Hello, excuse me for cutting your consultation but I currently have an error with the Booking function. It gives me a 401 Unauthorized error when I try to book a room. I have however given all the authorizations to the msgraph account. Can you help me find the problem ?

Captureeer

@fkmeland
Copy link
Author

fkmeland commented Nov 10, 2022

Hi, hmm, it seems like the route /api/roombooking is using the ews api for booking and not the msgraph api.

See the function on line 65 in file app/routes.js

  // books a room
  app.get('/api/roombooking', function (req, res) {
    let api;
    if (config.calendarSearch.useGraphAPI === 'true') {
      api = require('./msgraph/roombooking.js');
    } else {
      api = require('./ews/roombooking.js');
    }

You could remove the if statement and force it to use msgraph.
Also when I read this codeblock, there could be an issue with case-sensitivity when checking the config.calendarSearch.useGraphAPI value.

Did you set SEARCH_USE_GRAPHAPI=true in your .env file? (true in lowercase)

You are using this for o365? I havent worked on implementing the original function for booking through the ews-api, as the only use for this now is on prem exchange-servers, wouldn't take much time to fix, but havent prioritized it yet.

@fkmeland
Copy link
Author

fkmeland commented Nov 10, 2022

I agree, but some people might still use it for old on prem solutions, but then again, the original work from danxfisher should work just fine for them. I think I should just remove it from this fork as you suggest.

@Axel-Roy
Copy link

Thanks for your help, I just changed the route.js file, but I just realized that it is my roombooking.js file that is causing problems, I think there are some changes to make on it or then I have a bad version of it. Do you have the modifications to make or do you have the updated file ?

image

@fkmeland
Copy link
Author

fkmeland commented Nov 10, 2022

What file is this in your screenshot?

You will need the files app/msgraph/roombooking.js and app/msgraph/graph.js from the feat/roombooking branch... or just checkout the entire branch and run as is...

The BookRoom function is located in app/msgraph/graph.js and the function that routes.js calls is located in app/msgraph/roombooking.js

https://github.com/probits-as/MeetEasier/blob/feat/roombooking/app/msgraph/graph.js
https://github.com/probits-as/MeetEasier/blob/feat/roombooking/app/msgraph/roombooking.js
https://github.com/probits-as/MeetEasier/blob/feat/roombooking/app/routes.js

@fkmeland
Copy link
Author

So, status update on the "View available rooms" feature (maybe it should be its own issue 🤔).

I said I would probably have a working POC before the weekend, but I'm sorry to say that I have not been able to work on this yet 😞, hopefully I will get a POC ready next week.

@ff12345678
Copy link

Hello
Thank you for your reply and I look forward to your feedback.
I would really need to have this feature because our offices have many rooms and are far from each other which would allow for better management and visualization.
Once again I would like to thank you for your availability, responses and professionalism.

@fkmeland
Copy link
Author

Just a quick update...
I'm sorry to say I still haven't been able to work on this, hopefully things will quiet down next week.

@Axel-Roy How did it go with your booking issues? (Just curious 😊)

@ff12345678
Copy link

ff12345678 commented Nov 18, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants