u
This commit is contained in:
58
src/providers/mssql/queries/printeragent.js
Normal file
58
src/providers/mssql/queries/printeragent.js
Normal file
@@ -0,0 +1,58 @@
|
||||
export const PRINTERAGENT_COLUMNS = `
|
||||
id,
|
||||
company_id AS companyId,
|
||||
name,
|
||||
token,
|
||||
pairingpin,
|
||||
paired_at AS pairedAt,
|
||||
clientserial,
|
||||
clientmodel,
|
||||
clientstate,
|
||||
agentversion,
|
||||
lastseen_at AS lastseenAt,
|
||||
updated_at AS updatedAt
|
||||
`;
|
||||
|
||||
export const LIST_BY_COMPANY = `
|
||||
SELECT
|
||||
${PRINTERAGENT_COLUMNS}
|
||||
FROM printeragent
|
||||
WHERE company_id = @companyId
|
||||
ORDER BY name, id
|
||||
`;
|
||||
|
||||
export const GET_BY_COMPANY_AND_ID = `
|
||||
SELECT
|
||||
${PRINTERAGENT_COLUMNS}
|
||||
FROM printeragent
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
|
||||
export const CREATE = `
|
||||
INSERT INTO printeragent (company_id, name, pairingpin)
|
||||
OUTPUT
|
||||
INSERTED.id,
|
||||
INSERTED.company_id AS companyId,
|
||||
INSERTED.name,
|
||||
INSERTED.token,
|
||||
INSERTED.pairingpin,
|
||||
INSERTED.paired_at AS pairedAt,
|
||||
INSERTED.clientserial,
|
||||
INSERTED.clientmodel,
|
||||
INSERTED.clientstate,
|
||||
INSERTED.agentversion,
|
||||
INSERTED.lastseen_at AS lastseenAt,
|
||||
INSERTED.updated_at AS updatedAt
|
||||
VALUES (@companyId, @name, @pairingpin)
|
||||
`;
|
||||
|
||||
export const UPDATE_NAME = `
|
||||
UPDATE printeragent
|
||||
SET name = @name, updated_at = SYSUTCDATETIME()
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
|
||||
export const DELETE_BY_COMPANY_AND_ID = `
|
||||
DELETE FROM printeragent
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
Reference in New Issue
Block a user