- Rough in front end / backend
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -518,6 +518,20 @@ exports.QUERY_PAYMENTS_FOR_EXPORT = `
|
||||
}
|
||||
}`;
|
||||
|
||||
exports.QUERY_TRANSITIONS_BY_JOBID = `query QUERY_TRANSITIONS_BY_JOBID($jobid: uuid!) {
|
||||
transitions(where: {jobid: {_eq: $jobid}}, order_by: {id: asc}) {
|
||||
start
|
||||
end
|
||||
value
|
||||
prev_value
|
||||
next_value
|
||||
duration
|
||||
type
|
||||
created_at
|
||||
updated_at
|
||||
}
|
||||
}`;
|
||||
|
||||
exports.QUERY_UPCOMING_APPOINTMENTS = `query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
|
||||
jobs_by_pk(id: $jobId) {
|
||||
bodyshop {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const _ = require("lodash");
|
||||
const queries = require("../graphql-client/queries");
|
||||
const jobLifecycle = (req, res) => {
|
||||
const {jobids} = req.body;
|
||||
|
||||
@@ -11,11 +12,17 @@ const handleMultipleJobs = (jobIDs, req, res) => {
|
||||
return res.status(200).send(jobIDs);
|
||||
}
|
||||
|
||||
const handleSingleJob = (req, res) => {
|
||||
|
||||
const handleSingleJob = async (jobIds, req, res) => {
|
||||
const client = req.userGraphQLClient;
|
||||
|
||||
return res.status(200).send(req.body);
|
||||
const resp = await client.request(queries.QUERY_TRANSITIONS_BY_JOBID, {jobid: jobIds,});
|
||||
|
||||
const response = {
|
||||
jobIds,
|
||||
data: resp
|
||||
}
|
||||
|
||||
return res.status(200).json(response);
|
||||
}
|
||||
|
||||
module.exports = jobLifecycle;
|
||||
@@ -1,3 +1,11 @@
|
||||
const path = require("path");
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
process.cwd(),
|
||||
`.env.${process.env.NODE_ENV || "development"}`
|
||||
),
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks if the event secret is correct
|
||||
* It adds the following properties to the request object:
|
||||
|
||||
@@ -7,14 +7,12 @@ const validateFirebaseIdTokenMiddleware = require("../middleware/validateFirebas
|
||||
const {totals, statustransition, totalsSsu, costing, lifecycle, costingmulti} = require("../job/job");
|
||||
const withUserGraphQLClientMiddleware = require("../middleware/withUserGraphQLClientMiddleware");
|
||||
|
||||
router.use(validateFirebaseIdTokenMiddleware);
|
||||
|
||||
router.post('/totals', withUserGraphQLClientMiddleware, totals);
|
||||
router.post('/totals', validateFirebaseIdTokenMiddleware, withUserGraphQLClientMiddleware, totals);
|
||||
router.post('/statustransition', eventAuthorizationMiddleware, statustransition);
|
||||
router.post('/totalsssu', withUserGraphQLClientMiddleware,totalsSsu);
|
||||
router.post('/costing', withUserGraphQLClientMiddleware,costing);
|
||||
router.get('/lifecycle', withUserGraphQLClientMiddleware, lifecycle);
|
||||
router.post('/costingmulti', withUserGraphQLClientMiddleware, costingmulti);
|
||||
router.post('/partsscan', withUserGraphQLClientMiddleware, partsScan);
|
||||
router.post('/totalsssu', validateFirebaseIdTokenMiddleware, withUserGraphQLClientMiddleware,totalsSsu);
|
||||
router.post('/costing', validateFirebaseIdTokenMiddleware, withUserGraphQLClientMiddleware,costing);
|
||||
router.post('/lifecycle', validateFirebaseIdTokenMiddleware, withUserGraphQLClientMiddleware, lifecycle);
|
||||
router.post('/costingmulti', validateFirebaseIdTokenMiddleware, withUserGraphQLClientMiddleware, costingmulti);
|
||||
router.post('/partsscan', validateFirebaseIdTokenMiddleware, withUserGraphQLClientMiddleware, partsScan);
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user