sqlquerybuilder
Advanced tools
Comparing version 0.0.31 to 0.0.32
@@ -192,3 +192,3 @@ module.exports = function where(self) { | ||
whereString += pars[1].toUpperCase() === "NULL" ? " IS " : " = "; | ||
if(isNaN(pars[1] && pars[1].toUpperCase() !== 'NULL')){ | ||
if(isNaN(pars[1]) && pars[1].toUpperCase() !== "NULL"){ | ||
whereString += "'"; | ||
@@ -195,0 +195,0 @@ whereString += pars[1] + "'" + ")"; |
{ | ||
"name": "sqlquerybuilder", | ||
"version": "0.0.31", | ||
"version": "0.0.32", | ||
"description": "Highly opinionated Sql Server Query Writer, mostly for internal use.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index", |
@@ -652,2 +652,42 @@ /** | ||
}); | ||
it('Should give the propery query for a view with guid and single equals', function (done) { | ||
var reqquery ={ filters: 'IsActive=true&&TerritoryId=A1139D28-CE9E-4EF9-A595-A31401026A65', | ||
sidx: 'Created', | ||
sord: 'desc', | ||
RenderFormat: 'paged', | ||
page: '1', | ||
pagePercent: 'Infinity', | ||
total: '0', | ||
rows: '100', | ||
totalPages: '0' }; | ||
var query = sqlBuilder() | ||
.from('MaintenanceAssignmentView') | ||
.select({ | ||
'Status': null, | ||
'Description': 'Description', | ||
'CreatorFirstName': 'CreatorFirstName', | ||
'TerritoryId': 'TerritoryId', | ||
'ServiceTicketId': 'ServiceTicketId', | ||
'ServiceTicketNumber': 'ServiceTicketNumber', | ||
'YardId': 'YardId', | ||
'Yard': 'Yard', | ||
'Equipment': 'Equipment', | ||
'JobInstructions': 'JobInstructions', | ||
'Categories': 'Categories', | ||
'Created': 'Created', | ||
'Id': 'Id', | ||
"(CreatorFirstName + ' ' + CreatorLastName)": 'CreatorName', | ||
"(CASE WHEN Status = 'Rejected' Then 1 else 1 END)": 'IsRejected' | ||
}) | ||
.where({Status: 'Complete'}) | ||
.processListRequest(reqquery) | ||
.build(); | ||
query.should | ||
.equal("WITH SelectedItems AS (SELECT Status, Description AS 'Description', CreatorFirstName AS 'CreatorFirstName', TerritoryId AS 'TerritoryId', ServiceTicketId AS 'ServiceTicketId', ServiceTicketNumber AS 'ServiceTicketNumber', YardId AS 'YardId', Yard AS 'Yard', Equipment AS 'Equipment', JobInstructions AS 'JobInstructions', Categories AS 'Categories', Created AS 'Created', Id AS 'Id', (CreatorFirstName + ' ' + CreatorLastName) AS 'CreatorName', (CASE WHEN Status = 'Rejected' Then 1 else 1 END) AS 'IsRejected', ROW_NUMBER() OVER (ORDER BY Created DESC) AS Position FROM MaintenanceAssignmentView WHERE MaintenanceAssignmentView.Status = 'Complete' AND MaintenanceAssignmentView.IsActive = 1 AND (TerritoryId = 'A1139D28-CE9E-4EF9-A595-A31401026A65')) SELECT *, (Select MAX(Position) From SelectedItems) as 'TotalRows' FROM SelectedItems WHERE Position > 0 AND Position <= 100 ") | ||
done(); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
186822
3943