diff --git a/client/src/App.tsx b/client/src/App.tsx
index c414e9b..10dd743 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -11,6 +11,8 @@ import SectionCreate from "./components/Section/Create";
import SectionEdit from "./components/Section/Edit";
import ThreadsList from "./components/Thread/List";
import ThreadCreate from "./components/Thread/Create";
+import MessagesList from "./components/Message/List";
+import MessageCreate from "./components/Message/Create";
function App() {
return (
@@ -39,6 +41,7 @@ function App() {
create={}
// edit={}
/>
+ } create={} />
);
}
diff --git a/client/src/components/Message/Create.tsx b/client/src/components/Message/Create.tsx
new file mode 100644
index 0000000..dd4754b
--- /dev/null
+++ b/client/src/components/Message/Create.tsx
@@ -0,0 +1,26 @@
+import {
+ Create,
+ ReferenceInput,
+ SelectInput,
+ SimpleForm,
+ TextInput,
+ required
+} from "react-admin";
+
+function MessageCreate() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default MessageCreate;
diff --git a/client/src/components/Message/Edit.tsx b/client/src/components/Message/Edit.tsx
new file mode 100644
index 0000000..7f51eb3
--- /dev/null
+++ b/client/src/components/Message/Edit.tsx
@@ -0,0 +1,27 @@
+import {
+ Edit,
+ ReferenceInput,
+ SelectInput,
+ SimpleForm,
+ TextInput,
+ required,
+} from "react-admin";
+import Title from "../Title";
+
+function SectionEdit() {
+ return (
+ } actions={false}>
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default SectionEdit;
diff --git a/client/src/components/Message/List.tsx b/client/src/components/Message/List.tsx
new file mode 100644
index 0000000..9c4bd5d
--- /dev/null
+++ b/client/src/components/Message/List.tsx
@@ -0,0 +1,17 @@
+import { List, Datagrid, TextField, EditButton } from "react-admin";
+
+function MessagesList() {
+ return (
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default MessagesList;
\ No newline at end of file
diff --git a/client/src/components/Thread/Create.tsx b/client/src/components/Thread/Create.tsx
index e00d780..5a218f3 100644
--- a/client/src/components/Thread/Create.tsx
+++ b/client/src/components/Thread/Create.tsx
@@ -12,7 +12,11 @@ function ThreadCreate() {
-
+
diff --git a/server/controllers/message/message.controller.ts b/server/controllers/message/message.controller.ts
new file mode 100644
index 0000000..9705491
--- /dev/null
+++ b/server/controllers/message/message.controller.ts
@@ -0,0 +1,144 @@
+import { ApiErrorHandler } from "../../error/api-error.handler";
+import Message from "../../models/message.model";
+import type { IMessageDto } from "./message.dto";
+import type { Order } from "sequelize";
+import type { NextFunction, Request, Response } from "express";
+import type {
+ FilterQueryParamType,
+ RangeQueryParamType,
+ SortQueryParamType
+} from "../query-param.types";
+
+class MessageController {
+ getAll = async (req: Request, res: Response, next: NextFunction) => {
+ try {
+ const range: RangeQueryParamType = req.query.range
+ ? JSON.parse(req.query.range.toString())
+ : [0, 10];
+ const sort: SortQueryParamType = req.query.sort
+ ? JSON.parse(req.query.sort.toString())
+ : ["id", "ASC"];
+
+ const Messages = await Message.findAndCountAll({
+ offset: range[0],
+ limit: range[1] - range[0] + 1,
+ order: [sort] as Order
+ });
+
+ return res.json({ data: Messages.rows, total: Messages.count });
+ } catch (error) {
+ next(ApiErrorHandler.internal((error as Error).message));
+ }
+ };
+
+ getMany = async (
+ req: Request,
+ res: Response<{ data: Message[] }>,
+ next: NextFunction
+ ) => {
+ try {
+ const filter: FilterQueryParamType = req.query.filter
+ ? JSON.parse(req.query.filter.toString())
+ : { ids: [] };
+
+ const messages = await Message.findAll({
+ where: { id: filter.ids as number[] }
+ });
+ return res.json({ data: messages });
+ } catch (error) {
+ next(ApiErrorHandler.internal((error as Error).message));
+ }
+ };
+
+ create = async (
+ req: Request