u
This commit is contained in:
@@ -800,7 +800,7 @@ BEGIN
|
||||
sort INT NOT NULL CONSTRAINT DF_printer_sort DEFAULT 0,
|
||||
[desc] NVARCHAR(MAX) NULL,
|
||||
CONSTRAINT FK_printer_company FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE,
|
||||
CONSTRAINT CK_printer_type CHECK (type IN ('esc/pos', 'zpl'))
|
||||
CONSTRAINT CK_printer_type CHECK (type IN ('esc/pos', 'zpl', 'ipp'))
|
||||
);
|
||||
END
|
||||
`;
|
||||
|
||||
@@ -553,7 +553,7 @@ CREATE TABLE IF NOT EXISTS printer (
|
||||
id INTEGER PRIMARY KEY,
|
||||
company_id INTEGER NOT NULL,
|
||||
address TEXT NOT NULL,
|
||||
type TEXT NOT NULL CHECK (type IN ('esc/pos', 'zpl')),
|
||||
type TEXT NOT NULL CHECK (type IN ('esc/pos', 'zpl', 'ipp')),
|
||||
model TEXT,
|
||||
serial TEXT,
|
||||
sort INTEGER NOT NULL DEFAULT 0,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import makeRunner from '../runner.js';
|
||||
|
||||
const VALID_TYPES = new Set(['esc/pos', 'zpl']);
|
||||
const VALID_TYPES = new Set(['esc/pos', 'zpl', 'ipp']);
|
||||
|
||||
function shape(row) {
|
||||
return {
|
||||
@@ -42,7 +42,7 @@ export default function create(provider) {
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {object} input - Printer input.
|
||||
* @param {string} input.address - Printer address (network IP/host/path).
|
||||
* @param {string} input.type - Printer type ("esc/pos" or "zpl").
|
||||
* @param {string} input.type - Printer type ("esc/pos", "zpl", or "ipp").
|
||||
* @param {string} [input.model] - Optional printer model name.
|
||||
* @param {string} [input.serial] - Optional printer serial number.
|
||||
* @param {number} [input.sort] - Optional sort order (auto-increments if omitted).
|
||||
@@ -67,7 +67,7 @@ export default function create(provider) {
|
||||
|
||||
const type = typeof input.type === 'string' ? input.type.trim() : '';
|
||||
if (!type || !VALID_TYPES.has(type)) {
|
||||
throw new Error('Invalid printer type: must be "esc/pos" or "zpl"');
|
||||
throw new Error('Invalid printer type: must be "esc/pos", "zpl", or "ipp"');
|
||||
}
|
||||
|
||||
const runner = makeRunner(provider, tx);
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import makeRunner from '../runner.js';
|
||||
|
||||
const VALID_TYPES = new Set(['esc/pos', 'zpl']);
|
||||
const VALID_TYPES = new Set(['esc/pos', 'zpl', 'ipp']);
|
||||
|
||||
function shape(row) {
|
||||
return {
|
||||
@@ -43,7 +43,7 @@ export default function update(provider) {
|
||||
* @param {number} id - The printer ID to update.
|
||||
* @param {object} input - Update payload.
|
||||
* @param {string} [input.address] - The printer address.
|
||||
* @param {string} [input.type] - The printer type ("esc/pos" or "zpl").
|
||||
* @param {string} [input.type] - The printer type ("esc/pos", "zpl", or "ipp").
|
||||
* @param {string|null} [input.model] - The printer model.
|
||||
* @param {string|null} [input.serial] - The printer serial.
|
||||
* @param {number} [input.sort] - The sort order.
|
||||
@@ -80,7 +80,7 @@ export default function update(provider) {
|
||||
if (input.type !== undefined) {
|
||||
const cleaned = typeof input.type === 'string' ? input.type.trim() : '';
|
||||
if (!cleaned || !VALID_TYPES.has(cleaned)) {
|
||||
throw new Error('Invalid printer type: must be "esc/pos" or "zpl"');
|
||||
throw new Error('Invalid printer type: must be "esc/pos", "zpl", or "ipp"');
|
||||
}
|
||||
type = cleaned;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user