u
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/** Drop order = reverse of schema create dependency order. */
|
||||
export const TABLES = [
|
||||
'manifestattachment',
|
||||
'labeltemplate',
|
||||
'file',
|
||||
'companyuser',
|
||||
'syncpos',
|
||||
|
||||
87
src/providers/mssql/queries/labeltemplate.js
Normal file
87
src/providers/mssql/queries/labeltemplate.js
Normal file
@@ -0,0 +1,87 @@
|
||||
export const LABELTEMPLATE_COLUMNS = `
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
width,
|
||||
height,
|
||||
dpi,
|
||||
type,
|
||||
content,
|
||||
thumb
|
||||
`;
|
||||
|
||||
export const LIST_BY_COMPANY = `
|
||||
SELECT
|
||||
${LABELTEMPLATE_COLUMNS}
|
||||
FROM labeltemplate
|
||||
WHERE company_id = @companyId
|
||||
ORDER BY id ASC
|
||||
`;
|
||||
|
||||
export const GET_BY_COMPANY_AND_ID = `
|
||||
SELECT
|
||||
${LABELTEMPLATE_COLUMNS}
|
||||
FROM labeltemplate
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
|
||||
export const CREATE = `
|
||||
INSERT INTO labeltemplate (
|
||||
company_id,
|
||||
name,
|
||||
width,
|
||||
height,
|
||||
dpi,
|
||||
type,
|
||||
content,
|
||||
thumb
|
||||
)
|
||||
OUTPUT
|
||||
INSERTED.id,
|
||||
INSERTED.company_id,
|
||||
INSERTED.name,
|
||||
INSERTED.width,
|
||||
INSERTED.height,
|
||||
INSERTED.dpi,
|
||||
INSERTED.type,
|
||||
INSERTED.content,
|
||||
INSERTED.thumb
|
||||
VALUES (
|
||||
@companyId,
|
||||
@name,
|
||||
@width,
|
||||
@height,
|
||||
@dpi,
|
||||
@type,
|
||||
@content,
|
||||
@thumb
|
||||
)
|
||||
`;
|
||||
|
||||
export const UPDATE = `
|
||||
UPDATE labeltemplate
|
||||
SET
|
||||
name = @name,
|
||||
width = @width,
|
||||
height = @height,
|
||||
dpi = @dpi,
|
||||
type = @type,
|
||||
content = @content,
|
||||
thumb = @thumb
|
||||
OUTPUT
|
||||
INSERTED.id,
|
||||
INSERTED.company_id,
|
||||
INSERTED.name,
|
||||
INSERTED.width,
|
||||
INSERTED.height,
|
||||
INSERTED.dpi,
|
||||
INSERTED.type,
|
||||
INSERTED.content,
|
||||
INSERTED.thumb
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
|
||||
export const DELETE_BY_COMPANY_AND_ID = `
|
||||
DELETE FROM labeltemplate
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
@@ -816,6 +816,26 @@ END
|
||||
`;
|
||||
|
||||
|
||||
export const INIT_LABELTEMPLATE = `
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'labeltemplate')
|
||||
BEGIN
|
||||
CREATE TABLE labeltemplate (
|
||||
id INT IDENTITY(1,1) PRIMARY KEY,
|
||||
company_id INT NOT NULL,
|
||||
name NVARCHAR(255) NOT NULL,
|
||||
width INT NOT NULL,
|
||||
height INT NOT NULL,
|
||||
dpi INT NOT NULL,
|
||||
type NVARCHAR(50) NOT NULL,
|
||||
content NVARCHAR(MAX) NOT NULL,
|
||||
thumb VARBINARY(MAX) NULL,
|
||||
CONSTRAINT FK_labeltemplate_company FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE,
|
||||
CONSTRAINT CK_labeltemplate_dpi CHECK (dpi IN (203, 300)),
|
||||
CONSTRAINT CK_labeltemplate_type CHECK (type IN ('zpl'))
|
||||
);
|
||||
END
|
||||
`;
|
||||
|
||||
export const INIT_FILE = `
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'file')
|
||||
BEGIN
|
||||
@@ -919,6 +939,7 @@ export const SCHEMA_SCRIPTS = [
|
||||
INIT_POSTERMINAL,
|
||||
INIT_POSTERMINALCATEGORY,
|
||||
INIT_PRINTER,
|
||||
INIT_LABELTEMPLATE,
|
||||
INIT_FILE,
|
||||
INIT_MANIFESTATTACHMENT,
|
||||
INIT_MANIFESTATTACHMENT_TRIGGER,
|
||||
|
||||
Reference in New Issue
Block a user