diff --git a/client/src/App.tsx b/client/src/App.tsx
index a4d3f4d..6ac705f 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -6,6 +6,9 @@ import RoleEdit from "./components/Role/Edit";
import UsersList from "./components/User/List";
import UserCreate from "./components/User/Create";
import UserEdit from "./components/User/Edit";
+import SectionsList from "./components/Section/List";
+import SectionCreate from "./components/Section/Create";
+import SectionEdit from "./components/Section/Edit";
function App() {
return (
@@ -22,6 +25,12 @@ function App() {
create={}
edit={}
/>
+ }
+ create={}
+ edit={}
+ />
);
}
diff --git a/client/src/components/Section/Create.tsx b/client/src/components/Section/Create.tsx
new file mode 100644
index 0000000..f536431
--- /dev/null
+++ b/client/src/components/Section/Create.tsx
@@ -0,0 +1,16 @@
+import { Create, ReferenceInput, SelectInput, SimpleForm, TextInput } from "react-admin";
+
+function SectionCreate() {
+ return (
+
+
+
+
+
+
+
+
+ );
+};
+
+export default SectionCreate;
\ No newline at end of file
diff --git a/client/src/components/Section/Edit.tsx b/client/src/components/Section/Edit.tsx
new file mode 100644
index 0000000..8ea06dd
--- /dev/null
+++ b/client/src/components/Section/Edit.tsx
@@ -0,0 +1,22 @@
+import { Edit, ReferenceInput, SelectInput, SimpleForm, TextInput, useGetList, useRecordContext } from "react-admin";
+import Title from "../Title";
+
+function SectionEdit() {
+ // const record = useRecordContext();
+ // if (!record) return null;
+
+ // const { data } = useGetList("sections", { id: record.id });
+
+ return (
+ } actions={false}>
+
+
+ {/* */}
+ {/* */}
+ {/* */}
+
+
+ );
+}
+
+export default SectionEdit;
diff --git a/client/src/components/Section/List.tsx b/client/src/components/Section/List.tsx
new file mode 100644
index 0000000..7849ca0
--- /dev/null
+++ b/client/src/components/Section/List.tsx
@@ -0,0 +1,16 @@
+import { List, Datagrid, TextField, EditButton } from "react-admin";
+
+function SectionsList() {
+ return (
+
+
+
+
+
+
+
+
+ );
+};
+
+export default SectionsList;
\ No newline at end of file
diff --git a/server/controllers/section/section.controller.ts b/server/controllers/section/section.controller.ts
new file mode 100644
index 0000000..123567c
--- /dev/null
+++ b/server/controllers/section/section.controller.ts
@@ -0,0 +1,142 @@
+import Section from "../../models/section.model";
+import { ApiErrorHandler } from "../../error/api-error.handler";
+import type { ISectionDto } from "./section.dto";
+import type { Order } from "sequelize";
+import type { NextFunction, Request, Response } from "express";
+import type {
+ FilterQueryParamType,
+ RangeQueryParamType,
+ SortQueryParamType
+} from "../query-param.types";
+
+class SectionController {
+ 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 sections = await Section.findAndCountAll({
+ offset: range[0],
+ limit: range[1] - range[0] + 1,
+ order: [sort] as Order
+ });
+
+ return res.json({ data: sections.rows, total: sections.count });
+ } catch (error) {
+ next(ApiErrorHandler.internal((error as Error).message));
+ }
+ };
+
+ getMany = async (
+ req: Request,
+ res: Response<{ data: Section[] }>,
+ next: NextFunction
+ ) => {
+ try {
+ const filter: FilterQueryParamType = req.query.filter
+ ? JSON.parse(req.query.filter.toString())
+ : { ids: [] };
+
+ const sections = await Section.findAll({
+ where: { id: filter.ids as number[] }
+ });
+ return res.json({ data: sections });
+ } catch (error) {
+ next(ApiErrorHandler.internal((error as Error).message));
+ }
+ };
+
+ create = async (
+ req: Request