generated from ytgov/vue-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from icefoganalytics/test
CSLPT
- Loading branch information
Showing
24 changed files
with
3,883 additions
and
1,920 deletions.
There are no files selected for viewing
626 changes: 296 additions & 330 deletions
626
src/api/repositories/cheque_req_list/cheque-req-list-repository.ts
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,34 @@ | ||
import knex from "knex"; | ||
import express, { Request, Response } from "express"; | ||
import { body, param } from "express-validator"; | ||
import { ReturnValidationErrors } from "../../middleware"; | ||
import { DB_CONFIG } from "../../config"; | ||
import { ChequeReqList } from '../../repositories/cheque_req_list'; | ||
import { ChequeReqList } from "../../repositories/cheque_req_list"; | ||
|
||
const db = knex(DB_CONFIG) | ||
const db = knex(DB_CONFIG); | ||
export const chequeReqRouter = express.Router(); | ||
|
||
chequeReqRouter.get("/", | ||
async (req: Request, res: Response) => { | ||
try { | ||
const { issueDate = "", reRunBatch = null } = req.query; | ||
|
||
let start_p = 0; | ||
chequeReqRouter.get("/", async (req: Request, res: Response) => { | ||
const { issueDate = "", reRunBatch = null } = req.query; | ||
|
||
if ( | ||
reRunBatch !== null && | ||
reRunBatch !== "" && | ||
Number(reRunBatch) | ||
) { | ||
start_p = Number(reRunBatch); | ||
} | ||
try { | ||
let start_p = 0; | ||
|
||
if (issueDate?.length !== 10) { | ||
return res.status(200).json({ | ||
success: false, | ||
text: 'Select a valid date' | ||
}); | ||
} | ||
if (reRunBatch !== null && reRunBatch !== "" && Number(reRunBatch)) { | ||
start_p = Number(reRunBatch); | ||
} | ||
|
||
const chequeRequest = new ChequeReqList(db); | ||
if (issueDate?.length !== 10) { | ||
return res.status(200).json({ | ||
success: false, | ||
text: "Select a valid date", | ||
}); | ||
} | ||
|
||
const records: any = await chequeRequest.validate(issueDate.toString(), start_p); | ||
|
||
return res.status(200).json({ ...records }); | ||
const chequeRequest = new ChequeReqList(db); | ||
const records: any = await chequeRequest.validate(issueDate.toString(), start_p); | ||
|
||
} catch (error) { | ||
console.log(error); | ||
return res.status(404).send(); | ||
} | ||
} | ||
); | ||
return res.status(200).json({ ...records }); | ||
} catch (error) { | ||
console.log(error); | ||
return res.status(404).send(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.