Skip to content

Commit

Permalink
Merge pull request #6 from icefoganalytics/main
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
datajohnson authored Jun 25, 2024
2 parents ae77bfd + 3dc8aea commit 82e275e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions api/src/routes/report-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ reportRouter.post("/", async (req: Request, res: Response) => {

let insertedId = insertedReports[0].id;

console.log("req.file", req.files);

if (req.files && req.files.files) {
let files = req.files.files;

Expand All @@ -93,5 +91,5 @@ reportRouter.post("/", async (req: Request, res: Response) => {
}
}

return res.status(500).json({ data: [] });
return res.status(200).json({ data: {} });
});
7 changes: 5 additions & 2 deletions api/src/routes/role-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ roleRouter.post("/user/:user_id", async (req: Request, res: Response) => {

for (const role of roles) {
role.create_user_id = req.user.id;
role.start_date = InsertableDate(role.start_date);
role.end_date = InsertableDate(role.end_date);

// TODO: implement date-based activations if necessary
//role.start_date = InsertableDate(role.start_date);
//role.end_date = InsertableDate(role.end_date);
role.created_at = InsertableDate(new Date().toISOString());

if (isEmpty(role.department_code)) role.department_code = null;
await trx("user_roles").insert(roleForInsert(role));
Expand Down
2 changes: 2 additions & 0 deletions api/src/utils/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export function RenderMarkdown(input: string): { output: string; isMarkdown: boo
export function InsertableDate(input: string | null) {
if (input) {
if (DB_CLIENT == "oracledb") {
console.log("CONVERTING FOR ORACLE", input);

return knex.raw(
`TO_TIMESTAMP('${DateTime.fromISO(input).toFormat("yyyy-MM-dd HH:mm:ss")}', 'YYYY-MM-DD HH24:MI:SS')`
);
Expand Down

0 comments on commit 82e275e

Please sign in to comment.