update id on list api , update readme add react-kasiraja-web link

pull/1/head
Aji Kamaludin 3 years ago
parent 586e79d48a
commit 163c9d68ba
No known key found for this signature in database
GPG Key ID: 670E1F26AD5A8099

@ -93,7 +93,8 @@ const init = async () => {
});
// route
server.route({
server.route([
{
method: 'GET',
path: '/',
handler: () => ({
@ -103,7 +104,20 @@ const init = async () => {
version: '1.0.0',
},
}),
},
{
method: '*',
path: '/{p*}', // catch-all path
handler: (request, h) => {
const response = h.response({
status: '404',
message: 'Not Found',
});
response.code(404);
return response;
},
},
]);
// catch error response
server.ext('onPreResponse', (request, h) => {

@ -10,7 +10,7 @@ class CategoriesService {
async getCategories(companyId, { startDate, endDate }) {
const query = {
text: 'SELECT name, description FROM categories WHERE company_id = $1 AND created_at BETWEEN $2 AND $3',
text: 'SELECT id, name, description FROM categories WHERE company_id = $1 AND created_at BETWEEN $2 AND $3',
values: [companyId, startDate, endDate],
};

@ -12,7 +12,7 @@ class ProductsService {
async getProducts(companyId, { startDate, endDate, withStock }) {
let query = {
text: `SELECT
name, description, price, cost
id, name, description, price, cost
FROM products
WHERE company_id = $1 AND created_at BETWEEN $2 AND $3`,
values: [companyId, startDate, endDate],

@ -51,7 +51,7 @@ class PurchasesService {
async getPurchases(companyId, { startDate, endDate }) {
const query = {
text: `SELECT
invoice, date, amount, offices.name as office_name
purchases.id, invoice, date, amount, offices.name as office_name
FROM purchases
LEFT JOIN offices ON offices.id = purchases.office_id
WHERE

@ -67,7 +67,7 @@ class SalesService {
async getSales(companyId, { startDate, endDate }) {
const query = {
text: `SELECT
invoice, date, amount, offices.name as office_name
sales.id, invoice, date, amount, offices.name as office_name
FROM sales
LEFT JOIN offices ON offices.id = sales.office_id
WHERE

@ -10,7 +10,7 @@ class UnitsService {
async getUnits(companyId, { startDate, endDate }) {
const query = {
text: 'SELECT name, description FROM units WHERE company_id = $1 AND created_at BETWEEN $2 AND $3',
text: 'SELECT id, name, description FROM units WHERE company_id = $1 AND created_at BETWEEN $2 AND $3',
values: [companyId, startDate, endDate],
};

Loading…
Cancel
Save