api/sales.js
/**
* Provides all required query for users resource
*/
Provides all required query for users resource
Provides all required query for users resource
function queryMaker() {
    return {
        fetchSales: "Select * from sale",
        fetchOneSale : function (id){
            return "Select * from sale where saleId = " + id;
        },
        createSale : function (data){
            return "Insert into sale(userId, productId) values ("
                + '"' + data.userId + '", '
                + '"' + data.productId + '")';
        },
        deleteSale : function (id){
            return "Delete from sale where saleId = " + id;
        },
        updateSale : function(id, data){
            "update sale"
                + 'set userId = "' + data.userId + '", '
                + 'productId = "' + data.productId + '", '
                + 'where saleId = "' + id + '"';
        }
    }
}
function queryMaker ( ) { return { fetchSales : "Select * from sale" , fetchOneSale : function ( id ) { return "Select * from sale where saleId = " + id ; } , createSale : function ( data ) { return "Insert into sale(userId, productId) values (" + '"' + data . userId + '", ' + '"' + data . productId + '")' ; } , deleteSale : function ( id ) { return "Delete from sale where saleId = " + id ; } , updateSale : function ( id , data ) { "update sale" + 'set userId = "' + data . userId + '", ' + 'productId = "' + data . productId + '", ' + 'where saleId = "' + id + '"' ; } } }
Provides all required query for users resource
Provides all required query for users resource