ENCOA-16: Added a creation date to the Code List
This commit is contained in:
@@ -139,6 +139,7 @@ export interface Code {
|
||||
creator: string;
|
||||
expiryDate: Date;
|
||||
type: Type;
|
||||
creationDate?: string;
|
||||
userId?: string;
|
||||
email?: string;
|
||||
name?: string;
|
||||
|
||||
@@ -8,6 +8,7 @@ import {Code, User} from "@/interfaces/user";
|
||||
import {USER_TYPE_LABELS} from "@/resources/user";
|
||||
import {createColumnHelper, flexRender, getCoreRowModel, useReactTable} from "@tanstack/react-table";
|
||||
import axios from "axios";
|
||||
import moment from "moment";
|
||||
import {useEffect, useState} from "react";
|
||||
import {BsTrash} from "react-icons/bs";
|
||||
import {toast} from "react-toastify";
|
||||
@@ -129,6 +130,10 @@ export default function CodeList({user}: {user: User}) {
|
||||
header: "Code",
|
||||
cell: (info) => info.getValue(),
|
||||
}),
|
||||
columnHelper.accessor("creationDate", {
|
||||
header: "Creation Date",
|
||||
cell: (info) => (info.getValue() ? moment(info.getValue()).format("DD/MM/YYYY") : "N/A"),
|
||||
}),
|
||||
columnHelper.accessor("email", {
|
||||
header: "Invited E-mail",
|
||||
cell: (info) => info.getValue() || "N/A",
|
||||
|
||||
@@ -78,6 +78,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
type,
|
||||
code,
|
||||
creator: req.session.user!.id,
|
||||
creationDate: new Date().toISOString(),
|
||||
expiryDate,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user