Skip to content
Commits on Source (4)
......@@ -11,6 +11,14 @@ export default function Navigation() {
</a>
</Link>
</div>
<div className={styles.link}>
<Link href="/analytics">
<a>
<p>Analytics</p>
</a>
</Link>
</div>
<div className={styles.link}>
<Link href="/articles">
<a>
......@@ -18,6 +26,13 @@ export default function Navigation() {
</a>
</Link>
</div>
<div className={styles.link}>
<Link href="/asamextensions">
<a>
<p>AsamExtensions</p>
</a>
</Link>
</div>
<div className={styles.link}>
<Link href="/bookmarks">
<a>
......@@ -39,6 +54,13 @@ export default function Navigation() {
</a>
</Link>
</div>
<div className={styles.link}>
<Link href="/forms">
<a>
<p>Forms</p>
</a>
</Link>
</div>
<div className={styles.link}>
<Link href="/eventsAgenda">
<a>
......@@ -46,6 +68,13 @@ export default function Navigation() {
</a>
</Link>
</div>
<div className={styles.link}>
<Link href="/globalInfos">
<a>
<p>GlobalInfos</p>
</a>
</Link>
</div>
<div className={styles.link}>
<Link href="/groups">
<a>
......
import mongoose from "mongoose";
const AnalyticsSchema = new mongoose.Schema(
{
_id: { type: String },
content: { type: String },
createdAt: { type: Date },
structureId: { type: String },
target: { type: String },
count: { type: Number },
},
{ collection: "analytics" },
{ timestamps: true }
);
export default mongoose.models.Analytics ||
mongoose.model("Analytics", AnalyticsSchema);
import mongoose from "mongoose";
const AsamExtensions = new mongoose.Schema(
{
_id: { type: String },
extension: { type: String },
entiteNomCourt: { type: String },
entiteNomLong: { type: String },
familleNomCourt: { type: String },
familleNomLong: { type: String },
structureId: { type: String },
},
{ collection: "asamextensions" },
{ timestamps: true }
);
export default mongoose.models.AsamExtensions ||
mongoose.model("AsamExtensions", AsamExtensions);
import mongoose from "mongoose";
const Forms = new mongoose.Schema(
{
_id: { type: String },
title: { type: String },
description: { type: String },
owner: { type: String },
isModel: { type: Boolean },
isPublic: { type: Boolean },
editableAnswers: { type: Boolean },
groups: [String],
components: { type: Array },
active: { type: Boolean },
createdAt: { type: Date },
},
{ collection: "forms" },
{ timestamps: true }
);
export default mongoose.models.Forms || mongoose.model("Forms", Forms);
import mongoose from "mongoose";
const GlobalInfos = new mongoose.Schema(
{
_id: { type: String },
language: { type: String },
content: { type: String },
expirationDate: { type: Date },
createdAt: { type: Date },
updatedAt: { type: Date },
structureId: [String],
},
{ collection: "globalinfos" },
{ timestamps: true }
);
export default mongoose.models.GlobalInfos ||
mongoose.model("GlobalInfos", GlobalInfos);
......@@ -31,6 +31,7 @@ const UsersSchema = new mongoose.Schema(
lastArticle: { type: Date },
avatar: { type: String },
mezigName: { type: String },
structure: { type: String },
},
{ collection: "users" },
{ timestamps: true }
......
{
"name": "supercrudv2",
"version": "1.1.0",
"version": "1.2.0-testing.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "supercrudv2",
"version": "1.1.0",
"version": "1.2.0-testing.1",
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
......
{
"name": "supercrudv2",
"version": "1.1.0",
"version": "1.2.0-testing.1",
"private": true,
"scripts": {
"dev": "next dev -p 3050",
......
import { useMemo } from "react";
import DashBoard from "../Components/DashBoard";
const Analytics = () => {
const columns = useMemo(
() => [
{
accessorKey: "_id",
header: "id",
enableClickToCopy: true,
enableEditing: false,
size: 200,
},
{
accessorKey: "content",
header: "content",
},
{
accessorKey: "createdAt",
header: "createdAt",
enableEditing: false,
enableGlobalFilter: false,
Cell: ({ cell }) => {
if (cell.getValue()) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
},
{
accessorKey: "structureId",
header: "structureId",
enableClickToCopy: true,
Cell: ({ cell }) => cell.getValue()?.toString(),
},
{
accessorKey: "target",
header: "target",
enableClickToCopy: true,
},
{
accessorKey: "count",
header: "count",
enableEditing: false,
enableGlobalFilter: false,
muiTableBodyCellEditTextFieldProps: () => ({
type: "number",
}),
},
],
[]
);
return (
<>
<DashBoard columns={columns} apiRouteName={"analytics"} />
</>
);
};
export default Analytics;
import { unstable_getServerSession } from "next-auth/next";
import { authOptions } from "../auth/[...nextauth]";
import connectDB from "../../../database/connectDB";
import Analytics from "../../../database/models/Analytics";
export default async function handler(req, res) {
const session = await unstable_getServerSession(req, res, authOptions);
const { method } = req;
const { tableName } = req.query;
if (!session)
return res.end(
"You must be signed in to view the protected content on this page."
);
if (!tableName) return res.end("Cannot access API by URL");
await connectDB();
switch (method) {
case "GET":
try {
const analytics = await Analytics.find({});
res.status(200).json({ data: analytics });
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
case "DELETE":
try {
const bodyParsed = JSON.parse(req.body);
const id = bodyParsed.id;
const result = await Analytics.findOneAndDelete({ _id: id });
res.status(200).json({
success: true,
result,
message: "supprimé de la Base de Donnée !",
});
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
case "PUT":
try {
const bodyParsed = JSON.parse(req.body);
const id = bodyParsed._id;
const result = await Analytics.findByIdAndUpdate(
{ _id: id },
{ ...bodyParsed }
);
res.status(200).json({
success: true,
result,
message: "Modifié en Base de Donnée !",
});
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
}
}
import { unstable_getServerSession } from "next-auth/next";
import { authOptions } from "../auth/[...nextauth]";
import connectDB from "../../../database/connectDB";
import AsamExtensions from "../../../database/models/AsamExtensions";
export default async function handler(req, res) {
const session = await unstable_getServerSession(req, res, authOptions);
const { method } = req;
const { tableName } = req.query;
if (!session)
return res.end(
"You must be signed in to view the protected content on this page."
);
if (!tableName) return res.end("Cannot access API by URL");
await connectDB();
switch (method) {
case "GET":
try {
const asamExtensions = await AsamExtensions.find({});
res.status(200).json({ data: asamExtensions });
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
case "DELETE":
try {
const bodyParsed = JSON.parse(req.body);
const id = bodyParsed.id;
const result = await AsamExtensions.findOneAndDelete({ _id: id });
res.status(200).json({
success: true,
result,
message: "supprimé de la Base de Donnée !",
});
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
case "PUT":
try {
const bodyParsed = JSON.parse(req.body);
const id = bodyParsed._id;
const result = await AsamExtensions.findByIdAndUpdate(
{ _id: id },
{ ...bodyParsed }
);
res.status(200).json({
success: true,
result,
message: "Modifié en Base de Donnée !",
});
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
}
}
import { unstable_getServerSession } from "next-auth/next";
import { authOptions } from "../auth/[...nextauth]";
import connectDB from "../../../database/connectDB";
import Forms from "../../../database/models/Forms";
export default async function handler(req, res) {
const session = await unstable_getServerSession(req, res, authOptions);
const { method } = req;
const { tableName } = req.query;
if (!session)
return res.end(
"You must be signed in to view the protected content on this page."
);
if (!tableName) return res.end("Cannot access API by URL");
await connectDB();
switch (method) {
case "GET":
try {
const forms = await Forms.find({});
res.status(200).json({ data: forms });
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
case "DELETE":
try {
const bodyParsed = JSON.parse(req.body);
const id = bodyParsed.id;
const result = await Forms.findOneAndDelete({ _id: id });
res.status(200).json({
success: true,
result,
message: "supprimé de la Base de Donnée !",
});
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
case "PUT":
try {
const bodyParsed = JSON.parse(req.body);
const id = bodyParsed._id;
const result = await Forms.findByIdAndUpdate(
{ _id: id },
{ ...bodyParsed }
);
res.status(200).json({
success: true,
result,
message: "Modifié en Base de Donnée !",
});
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
}
}
import { unstable_getServerSession } from "next-auth/next";
import { authOptions } from "../auth/[...nextauth]";
import connectDB from "../../../database/connectDB";
import GlobalInfos from "../../../database/models/GlobalInfos";
export default async function handler(req, res) {
const session = await unstable_getServerSession(req, res, authOptions);
const { method } = req;
const { tableName } = req.query;
if (!session)
return res.end(
"You must be signed in to view the protected content on this page."
);
if (!tableName) return res.end("Cannot access API by URL");
await connectDB();
switch (method) {
case "GET":
try {
const globalInfos = await GlobalInfos.find({});
res.status(200).json({ data: globalInfos });
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
case "DELETE":
try {
const bodyParsed = JSON.parse(req.body);
const id = bodyParsed.id;
const result = await GlobalInfos.findOneAndDelete({ _id: id });
res.status(200).json({
success: true,
result,
message: "supprimé de la Base de Donnée !",
});
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
case "PUT":
try {
const bodyParsed = JSON.parse(req.body);
const id = bodyParsed._id;
const result = await GlobalInfos.findByIdAndUpdate(
{ _id: id },
{ ...bodyParsed }
);
res.status(200).json({
success: true,
result,
message: "Modifié en Base de Donnée !",
});
} catch (error) {
res.status(400).json({ success: false, error: error.message });
}
break;
}
}
import { useMemo } from "react";
import DashBoard from "../Components/DashBoard";
const AsamExtensions = () => {
const columns = useMemo(
() => [
{
accessorKey: "_id",
header: "id",
enableEditing: false,
size: 200,
},
{
accessorKey: "extension",
header: "extension",
},
{
accessorKey: "entiteNomCourt",
header: "entiteNomCourt",
},
{
accessorKey: "entiteNomLong",
header: "entiteNomLong",
},
{
accessorKey: "familleNomCourt",
header: "familleNomCourt",
},
{
accessorKey: "familleNomLong",
header: "familleNomLong",
},
{
accessorKey: "structureId",
header: "structureId",
enableClickToCopy: true,
Cell: ({ cell }) => cell.getValue()?.toString(),
},
],
[]
);
return (
<>
<DashBoard columns={columns} apiRouteName={"asamextensions"} />
</>
);
};
export default AsamExtensions;
import { useMemo } from "react";
import DashBoard from "../Components/DashBoard";
const Forms = () => {
const columns = useMemo(
() => [
{
accessorKey: "_id",
header: "id",
enableEditing: false,
size: 200,
},
{
accessorKey: "title",
header: "title",
Cell: ({ cell }) => {
if (cell.getValue()?.length > 20) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
},
{
accessorKey: "description",
header: "description",
Cell: ({ cell }) => {
if (cell.getValue()?.length > 20) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
},
{
accessorKey: "owner",
header: "owner",
},
{
accessorKey: "isModel",
header: "isModel",
enableGlobalFilter: false,
Cell: ({ cell }) => cell.getValue()?.toString(),
},
{
accessorKey: "isPublic",
header: "isPublic",
enableGlobalFilter: false,
Cell: ({ cell }) => cell.getValue()?.toString(),
},
{
accessorKey: "editableAnswers",
header: "editableAnswers",
enableGlobalFilter: false,
Cell: ({ cell }) => cell.getValue()?.toString(),
},
{
accessorKey: "groups",
header: "groups",
enableEditing: false,
size: "240",
Cell: ({ cell }) => {
if (cell.getValue()?.length > 1) {
return (
<details>
<summary>{cell.getValue().slice(0, 1)}</summary>
{cell.getValue().slice().join("\n")}
</details>
);
}
},
},
{
accessorKey: "active",
header: "active",
enableGlobalFilter: false,
Cell: ({ cell }) => cell.getValue()?.toString(),
},
{
accessorKey: "createdAt",
header: "createdAt",
enableEditing: false,
Cell: ({ cell }) => {
if (cell.getValue()) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
},
],
[]
);
return (
<>
<DashBoard columns={columns} apiRouteName={"forms"} />
</>
);
};
export default Forms;
import { useMemo } from "react";
import DashBoard from "../Components/DashBoard";
const GlobalInfos = () => {
const columns = useMemo(
() => [
{
accessorKey: "_id",
header: "id",
enableEditing: false,
size: 200,
},
{
accessorKey: "language",
header: "language",
},
{
accessorKey: "content",
header: "content",
Cell: ({ cell }) => {
if (cell.getValue()?.length > 20) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
},
{
accessorKey: "expirationDate",
header: "expirationDate",
enableEditing: false,
Cell: ({ cell }) => {
if (cell.getValue()) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
},
{
accessorKey: "createdAt",
header: "createdAt",
enableEditing: false,
Cell: ({ cell }) => {
if (cell.getValue()) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
},
{
accessorKey: "updatedAt",
header: "updatedAt",
enableEditing: false,
Cell: ({ cell }) => {
if (cell.getValue()) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
},
{
accessorKey: "structureId",
header: "structureId",
enableEditing: false,
size: "240",
Cell: ({ cell }) => {
if (cell.getValue()?.length > 1) {
return (
<details>
<summary>{cell.getValue().slice(0, 1)}</summary>
{cell.getValue().slice().join("\n")}
</details>
);
}
},
},
],
[]
);
return (
<>
<DashBoard columns={columns} apiRouteName={"globalInfos"} />
</>
);
};
export default GlobalInfos;
......@@ -51,16 +51,7 @@ const Users = () => {
id: "services.keycloak.id",
header: "keycloakId",
enableEditing: false,
Cell: ({ cell }) => {
if (cell.getValue()?.length > 20) {
return (
<details>
<summary>{cell.getValue().substr(0, 12)}</summary>
{cell.getValue()}
</details>
);
}
},
enableClickToCopy: true,
},
{
accessorKey: "username",
......@@ -88,6 +79,11 @@ const Users = () => {
accessorKey: "lastName",
header: "lastName",
},
{
accessorKey: "structure",
header: "structure",
enableClickToCopy: true,
},
{
accessorKey: "isActive",
header: "isActive",
......
.navigation{
display: flex;
flex-wrap: wrap;
justify-content: space-around;
font-weight: 500;
align-items: center;
}
\ No newline at end of file
......@@ -2,5 +2,5 @@
border: 1px solid rgba(25, 118, 210, 0.5);
border-radius: 10px;
padding: 0 10px;
margin: 10px 0;
margin: 10px;
}
\ No newline at end of file