diff --git a/api/routes/items.ts b/api/routes/items.ts index 6819556..a9bd292 100644 --- a/api/routes/items.ts +++ b/api/routes/items.ts @@ -25,13 +25,14 @@ router.post("/all", isUser, async (req: Request, res: Response) => { if (err) console.log(err); else console.log(docs); }); - const onlyArchived = req.body.onlyArchived ?? false; Item.updateMany({ archiver: { $exists: false } }, [ { $set: { archiver: null } }, ]).exec(function (err, docs) { if (err) console.log(err); else console.log(docs); }); + + const onlyArchived = req.body.onlyArchived ?? false; Item.find({ archived: onlyArchived }) .populate("whereToRetrieve") .sort({ dateFound: -1, timeFound: -1 }) @@ -170,8 +171,8 @@ router.post("/archive", isUser, async (req: Request, res: Response) => { id, { archived: archived, - archiver: user.username, dateArchived: new Date(), + archiver: user.username, }, { runValidators: true, useFindAndModify: false } ); @@ -219,8 +220,8 @@ router.post("/archiveByDays", isAdmin, async (req: Request, res: Response) => { { $set: { archived: true, - archiver: user.username, dateArchived: new Date(), + archiver: user.username, }, }, ] diff --git a/client/src/components/HistoryAccordion.tsx b/client/src/components/HistoryAccordion.tsx index 24e5c86..6793b04 100644 --- a/client/src/components/HistoryAccordion.tsx +++ b/client/src/components/HistoryAccordion.tsx @@ -7,6 +7,8 @@ export default function HistoryAccordion(props: { modified: string[]; approver: string; returner: string; + archiver: string; + isArchived: boolean; }) { const [activeIndex, setActiveIndex] = useState(-1); @@ -63,6 +65,23 @@ export default function HistoryAccordion(props: { {props.returner} )} + + {props.isArchived == true ? ( + + + Archiver + + ) : null} + + {props.archiver !== null && ( + + {props.archiver} + + )} ); } diff --git a/client/src/components/TableWidget.tsx b/client/src/components/TableWidget.tsx index 46d9806..2f21faa 100644 --- a/client/src/components/TableWidget.tsx +++ b/client/src/components/TableWidget.tsx @@ -300,8 +300,11 @@ const TableWidget = (props: { modified={item.modified} approver={item.approver} returner={item.returner} + archiver={item.archiver} + isArchived={item.archived} > + {props.isArchivedItems ? (