SambaPOS 5.1.60 Release

Found another little thing im stuck on.
How do i get the Order Tag Groups and the tags inside each group?

So at the moment, i need to figure out:
• How to Get Order Tag Groups
• How to get all the order tags with their prices within each group.
• How to edit an entity
• How to add these order tags with prices to the ticket.

ok so im trying to test this query but it seems to fail:

mutation m{addTicket(
ticket:{ticketType:“Ticket”,
department:“Restaurant”,
user:“Administrator”,
terminal:“Server”,
entities:[{entityType:“Customers”,name:“5555555555”}],
states:[{stateName:“Status”,state:“Unpaid”},{stateName:“Delivery”,state:“Waiting”}],
orders:[
{name:“Rosmarino”,quantity:1,price:120,states:[{stateName:“Status”,state:“New”}]}
]
}){id}}

Error Message says: Menu Item not found

But it definitely exists. Copied directly from the data that came through on getMenuItems()
Tried other products first, suspected space or something to be the issue so took the item without a space in the name… But that doesn’t seem to be the issue.

I tried to check with the Docs section on top right, and it had the options for ‘id’ and ‘uid’ for orders.
So i also tried adding ‘id’ but that just gave me error as invalid argument.
None of my products have more than one Portion type.

Ok this one i solved, but i realise i got another issue actually.

The product name had numbers in it that got filtered out.
solved that by using:

var query = ‘{items:getMenuItems(menu:“Menu”,category:"’+category.name+’"){id,product{name,price}}}’;

So that works!

all i got left now is how to query the Order Tags to be able to add the tags into the order.

And of course, how to edit an entity.

whoa! This would be good!

I’m currently in talks with my brother about creating an App for my business which will give them a login and password, they’ll get their membership number added to the app on login and various other perks… getting info from the till would be pretty sick…

You can get idea of some advanced gql use here. This is a proof of concept project we have going with beta team. This only works with current beta as it required gql features not released yet but you can get idea by looking at source.

2 Likes

I got as far as here:

run npm install command under project folder to install libraries.

I take it I’m not doing that in GitHub?

You install node first then you do that from command prompt

1 Like

ahhh yes that works better. Says cant find file though, probably installed that into a GitHub folder of somesort let me look

Hi, is it possible to extend the GraphQL functions? I am thinking about making some modifications to the DB, and I’m looking for a way to enable access to new tables/fields via GraphQL. For example, if I add a new “feedback” column to the tickets table, I’m hoping to extend the Tickets schema to expose a “feedback” string property. Thanks!

No, not for you and I. Emre and the Dev Team will decide which Queries and Mutations are added to GraphQL as it pertains to SambaPOS. You cannot extend it yourself.

Don’t do that. There is no good reason to do so.

That is not the purpose of GQL. GraphQL, though a Query Language, is not generally used for DB manipulation. Currently, there is no GQL Queries or Mutations available to directly access the SambaPOS DB. While some queries may come to be, they will almost certainly never be capable of altering the DB schema.

There is no reason to add a Feedback column to the Tickets Table. Use a Ticket Tag instead.

2 Likes

Ok, thank you for your anwsers QMcKay! I’ll give Ticket Tags a look.

When I edit a Ticket’s tag via graphql, is there a way to trigger a UI refresh if I am currently viewing the ticket in the POS? It seems that I have to close the ticket view and then reopen it to see the tags updated. Thanks!

Why are you using GraphQL to do that? You should use Update Ticket Tag action and a Display Ticket action with Ticket ID set to 0

GraphQL is useful for things like web based Client for mobile orders. We have tools in SambaPOS for doing most automation.

I’m actually working on a custom web app that uses the ticket tags to store additional ticket data. The web app integrates with a number of other non-samba related services, so I prefer to not implement it natively within Samba. Thanks!

Hmm I think you should start a new thread and be sure and share any information like that so we can focus our help. Its hard to know what your trying to do sometimes if you dont explain that.

This is strange:

mutation m { executePrintJob(name: “Orders to Kitchen”, ticketId: 3740, orderStateFilters: [{stateName: “Status”, state: “New”}], nextOrderStates:[{stateName:“Status”,currentState:“New”,state:“Submitted”}]) { name } }

sometimes replies with a success JSON, and sometimes it does not.
Even when the return JSON shows success, nothing is printed, and the order states are not updated either.
Out of countless tests, i had one successful print, and the very same query with a new ticket ID failed.

Trying in the GraphiQL window, the loader is spinning for ever.

Hi, some questions here:

So after I tried setting messaging server port to “8383+” on MessagingServerServiceTool, now another PC will not connect to messaging server unless I add additonal firewall to whitelist 8383 port inbound, then it will work.

This is weird because in the previous ‘non-GraphQL version’ I only need to white-list MessagingServerServiceTool and call it a day. Any particular reason why this is the case?

Here’s the annotated picture for what I mean:

Another weird behaviour I noticed is:

  1. Once you tried setting the port with GraphQL enabled (E.g. 8383+), you can never turn that feature off again on MessagingServerServiceTool.exe (i.e. you can’t revert the port back to 8383) even if the service is stopped and uninstalled (normal 8383 port on MessagingServer.exe works fine, however)

There are two message server implementations. By adding + to port number new signalr based implementation starts working to allow messaging between SambaPOS and HTML apps. It also starts serving html apps through that port. That’s why that additional configuration is needed.

2 Likes

Hi @emre

Im not sure yet, but i think there are issues with the Execute Print Command.
90% of the times i get ‘Error trying to resolve executePrintJob’. Every once in a while, everything goes well…
Is there something im missing?
here is my flow:

  1. Check if customer exists. If not, create
  2. Create Ticket
  3. Print Orders to kitchen.

I printed out the query to test in the Graphiql browser view, same thing there… works sometimes, but mostly does not.
There are times when i’ve had to restart the samba message service. So i need to isolate and figure out what is causing this. Its an integration with a website. Having most of the orders fail because of a print job execution can be very problematic to organise with. The kitchen will lose track.

By the way, any proper update on how to update/edit entity(Customer profile) via this API ?

Hard to help without seeing your code honestly. GraphQL has been rock solid in my tests even faster than sambapos itself often.

However I now do not directly create orders. I am using the terminal tickets via GraphQL and letting sambapos handle the prints and automation.

Edit: you may not be in beta to know what I am talking about. Are you interested in beta and helping us test and shape this api?