u
This commit is contained in:
@@ -47,7 +47,7 @@ emits `{ sender, brandId }`.
|
||||
| `labeltemplate` | `{}` | `POST /labeltemplate`, `PUT /labeltemplate/{id}`, `PATCH /labeltemplate/{id}`, `DELETE /labeltemplate/{id}` |
|
||||
| `printer` | `{}` | `POST /printer`, `PUT /printer/{id}`, `PATCH /printer/{id}`, `DELETE /printer/{id}` |
|
||||
| `printeragent` | `{}` | `PUT /printeragent`, `PATCH /printeragent/{id}`, `DELETE /printeragent/{id}`, printer agent connect/disconnect/state |
|
||||
| `agentprinter` | `{}` | `PATCH /agentprinter/{id}`, `PUT /agentprinter/order`, `DELETE /agentprinter/{id}`, new printer discovery |
|
||||
| `agentprinter` | `{ printers }` or `{}` | `PATCH /agentprinter/{id}`, `PUT /agentprinter/order`, `DELETE /agentprinter/{id}`, agent state updates / printer discovery |
|
||||
| `warehouse` | `{}` | `POST /warehouse`, `PUT /warehouse/{id}`, `PATCH /warehouse/{id}`, `DELETE /warehouse/{id}` |
|
||||
| `supplier` | `{}` | `POST /supplier`, `PATCH /supplier/{id}`, `DELETE /supplier/{id}` |
|
||||
| `vfs` | `{}` | VFS uploads and filesystem mutations such as `POST /vfs/upload`, `POST /vfs/mkdir`, `POST /vfs/rename`, `PUT /vfs/{*path}`, `DELETE /vfs/{*path}` |
|
||||
|
||||
@@ -357,9 +357,7 @@ async function handleState(req, res) {
|
||||
|
||||
if (rawPrinters && req.agent.companyId) {
|
||||
updateAgentPrinters(req.agent.companyId, req.agent.id, req.agent.name, rawPrinters);
|
||||
}
|
||||
|
||||
if (anyAgentPrinterCreated && req.agent.companyId) {
|
||||
} else if (anyAgentPrinterCreated && req.agent.companyId) {
|
||||
emit('agentprinter', { companyId: req.agent.companyId });
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ export function register(app, basePath = '') {
|
||||
* | `labeltemplate` | `{}` | `POST /labeltemplate`, `PUT /labeltemplate/{id}`, `PATCH /labeltemplate/{id}`, `DELETE /labeltemplate/{id}` |
|
||||
* | `printer` | `{}` | `POST /printer`, `PUT /printer/{id}`, `PATCH /printer/{id}`, `DELETE /printer/{id}` |
|
||||
* | `printeragent` | `{}` | `PUT /printeragent`, `PATCH /printeragent/{id}`, `DELETE /printeragent/{id}`, printer agent connect/disconnect/state |
|
||||
* | `agentprinter` | `{}` | `PATCH /agentprinter/{id}`, `PUT /agentprinter/order`, `DELETE /agentprinter/{id}`, new printer discovery |
|
||||
* | `agentprinter` | `{ printers }` or `{}` | `PATCH /agentprinter/{id}`, `PUT /agentprinter/order`, `DELETE /agentprinter/{id}`, agent state updates / printer discovery |
|
||||
* | `warehouse` | `{}` | `POST /warehouse`, `PUT /warehouse/{id}`, `PATCH /warehouse/{id}`, `DELETE /warehouse/{id}` |
|
||||
* | `supplier` | `{}` | `POST /supplier`, `PATCH /supplier/{id}`, `DELETE /supplier/{id}` |
|
||||
* | `vfs` | `{}` | VFS uploads and filesystem mutations such as `POST /vfs/upload`, `POST /vfs/mkdir`, `POST /vfs/rename`, `PUT /vfs/{*path}`, `DELETE /vfs/{*path}` |
|
||||
|
||||
@@ -140,7 +140,7 @@ export function getCompanyPrinter(companyId, identifier) {
|
||||
|
||||
/**
|
||||
* Broadcasts the current live printer list for a company to all connected subscribers via SSE.
|
||||
* Emits both `printer` (with data `{ printers }`) and `printerstate`.
|
||||
* Emits `agentprinter` with data `{ printers }`.
|
||||
*
|
||||
* @param {number} companyId
|
||||
* @param {LivePrinter[]} [printers]
|
||||
@@ -152,8 +152,7 @@ export function broadcastCompanyPrinters(companyId, printers) {
|
||||
const list = printers ?? getCompanyPrinters(cId);
|
||||
const payload = { printers: list };
|
||||
|
||||
emit('printer', { companyId: cId, data: payload });
|
||||
emit('printerstate', { companyId: cId, data: payload });
|
||||
emit('agentprinter', { companyId: cId, data: payload });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user