Joined September 2016
·

jammen

Programmer
·
·
·

Hey here's a question. I came across your blog entry because i'm looking for a way to manage multiple rooms with multiple users, as well as broadcasting to rooms based upon the NOTIFY/LISTEN abilities of PostgreSQL.

So the reasoning.

Each user who logs in, is bound to a parent account ie: a Manufacturer, Customer, or Agency

Customers/Agencies will place orders on Manufacturer products, however, manufacturers are also able to purchase manufacturer products.
Basically if Wile E Coyote purchases x number of items from Acme Anvils then all Acme Anvil users (employee's) should receive a notification about the purchase and it's details.

I have bound the room numbers to a UUID bound to their organization, and each user as well has their own UUID. So technically I should be able to have:

[
  {
    id: 1234556,
    establishment: 'Looney Tunes',
    users: [
      {
        id: 555494,
        name: 'Foghorn Leghorn',
        role: {
            id: 1,
            name: 'Administrators'
        },
        group: {
            id: 1,
            name: 'System Administrator'
        }
      },
      {
        id: 8957230,
        name: 'Daffy Duck',
        role: {
            id: 1,
            name: 'Administrators'
        },
        group: {
            id: 1,
            name: 'System Administrator'
        }
      },
      {
        id: 2340856,
        name: 'Bugs Bunny',
        role: {
            id: 1,
            name: 'Developer'
        },
        group: {
            id: 1,
            name: 'System Administrator'
        }
      }
    ]
  },
  {
    id: 9079687,
    establishment: 'Disney',
    users: [
      {
        id: 09234859,
        name: 'Mickey Mouse',
        role: {
            id: 1,
            name: 'Administrators'
        },
        group: {
            id: 2,
            name: 'Manufacturers'
        }
      },
      {
        id: 234156,
        name: 'Minnie Mouse',
        role: {
            id: 6,
            name: 'Order Desk'
        },
        group: {
            id: 2,
            name: 'Manufacturer'
        }
      }
    ]
  }
]

so basically if disney's order desk buys a looney tunes product, everyone in both rooms will be notified that the disney order desk made that purchase, where I return the JSON items and it's details, store it, and do a few other funky things like link's to that particular order details page etc because those users have the correct permissions.

of course the verbiage will be different and handled differently but I am new to Redis and more familiar with MongoDB for this kind of thing, because I want to be able to save these notification items, in order to allow scrolling through all alerts at the user convenience, rather than simply popping up notification growls...

now... all of this is dynamic, because i won't know who is logging in from which establishment and are merely managing these by a set of rules bound in the code and the db.

thoughts?

Achievements
1 Karma
0 Total ProTip Views